test: fail when a second module reads the capability token #44
Loading…
Reference in a new issue
No description provided.
Delete branch "test/single-capability-token-reader"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Follows this comment on #39: a test now fails when a non-test module under
src/other thansrc/credentials.tsreadsREVIEW_CAPABILITY_TOKENby name. It cannot catch a read through a name built at run time.Stacked on #39; merge after it.
🤖 Generated with Claude Code
Review
01M45PN9MJMKNMJV15K1B6CSNG— head1f32183010e315f509c74e55013c284f0c063162Review — j4k-oss/review-wrapper @
2872c765deScope: diff against base tree
e69943819640Status: dispatched — coverage complete (5/5 slots terminal)
Facts: current review-wide projection
Computed under:
Findings (0)
No findings survived.
Reviewed:
Other claims
Coverage
Coverage pass: 01M45PN9P9TH8CY2T0K2QD01Q6
Accounting: complete
Slot health: general-bug (whole/default): unit-failed; writing-quality (whole/default): unit-failed; test-trimming (whole/default): unit-failed; restated-sets (whole/default): unit-failed; project-docs (whole/default): unit-failed
@ -12,0 +12,4 @@// Messages elsewhere mention the variable in prose, so only the name spelled as a// key counts as a read. A key built at run time is invisible to this scan.const CAPABILITY_TOKEN_READS = [/(?<quote>["'])REVIEW_CAPABILITY_TOKEN\k<quote>/u,low — Capability-token isolation scan misses a key spelled in a backtick literal, contrary to its comment
lens
general-bug· armdefault· tally 1 valid / 0 invalid / 0 uncertainclaim
01M457JMNJW07K17GK4HCMP3BMof review01M457GJG60PRA8WXE4NQ5Q347Fixed in
86b79e1. The quoted-key pattern's delimiter class now includes the backtick, soprocess.env[`REVIEW_CAPABILITY_TOKEN`]counts as a read. Prose mentions still don't match, since the closing delimiter has to follow the name directly. I checked it by adding a template-literal read tosrc/main.ts: the test failed, and it passed again once I reverted that.Round 1, review
01M457GJG60PRA8WXE4NQ5Q347ofbfebf35; run 65094 delivered all five slots. Its finding01M457JMNJW07K17GK4HCMP3BMis fixed in86b79e1and answered in thread #126001. The duplicate01M457K49TA6TSYFBZ2Q3YJ16Xis covered by that fix.@ -12,0 +14,4 @@const CAPABILITY_TOKEN_READS = [/(?<quote>["'`])REVIEW_CAPABILITY_TOKEN\k<quote>/u,/\.REVIEW_CAPABILITY_TOKEN\b/u,/\{[^{}]*\bREVIEW_CAPABILITY_TOKEN\b[^{}]*\}[\s,}]*=/u,low — Capability-token read scan misses a type-annotated destructure of process.env, so a second reader keeps the isolation test green
lens
test-trimming· armdefault· tally 2 valid / 0 invalid / 0 uncertainclaim
01M457V0J56VVCQSTFGXDQP605of review01M457RE65WG21QRPFJK1TNCHQFixed in
1f32183. The destructuring pattern now accepts:as well as=after the closing brace, so both annotated forms count as reads. I checked it by appendingexport function mutatedRead({ REVIEW_CAPABILITY_TOKEN }: NodeJS.ProcessEnv)tosrc/main.ts: the test failed, and it passed again once I reverted that. Over the current tree the patterns still match onlysrc/credentials.ts.An unannotated parameter destructure is still not caught, because
)follows the brace. Understrict, such a parameter is an implicitanyunless a caller's type supplies one, so I left)out rather than flag an object literal passed to a call that mentions the name in a message.The destructuring pattern required `=` right after the closing brace, so `const { REVIEW_CAPABILITY_TOKEN }: NodeJS.ProcessEnv = process.env` and an annotated parameter destructure kept the isolation test green. It now accepts `:` there too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>Round 2, review
01M457RE65WG21QRPFJK1TNCHQof86b79e1, all five slots delivered. Its finding01M457V0J56VVCQSTFGXDQP605is fixed in1f32183and answered in thread #126010. The duplicate01M457V801SHGDPHGK8Z17KKT3is covered by that fix.@ -12,0 +12,4 @@// Messages elsewhere mention the variable in prose, so only the name spelled as a// key counts as a read. A key built at run time is invisible to this scan.const CAPABILITY_TOKEN_READS = [/(?<quote>["'`])REVIEW_CAPABILITY_TOKEN\k<quote>/u,low — Capability-token read scan counts a backtick code span in a comment as a read, failing the isolation test on prose mentions
lens
general-bug· armdefault· tally 1 valid / 0 invalid / 0 uncertainclaim
01M458KM7J7NJA94HEFQTW7B61of review01M458GC4R76134GRQ6GCFRBT3Tracked in #46, which is stacked on this PR. The scan there blanks comments and one-line strings before the code patterns run, and counts a string literal as a key only when it is exactly the name. A backtick code span in a comment and the ternary prose string no longer count, while
process.env[`REVIEW_CAPABILITY_TOKEN`]and the other key spellings still do. The test passes today, so this PR keeps its scan as it is.Round 3, review
01M458GC4R76134GRQ6GCFRBT3of1f32183. Neither finding breaks what this PR adds, so both go to follow-ups and this branch stays at1f32183.01M458MP2PD8H6ZQM3R1NWVR34(medium, summary only): the import scan stops at the first newline, so a wrapped import yields no specifier. Tracked in #45, which targetsmain, where the scan and both import tests already live. There the gap beforefromcrosses lines but not statements, and the builtins test fails when it finds no import. A wrapped importer ofcredentials.tsfails the new scan and passed the old one.01M458KM7J7NJA94HEFQTW7B61(low, thread #126092): tracked in #46.