Skip to content

Redact credentials from reviewer authentication errors - #1380

Merged
mergify[bot] merged 6 commits into
mainfrom
lean178/1254-redact-review-auth
Nov 26, 2026
Merged

mergify[bot] merged 6 commits into
mainfrom
lean178/1254-redact-review-auth

Conversation

@eowca

@eowca eowca commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Redact credentials from reviewer authentication errors

Context and goal

  • Goal: Keep reviewer credentials out of the diagnostic displayed and retained when a reviewer cannot authenticate.
  • Problem: Reviewer subprocess output can echo a token or API key before Loop Zero adds login guidance.
  • Context: The scoped change uses the existing authentication classification and diagnostic tail. Tests use synthetic values.

Closes #1254

Acceptance

  • Claude and Codex authentication failures preserve the family, cause, and login remedy while redacting credential values before truncation.
  • Keep coverage for successful, non-auth API-error, and usage-limit outcomes on the current base.
  • Run the delta against the exact checked head.

Notes

Scrub native diagnostics at the shared authentication failure boundary before clipping. Existing credential forwarding, authentication detection, and login remedies continue to use the existing routes.

The fake CLI regression failed before the fix and passes with both login remedies and the original failure exit. Runner tests also exercise authenticated-error envelopes. Security review traced both providers through the shared exception formatter before truncation.

The posted head exceeds the test-line cap by nine lines. Focused CLI and runner regressions pass and the full gate stops at size.

Base

Base: 09d75eb

Validation

Recorded for 8057285a6466

  • uv run --group dev ruff check src tests: exit 0
  • uv run --group dev tach check: exit 0
  • uv run --python 3.14 python scripts/check_architecture_docs.py: exit 0
  • scripts/size_budget.sh: exit 0
  • uv run --group dev pytest -q: exit 0

Review

  • primary, claude, 36aac2b, approve

Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

Security review lens

Apply the security-review checklist to this delta. Trace untrusted reviewer stdout, stderr, and error envelopes through authentication classification, redaction, truncation, exception formatting, alternate-runner output, and local or published diagnostics. Verify raw and JSON-escaped synthetic credentials are removed without losing the corrective action. Treat a reachable credential disclosure as blocking. Cite only synthetic or redacted evidence and return the standard review JSON.

Architecture-Review: unchanged; the runner keeps existing credential forwarding and authentication failure behavior and scrubs native diagnostic text.
Co-Authored-By: Codex <noreply@openai.com>
@eowca
eowca marked this pull request as draft November 26, 2026 02:16

@loopzero-feder-positronics loopzero-feder-positronics Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

