Repository navigation
Commit d27f700
authored
Keep the refreshed access token out of the log (#1287)
## Problem
With verbose SDK logging on, the access token the server refreshes
during a session is written to the log, on every platform. An app that
turns on FINE logging, or forwards SDK logs to a crash reporter or a
support bundle, ends up with a usable token in them.
#1275 masked the token in the signalling URL log line. This is the other
place it was logged.
## Cause
`SignalTokenUpdatedEvent.toString()` printed the token. Events are
logged with their text form in two places:
- the event emitter logs every emitted event at FINEST
- the signal client logs every signal event at FINE
The event is emitted each time the server refreshes the token, and when
the participant is moved to another room, and each emit writes the new
token twice.
## Fix
The event's text form now says `token: <redacted>`. The event still
carries the token for the code that needs it.
## Testing
- New unit test `test/core/signal_token_log_test.dart`: emits the event
with logging at its most verbose and checks that no log record contains
the token. It fails without the fix and passes with it.
- Full suite: 575 passed, 1 skipped. Analyze, format and import order
pass.
- e2e-flutter, new scenario "The access token stays out of the logs"
(local branch `hiroshi/token-log-scenario`, not pushed yet). It scans
every log record through a connect, a resume, a full reconnect and a
disconnect for anything shaped like a token, on macOS:
| livekit_client | Result |
|---|---|
| `release/2.14.0` 7adfa35 | fails, 6 records carry a token, from the
two log lines above |
| this branch | passes, 599 records and none carries a token |
## Notes
- Not a regression. The published 2.13.2 logs the token the same way.
- A candidate for 2.14.0 (#1286), since that release's changelog already
says the token is kept out of the signalling log.1 parent f9a7dc7 commit d27f700
3 files changed
Lines changed: 49 additions & 1 deletion
File tree
- .changes
- lib/src/internal
- test/core
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
554 | 554 | | |
555 | 555 | | |
556 | 556 | | |
| 557 | + | |
557 | 558 | | |
558 | | - | |
| 559 | + | |
559 | 560 | | |
560 | 561 | | |
561 | 562 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
0 commit comments