-
-
Notifications
You must be signed in to change notification settings - Fork 79.1k
Secret/credential masking corrupts image base64 with ellipsis marker (U+2026), permanently poisoning the session #90760
Copy link
Copy link
Closed
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:needs-security-reviewClawSweeper marked this issue as needing security-sensitive review.ClawSweeper marked this issue as needing security-sensitive review.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.ClawSweeper marked this issue as an existing queue_fix_pr work candidate.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.Channel message delivery can be lost, duplicated, or misrouted.impact:securitySecurity boundary, credential, authz, sandbox, or sensitive-data risk.Security boundary, credential, authz, sandbox, or sensitive-data risk.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Metadata
Metadata
Assignees
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:needs-security-reviewClawSweeper marked this issue as needing security-sensitive review.ClawSweeper marked this issue as needing security-sensitive review.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.ClawSweeper marked this issue as an existing queue_fix_pr work candidate.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.Channel message delivery can be lost, duplicated, or misrouted.impact:securitySecurity boundary, credential, authz, sandbox, or sensitive-data risk.Security boundary, credential, authz, sandbox, or sensitive-data risk.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Summary
The secret/credential-masking layer runs its redaction pass over image base64 payloads and replaces matched substrings with the masking marker
…(U+2026). This corrupts the base64 irrecoverably and injects a non-ASCII character intoimage.source.base64. On the next turn (and every turn after), the provider mapper replays the poisoned image block from history and the Anthropic API rejects the entire request:The session is then permanently stuck — every subsequent user message fails with the same error because the corrupted frame keeps replaying from history. Plain-text turns only recover once the replay window scrolls past the bad frame.
This is distinct from #86984
#86984 / PR #88112 describe a different corruption path with the same symptom/error string:
dataforwarded as raw latin1/binary bytes, never base64-encoded…(U+2026)ensureAsciiBase64)ensureAsciiBase64(PR #88112) would not fix this variant: once the masker replaces base64 bytes with…, the data is gone. Re-encoding the corrupted string produces an invalid image.Root cause
The credential/secret-redaction layer scans message content for secret-like patterns and replaces matches with
…. It does not excludeimage.source.base64/ imagedatafields. A long base64 blob can contain a substring that matches a secret heuristic, so the masker rewrites part of the base64 with the ellipsis marker, corrupting it.Evidence (production, 2026.5.20)
Real session on our deployment:
IMG_6842.png, ~80,609-char base64) ended up with exactly one non-ASCII character:\u2026(U+2026, the masking marker).messages.428.content.0.image.source.base64.messages.428.content.0.image.source.base64: string argument should contain only ASCII charactersuntil we manually stripped the image block from the session JSONL.Expected behavior
The secret/credential-masking pass should skip image base64 payloads entirely (
image.source.base64, image blockdatafields, and any data-URL base64). Redacting inside an opaque base64 blob can never reveal a real secret to a human reader anyway, and it corrupts the payload.Suggested fix
Workaround
Strip the poisoned image block from the session JSONL (the base64 data is unrecoverable). Replacing it with a text placeholder restores the session.
Environment
Cross-ref: #86984 (same error, different corruption path), PR #88112.