loopzero primary review by claude on 36aac2b46a2206bc72d0657b6ed73dda4610904a, 37.4s: approve (0 critical, 0 important, 2 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.

Comment thread src/loopzero/runners.py
raise RunnerAuthFailed(f"{family}: CLI is not authenticated\n{_tail(combined)}")
raise _auth_failure(family, combined)
if _subscription_exhausted(combined, envelope):
raise RunnerUsageLimit(f"{family}: usage limit reached", _tail(combined))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

suggestion: Native diagnostics on non-auth failure paths are still forwarded without redaction

Only the RunnerAuthFailed paths go through _auth_failure. A provider can echo the same forwarded key in output that the auth check misses. For example, a message like Invalid x-api-key does not match _AUTH_PATTERNS. That output then reaches stderr unredacted through RunnerUsageLimit/RunnerPromptTooLong/RunnerBadOutput tails here: runners.py:286 (timeout tail), 296, 298, 299 in _run, and 1164, 1170, 1171 in _review_claude. The task scopes acceptance to auth failures, so this does not block. The goal, though, is to keep credentials out of logs. Smallest fix: split the scrubbing out of _auth_failure into a _redact(family, text) helper and apply it inside _tail for runner diagnostics, or at least in the RunnerBadOutput constructor. Then every runner tail is scrubbed once at a single boundary instead of only at the auth call sites.

Comment thread src/loopzero/runners.py
def _auth_failure(family: str, diagnostic: str) -> RunnerAuthFailed:
names = CLAUDE_AUTH_ENV if family == "claude" else CODEX_AUTH_ENV
env = _proc.build_env(names)
values = {variant for value in env.values() if value for variant in (value, json.dumps(value)[1:-1])}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

suggestion: Very short forwarded env values redact unrelated text

Every non-empty forwarded value becomes a literal redaction pattern. If someone sets ANTHROPIC_API_KEY or CLAUDE_CODE_OAUTH_TOKEN to a placeholder such as 1, x or test, every occurrence of that substring is replaced. This can mangle the failure text the acceptance criteria say must be preserved, e.g. Not logged in becomes No[REDACTED] logged in when the value is t. Smallest fix: skip values below a minimum length, e.g. len(value) >= 8. The provider-shaped sk-/JWT patterns still cover real credentials.

eowca and others added 2 commits November 26, 2026 11:26
Architecture-Review: unchanged; credential redaction stays within the reviewer diagnostic boundary.
Co-Authored-By: Codex <noreply@openai.com>
Architecture-Review: unchanged; this clean base merge preserves reviewer diagnostic redaction.
Co-Authored-By: Codex <noreply@openai.com>

@loopzero-feder-positronics loopzero-feder-positronics Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

loopzero delta review by claude on caf666c65ca377cf9befebd8ee4e7a73f592a534, 23.7s: approve (0 critical, 0 important, 0 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.

Architecture-Review: unchanged; this clean base merge preserves the approved credential-redaction change.
Co-Authored-By: Codex <noreply@openai.com>
@eowca
eowca marked this pull request as ready for review November 26, 2026 14:32
@eowca

eowca commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

@Mergifyio queue

@mergify

mergify Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

❌ Left the queue · Loop-zero Eligibility failed

3 min in the queue, 1 min of it CI.

So far

  • ✅ Entered the queue Thu 26 Nov, 14:33 · rule main · triggered by @eowca with the @mergifyio queue command
  • ❌ Checks failed · draft #1943
  • 🚫 Left the queue 14:35 · 8057285

Not proven to be this pull request's failure. It failed on top of the pull requests ahead of it, and was not tested alone.

Reason

The merge conditions cannot be satisfied due to failing checks

  • Loop-zero Eligibility

Failing checks:

  • ❌ Loop-zero Eligibility

To get back in the queue

  • If the failure comes from the pull requests it was tested with, or is a flake, comment @mergifyio queue to queue it again as it is.
  • If it is this pull request's, push a fix: the pull request is queued again once its queue conditions match.

Merge conditions not met when it left the queue

  • any of · required by GitHub repository ruleset rule main: PR only, Mergify queue, existing checks required:
    • check-neutral = checks
    • check-skipped = checks
    • check-success = checks
  • any of · required by GitHub repository ruleset rule main: PR only, Mergify queue, existing checks required:
    • check-neutral = Loop-zero Eligibility
    • check-skipped = Loop-zero Eligibility
    • check-success = Loop-zero Eligibility
1 merge condition met
  • github-review-approved · required by GitHub repository ruleset rule main: PR only, Mergify queue, existing checks required

Times in UTC · dashboard · how the merge queue works

@mergify mergify Bot added the queued label Nov 26, 2026
@eowca

eowca commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

No description provided.

@eowca

eowca commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

@Mergifyio queue

@mergify

mergify Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

✅ Merged into main as fef55ed at 14:44 UTC

5 min in the queue, 4 min of it CI.

So far

  • ✅ Entered the queue Thu 26 Nov, 14:38 · rule main · triggered by @eowca with the @mergifyio queue command
  • ✅ Passed · draft #1947
  • ✅ Merged 14:44 · fef55ed · squash
3 merge conditions met
  • github-review-approved · required by GitHub repository ruleset rule main: PR only, Mergify queue, existing checks required
  • any of · required by GitHub repository ruleset rule main: PR only, Mergify queue, existing checks required:
    • check-success = checks
    • check-neutral = checks
    • check-skipped = checks
  • any of · required by GitHub repository ruleset rule main: PR only, Mergify queue, existing checks required:
    • check-success = Loop-zero Eligibility
    • check-neutral = Loop-zero Eligibility
    • check-skipped = Loop-zero Eligibility

Times in UTC · dashboard · how the merge queue works

@mergify mergify Bot added the queued label Nov 26, 2026
@eowca

eowca commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

No description provided.

@mergify mergify Bot removed the dequeued label Nov 26, 2026
@mergify
mergify Bot merged commit fef55ed into main Nov 26, 2026
23 checks passed
@mergify mergify Bot removed the queued label Nov 26, 2026
@eowca
eowca deleted the lean178/1254-redact-review-auth branch November 26, 2026 14:44
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.

security: Redact reviewer credentials from authentication diagnostics

1 participant