feat: widen the paste rules to cover cloud env vars and PEM keys - #35
Merged
Merged
Conversation
Read Claude Code's own detector to see what it catches. It ships a table of 59 regexes tagged high or low confidence, picks a tier by the direction the data is travelling -- both tiers outbound to telemetry, high only for anything shown to a person -- and has no entropy-based detection at all, which confirms the limit already written down here. Three of its rules were missing on our side: - Cloud environment variables. NOT copied as-is: their rule redacts the value of anything matching AWS_|GOOGLE_|AZURE_, which is free for telemetry but would strip AWS_REGION=us-east-1 and AWS_PROFILE=default out of a paste, and an agent that cannot see your region cannot answer the question. Narrowed to names carrying SECRET, KEY, TOKEN, PASSWORD or CREDENTIAL. - PEM private keys, as a whole block. Previously only caught inside a JSON value, so pasting the file itself went through. The END marker is required so prose mentioning -----BEGIN PRIVATE KEY----- survives. - GOCSPX- client secrets, the A3T access-key prefix, and AWS's base32 alphabet. Their low-confidence tier is deliberately left out: sensitive-assign fires on password, token, cookie and authorization, which would damage the code you paste for review. termit's paste is read for meaning by a person and an agent, so it follows redactForDisplay, not redact. Redaction is now idempotent and the count honest: a value already reading [redacted] is neither re-counted nor re-replaced, so overlapping rules on AWS_ACCESS_KEY_ID=AKIA... report one secret, not two. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
tkc
added a commit
that referenced
this pull request
Sep 25, 2026
* docs: note that a sleeping Mac stops an agent waiting on a reset Claude Code resumes its task by itself when a usage limit resets, but only while its session is alive, which makes leaving termit open the thing that gets work done overnight. A sleeping Mac freezes every process, so the reset passes and nothing happens -- and none of the assertions already on this machine (coreaudiod, sharingd, powerd) hold PreventSystemSleep, so the default state is not enough. `caffeinate -is termit` covers it, and releases both assertions when termit exits. Verified: PreventSystemSleep goes 0 -> 1 while it runs and back to 0 after. The two limits are stated, because both are easy to trip over: -s applies only on AC power, per its man page, and neither flag stops a laptop sleeping when the lid closes. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * fix: mask credentials on screen, not on paste The paste-time redaction shipped in #34/#35 solved the wrong problem. The requirement is that a credential still works and simply is not visible, not that it never reaches the program. Redacting the paste turned `export AWS_SECRET_ACCESS_KEY=wJalr...` into `export AWS_SECRET_ACCESS_KEY=[redacted]`, so the shell assigned the literal string and the failure surfaced much later, in an AWS call far from its cause. Masking now happens while drawing. The grid keeps the real text and the pty gets the real bytes, so a pasted export works exactly as typed and ⌘C copies the real value; what disappears is the credential being visible in a screenshot, a screen share, or scrollback an hour later. Redactor::spans returns byte ranges, masked_cells maps them to columns, and the draw loop substitutes a bullet per cell so column alignment -- and any full-screen UI drawn on top of it -- does not shift. The byte-to-column mapping is the part that can silently go wrong, so a test masks a line with double-width characters ahead of the secret and asserts the bullets land on the key and nowhere else. Costs 0.041ms median for a full 47x163 screen with a credential every eighth line, against roughly 1ms to build a frame. An ignored test re-measures it. `[paste]` becomes `[screen]`, since the table now describes what is drawn. ⌥⌘V and Action::PasteRaw are gone: with paste left alone there is nothing to escape from. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.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.
Follow-up to #34, after reading Claude Code's own credential detector.
What Claude Code actually does
Inspected the shipped binary (
~/.local/share/claude/versions/2.1.273). It carries a table of 59 regexes, each{id, source, flags, confidence}, and:entropyappears only in Node internals and in the prose of themaskDuplicatesdocs. This confirms the limit already stated in our README — a bare AWS secret key is not detectable, and Anthropic reached the same conclusion.(?P<secret>…)here, and as the sandbox'sextractsetting.Over-redact on the way out; under-redact on the way to a reader. Their value pattern even matches
[REDACTED]itself, so re-running is safe.Worth noting: per the data-usage docs, this detector runs on telemetry,
/feedbackbundles and transcript uploads only — "Source code, file contents, and other conversation content are uploaded as-is." The path to the model is covered by user-declared rules instead (Read(./.env)deny rules, sandboxmask). termit's paste boundary sits in that gap.The three rules taken
1. Cloud environment variables — narrowed, not copied. Theirs redacts the value of anything matching
AWS_|GOOGLE_|GCP_|GCLOUD_|AZURE_. Free for telemetry; wrong here. It would stripAWS_REGION=us-east-1andAWS_PROFILE=defaultout of your paste, and an agent that cannot see your region cannot answer the question you asked. Narrowed to names carrying SECRET, KEY, TOKEN, PASSWORD or CREDENTIAL — there is a test asserting plain cloud settings arrive untouched.2. PEM private keys, whole. Previously only caught inside a JSON value, so pasting the key file itself went straight through. The
-----END …-----marker is required, so prose mentioning-----BEGIN PRIVATE KEY-----is not swallowed to the end of the paste.3.
GOCSPX-client secrets, theA3Taccess-key prefix, and AWS's base32 alphabet[A-Z2-7].Deliberately not taken: the low-confidence tier
sensitive-assignfires onpassword,token,cookie,authorization,session_id,connection_string. That is right for telemetry and wrong for a paste that a person and an agent both read for meaning — it would damage the code you paste for review. termit's paste followsredactForDisplay, notredact.Also fixed
Redaction is now idempotent and the count honest. A span already reading
[redacted]is neither re-counted nor re-replaced, soAWS_ACCESS_KEY_ID=AKIA…— which matches both the prefix rule and the variable-name rule — reports one secret rather than two.Test
231 pass (up from 224), 1 ignored. clippy
-D warningsandfmt --checkclean. Seven new tests: cloud env vars redacted, plain cloud settings byte-for-byte unchanged, a PEM block redacted whole with the surrounding sentences kept, an unterminated PEM left alone,GOCSPX-, no count inflation from overlapping rules, and redacting twice being a no-op. The README's rule list is regenerated from the shipped defaults and pinned to them by the existing test.docs/references/paste.mdrecords the investigation.🤖 Generated with Claude Code