Skip to content

Commit be7644b

Browse files
committed
Correct the short-circuit test's comment to match what it actually guards
The comment claimed swapping the cap and scrub back would fail this test. It does not: the secret sits at the front of a 90KB payload, nowhere near the cap boundary, so cap-then-scrub still leaves the whole key intact for the scrub to catch. This test guards the PREPENDED POSITION of both terminal concerns (moving them away from the front of the array fails it); the RELATIVE order between them is guarded only by the boundary-straddle test. Leaving the old comment in place risked a future engineer reading this test as redundant coverage and deleting the straddle test, silently reopening the exploit.
1 parent 2674b74 commit be7644b

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

src/agent/posix-tool-plugins.test.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,8 +338,15 @@ describe("buildCorePosixToolPlugins", () => {
338338
// wrapped by the unconditional outer plugins in buildCorePosixToolPlugins.
339339
// This composes the REAL production array from the builder — not a
340340
// hand-picked middleware order — with a short-circuiting stand-in spliced
341-
// in at ripgrepPlugin's own position, so a future reordering of the real
342-
// array (e.g. swapping the cap and scrub back) fails this test.
341+
// in at ripgrepPlugin's own position, so moving both terminal concerns
342+
// away from the front of the real array fails this test.
343+
//
344+
// This guards their PREPENDED POSITION only, not the RELATIVE order
345+
// between the two of them: the secret here sits at the very front of the
346+
// payload, nowhere near the cap boundary, so it survives even under the
347+
// exploitable cap-then-scrub order. The relative order is guarded solely
348+
// by the boundary-straddle test below — do not treat this test as
349+
// redundant with it.
343350
const secretShapedContent = `AKIAABCDEFGHIJKLMNOP\n${"x".repeat(90_000)}`;
344351
const shortCircuitingPlugin: ToolPlugin = {
345352
middleware: () => async (call: ToolCall): Promise<ToolResult> => ({

0 commit comments

Comments
 (0)