Repository navigation
ENG-5821: report credential presence in doctor instead of a truncated live token - #4
Merged
Merged
Conversation
ENG-5821. The doctor token row, account show, and every redaction path emitted sr_live_<lookup-id>_***, which is a live-token prefix rather than a redaction. Report presence (present / (none)) and redact to sr_live_*** with no lookup segment. Co-authored-by: Gersham Meharg <gersham@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes ENG-5821 (secrets leak).
The leak
The
doctortokenrow setdetail: describeToken(resolved.token), anddescribeTokenreturnedredactToken(token), which was`sr_live_${lookupId}_***`. That is not a redaction: the lookup segmentidentifies the live credential, so
screenrig --json doctor, the humandoctorlines,account show, and everyredactText/redactValuepathprinted a usable prefix of a production token.
account showalso carried itas an envelope field named
token_lookup.The fix
src/redact.ts:redactTokenis gone. A redacted credential is the constantREDACTED_TOKEN(sr_live_***) with no lookup id, used byredactTextandby the sensitive-key path in
redactValue.tokenLookupIdstays, documentedas internal correlation that never reaches output; nothing on an output path
calls it any more except the check that decides
sr_live_***versus***.src/config.ts:describeTokenis replaced byhasToken(boolean) anddescribeTokenPresence(present/(none)). Neither reads the value.src/commands.ts: thedoctortokenrow reportsdescribeTokenPresence(resolved.token)and keys itspass/failoffhasToken.account showreportstoken_present: booleanin the envelope(renamed from
token_lookup, which cannot be populated without leaking) andtoken: presentin the human line.README.mddocuments that thetokenrow is presence only.AGENTS.mdrecords the rule so the shape is not reintroduced.
Tests
src/cli.test.ts: with a realisticsr_live_<id>_<secret>fixture in config, thetokencheck still passes,its detail is exactly
present, the JSON envelope includes the check, andneither
--json doctorstdout nor humandoctorstdout matches/sr_live_/,the lookup id, or the secret segment. A second test asserts the unconfigured
host fails the row with
(none)and still prints no token shape.account showassertions extended:token_presentistrue, the human lineis
token: present, and stdout matches neither/sr_live_/nor the fixturelookup id.
src/redact.test.ts: the previous expectation ofsr_live_identifier_***isupdated to
sr_live_***, plus a regression test that no redaction path keepsthe lookup segment.
Verification
npm ci,npm run check:public,npm run vendor:check,npm run typecheck,npm run lint,npm test(349 tests, 348 pass, 1 pre-existing skip that needsSCREENRIG_EXTRACTOR_BIN), andnpm run smoke:mockall pass. No vendored file,workflow, or deploy configuration is touched, and no real credential was used.
Scope
Doctor/redaction presence only. Independent of the primitive+selector rename
work; nothing here belongs on that PR. Do not merge until Sec signs ENG-5821.