Skip to content

fix: redact 2FA code from homebridge-ui server log#1746

Merged
dgreif merged 1 commit into
dgreif:mainfrom
kzaky:security/redact-2fa-code-from-ui-server-log
May 21, 2026
Merged

fix: redact 2FA code from homebridge-ui server log#1746
dgreif merged 1 commit into
dgreif:mainfrom
kzaky:security/redact-2fa-code-from-ui-server-log

Conversation

@kzaky
Copy link
Copy Markdown
Contributor

@kzaky kzaky commented May 21, 2026

Summary

The homebridge-ui plugin server logs the user's 2FA code in plaintext at packages/homebridge-ring/homebridge-ui/server.ts:62 when exchanging it for a refresh token:

console.log(`Getting token for ${email} with code ${code}`)

Ring's 2FA codes are short-lived (~10 min) and single-use, so the practical risk is bounded — but homebridge logs are frequently pasted into bug reports, GitHub issues, and Discord screenshots. Anyone watching the log in that window could replay the code before it expires.

This PR drops with code ${code} from the log statement. The email is kept so the "we're at the token-exchange step for this user" signal is preserved for debugging.

Changes

  • One-line edit in homebridge-ring/homebridge-ui/server.ts
  • Changeset added (patch bump on homebridge-ring)

Test plan

  • npx turbo run lint test --filter=homebridge-ring --filter=ring-client-api — all 18 tests pass, lint clean
  • Manual review: code is still destructured and passed to getAuth(code) on the following line, so the unused-var lint rule isn't triggered and behavior is unchanged

The homebridge-ui server logs the 2FA code in plaintext on token
exchange. Codes are short-lived and single-use, but logs are
frequently shared in bug reports/screenshots, so removing the value
from the log is a small defensive improvement. The email is kept so
the existing "we're at the token-exchange step" signal is preserved.
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 21, 2026

🦋 Changeset detected

Latest commit: 3305c8e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
homebridge-ring Patch
ring-client-api Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Copy Markdown
Owner

@dgreif dgreif left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that we shouldn't be logging this. Thanks for suggesting the change

@dgreif dgreif enabled auto-merge (squash) May 21, 2026 12:49
@dgreif dgreif merged commit 25c6ec6 into dgreif:main May 21, 2026
3 checks passed
@dgreif dgreif mentioned this pull request May 21, 2026
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.

2 participants