Repository navigation
Redact credentials in PR check summaries - #1284
Conversation
Architecture-Review: unchanged; the shared Validation renderer still projects local check receipts into the PR body. Co-Authored-By: Codex <noreply@openai.com>
There was a problem hiding this comment.
loopzero primary review by claude on 8da5c4bcf55ed2b1d63d3bc85f0e57d4726e4c10, 47.8s: request_changes (0 critical, 1 important, 1 suggestion)
Settings per native call (launch configuration and CLI claims, not backend attestation):
- Call 1: requested model claude-opus-5-5 (effort medium); CLI-reported model claude-opus-5-5 (effort unknown); configured model claude-opus-5-5 (effort medium)
Native Claude output is retained in the restricted local review receipt.
| def redact_credentials(value: str) -> str: | ||
| value = re.sub(r"""(?i)(https?://)[^\s/?#'"<>`]+@""", r"\1[REDACTED]@", value) | ||
| return re.sub(r"""(?i)((?P<quote>['"])?\bauthorization[ \t]*:[ \t]*)""" | ||
| r"""(?(quote)(?:(?!(?P=quote))[^\r\n])+|(?:(?:basic|bearer|token)\s+)?[^\s'"`]+)""", |
There was a problem hiding this comment.
suggestion: Unquoted Authorization value leaks with shell-escaped spaces or unlisted schemes
In the unquoted branch, the optional scheme list is only basic|bearer|token, and [^\s'"]+` stops at the first whitespace. Two cases leak:
- Shell-escaped spaces:
-H Authorization:\ Bearer\ tokredacts only the backslash, givingAuthorization:[REDACTED] Bearer\ tok. - Unlisted schemes:
Authorization: Bot xyz,Digest ...andAWS4-HMAC-SHA256 Credential=...redact only the scheme word and leave the secret visible.
Safer default: in the unquoted branch, redact to the end of the shell word, treating \ as part of the word, or to the end of the line. Over-redacting is cheap here, while under-redacting publishes the secret.
Architecture-Review: unchanged; Validation rendering owns redaction for both GitHub publication paths. Co-Authored-By: Codex <noreply@openai.com>
There was a problem hiding this comment.
loopzero delta review by claude on aaa18e347b454d168dda834eeee7bfb380135617, 55.4s: approve (0 critical, 0 important, 3 suggestion)
Settings per native call (launch configuration and CLI claims, not backend attestation):
- Call 1: requested model claude-opus-5-5 (effort medium); CLI-reported model claude-opus-5-5 (effort unknown); configured model claude-opus-5-5 (effort medium)
Native Claude output is retained in the restricted local review receipt.
|
|
||
| def redact_credentials(value: str) -> str: | ||
| value = re.sub(r"""(?i)(https?://)[^\s/?#'"<>`]+@""", r"\1[REDACTED]@", value) | ||
| value = re.sub(r"""(?i)(\bauthorization(?:\\?['"])?[ \t]*:[ \t]*)(\\?['"])(?:(?!\2)(?:\\.|[^\\\r\n]))+\2""", |
There was a problem hiding this comment.
suggestion: Quoted-key values that use a string prefix or = are still published unredacted
The new first pass only matches when a quote comes straight after the colon, and the second pass is skipped because of the quote after the key. So {"Authorization": f"Bearer <literal>"}, a b"..." or r"..." value, and dict(Authorization="Bearer <literal>") / Authorization="..." kwargs all reach the Validation block unredacted. The existing 'Authorization': '...' and "Authorization": "..." cases are covered. A literal token inside an f-string is unusual, so this is not blocking. If you want it covered, allow an optional [rbfu]{0,2} prefix before group 2 and accept [:=] as the separator. Add one test case for each.
|
|
||
| def redact_credentials(value: str) -> str: | ||
| value = re.sub(r"""(?i)(https?://)[^\s/?#'"<>`]+@""", r"\1[REDACTED]@", value) | ||
| value = re.sub(r"""(?i)(\bauthorization(?:\\?['"])?[ \t]*:[ \t]*)(\\?['"])(?:(?!\2)(?:\\.|[^\\\r\n]))+\2""", |
There was a problem hiding this comment.
suggestion: Two overlapping Authorization regexes need to be kept in sync by hand
Two passes now handle Authorization: one for a quoted key with a quoted value, and one for a quoted header string or an unquoted header. Each has its own escape and quote handling, so a future fix to one can easily miss the other. The ordering also matters: the second pass only avoids redacting "Authorization": "[REDACTED]" again because a quote sits between the key and the colon. Consider building both from one compiled, commented (re.X) pattern with named alternatives, or at least add a comment that explains why the order matters.
| value = re.sub(r"""(?i)(\bauthorization(?:\\?['"])?[ \t]*:[ \t]*)(\\?['"])(?:(?!\2)(?:\\.|[^\\\r\n]))+\2""", | ||
| r"\1\2[REDACTED]\2", value) | ||
| return re.sub(r"""(?i)((?P<quote>['"])?\bauthorization[ \t]*:[ \t]*)""" | ||
| r"""(?(quote)(?:\\.|(?!(?P=quote))[^\\\r\n])+|(?:[a-z][\w-]*[ \t]+)?(?:\\.|[^\\\s'"`])+)""", |
There was a problem hiding this comment.
suggestion: Broadened scheme prefix can over-redact ordinary command text
(?:[a-z][\w-]*[ \t]+)? now treats any word followed by a space as an auth scheme. For an unquoted Authorization:abc next-arg, both abc and next-arg (for example a following URL or flag) are swapped for [REDACTED]. Nothing leaks, but this works against the acceptance goal that ordinary command text stays readable. Low impact, because unquoted Authorization headers are rare in shell commands. You could keep the general scheme prefix only when another non-space token follows it on the same argument, or just accept the trade-off.
|
@Mergifyio queue |
✅ Merged into
|
|
No description provided. |
Redact credentials in PR check summaries
Context and goal
Closes #1258
Acceptance
Notes
The boundary is the GitHub Validation block. Private config and check receipts continue to supply original commands for execution and matching. Redact recognizable credential syntax at the shared renderer so the GitHub create and update payloads both use the safe text.
Both mocked GitHub payloads failed the regression on the unpatched base and passed with renderer redaction. Security review traced private config through receipt matching and both publication paths. The architecture guide still describes these boundaries.
The delta regression covers quoted header keys, shell-escaped values, and multi-part quoted headers. The focused tests pass at the approved head. The source head passed the full local gate after the cap increase. Integration with current main reaches 13,527 test lines against the 13,500-line cap, so this clean base merge is parked with its inherited delta approval.
Base
Base: 35f3d8d
Validation
Recorded for
84f75120e2fcuv run --group dev ruff check src tests: exit 0uv run --group dev tach check: exit 0uv run --python 3.14 python scripts/check_architecture_docs.py: exit 0scripts/size_budget.sh: exit 0uv run --group dev pytest -q: exit 0Review
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.