Skip to content

fix(rtmp): setLogs(false) does not silence the command logs, which print the stream key - #2204

Open
aakashthirteen wants to merge 1 commit into
pedroSG94:masterfrom
aakashthirteen:fix/setlogs-silences-command-logs
Open

aakashthirteen wants to merge 1 commit into
pedroSG94:masterfrom
aakashthirteen:fix/setlogs-silences-command-logs

Conversation

@aakashthirteen

Copy link
Copy Markdown

Problem

RtmpClient.setLogs(false) only reaches RtmpSender, so the command logs in CommandsManager and CommandsManagerImp are emitted unconditionally. There is no way for an app to turn them off.

Those lines print the message as it goes on the wire:

line contains
send $connect tcUrl
send $releaseStream, send $fcPublish, send $publish the stream name
read $message the server's onStatus reply, which echoes the stream name back

On YouTube Live, Twitch and most other services the stream name is the stream key. Measured on a device publishing to YouTube with a deliberately distinctive key: it appears 4 times in logcat, plus the ingest URL once.

Since Android 4.1 logcat is readable only by the owning app, so this is not remotely exploitable. But it still writes a publishing credential into the device log, where a bug report or a phone with USB debugging enabled will pick it up, and an app currently has no way to prevent it.

Change

  • CommandsManager gains isEnableLogs, defaulting to true, so behaviour is unchanged unless an app opts out.
  • The info-level command logs in CommandsManager and CommandsManagerImp are guarded by it.
  • RtmpClient.setLogs() forwards to the commands manager as well as the sender.

Log.e is deliberately untouched.

Honesty about verification

I could not build the module locally, as Gradle could not reach its distribution server from my environment. The change is 13 single-line guards plus one property and one line of wiring, each reviewed by hand, but please let CI confirm it rather than taking my word for it.

Happy to go further

If you would rather the stream name never appear even with logs enabled, I can redact it in those lines instead of, or as well as, gating them. Say the word and I will update this PR.

RtmpClient.setLogs() only reached RtmpSender, so the command logs in
CommandsManager and CommandsManagerImp were emitted unconditionally.

Those lines print the message as it goes on the wire:

  send $connect                              -> includes tcUrl
  send $releaseStream / $fcPublish / $publish -> include the stream name
  read $message                              -> the server's onStatus reply,
                                                which echoes the stream name

On YouTube Live, Twitch and most other services the stream name IS the
stream key, so an app has no way to keep a publishing credential out of
logcat.

CommandsManager gains isEnableLogs, defaulting to true so nothing
changes unless an app opts out, the info-level command logs are guarded
by it, and setLogs() now forwards to the commands manager as well as the
sender. Log.e is untouched.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant