Skip to content

Keep secrets in a Secret newtype and derive Debug - #40

Merged
Yannicked merged 1 commit into
mainfrom
refactor/secret-newtype
Oct 14, 2026
Merged

Yannicked merged 1 commit into
mainfrom
refactor/secret-newtype

Conversation

@Yannicked

Copy link
Copy Markdown
Owner

Teams' token responses (TokenResponse, AuthzTokens, AuthzResponse) and DeviceCodeResponse.device_code derived Debug and would have printed their tokens; the log redaction misses Azure's opaque refresh tokens. Nothing logged them yet.

redact::Secret is a string whose Debug prints <redacted>, (de)serializes as the bare string and derefs to &str. With it, Command derives Debug (its 310-line hand-written one goes), and so do AppCredentials, AudienceToken, ConsumerToken, Meeting, ConnectionsOpen, AuthedUser, OauthAccess, TurnCredentials, Relay, MadeMeeting and SetCookie. Slack's Token and TeamsCredentials keep their hand-written Debug: converting them touched 40+ sites for ~15 lines.

Command's Debug now prints every non-secret field in full (an emoji upload's bytes, an edit's old message); nothing logs a Command.

+160 / −538 lines.

@Yannicked Yannicked mentioned this pull request Oct 14, 2026
@Yannicked
Yannicked added this pull request to stack #44 October 14, 2026 13:53
Teams token responses printed their tokens in Debug; they now can't.
@Yannicked
Yannicked force-pushed the refactor/secret-newtype branch from 7d9b9b1 to 4a3e994 Compare October 14, 2026 13:59
@Yannicked
Yannicked merged commit 20fb6dd into main Oct 14, 2026
8 checks passed
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