@@ -15,7 +15,6 @@ import {
1515 writeFileSync ,
1616} from "node:fs" ;
1717import { dirname , join , resolve } from "node:path" ;
18- import { pathToFileURL } from "node:url" ;
1918
2019const args = Object . fromEntries (
2120 Array . from ( { length : ( process . argv . length - 2 ) / 2 } , ( _ , index ) => [
@@ -44,18 +43,35 @@ const deniedLog = join(proofRoot, "denied-commands.log");
4443for ( const command of [ "gh" , "codex" , "claude" ] ) {
4544 writeFileSync (
4645 join ( tripwireDir , command ) ,
47- `#!${ process . execPath } \nrequire('node:fs').appendFileSync(${ JSON . stringify ( deniedLog ) } , '${ command } denied\\n'); process.exit(97);\n` ,
46+ String . raw `#!/usr/bin/env node
47+ const command = require('node:path').basename(process.argv[1]);
48+ require('node:assert/strict').ok(['gh', 'codex', 'claude'].includes(command));
49+ require('node:fs').appendFileSync(process.env.CLAWSWEEPER_PROOF_DENIED_LOG, command + ' denied\n');
50+ process.exit(97);
51+ ` ,
4852 { mode : 0o755 } ,
4953 ) ;
5054}
5155const denyNetwork = join ( proofRoot , "deny-network.cjs" ) ;
5256writeFileSync (
5357 denyNetwork ,
54- `const deny = () => { require('node:fs').appendFileSync(${ JSON . stringify ( deniedLog ) } , 'network denied\\n'); throw new Error('Synthetic proof denies network'); }; globalThis.fetch = deny; require('node:net').Socket.prototype.connect = deny; for (const name of ['node:http', 'node:https']) { const module = require(name); module.request = deny; module.get = deny; } require('node:module').syncBuiltinESMExports();\n` ,
58+ String . raw `const deny = () => {
59+ require('node:fs').appendFileSync(process.env.CLAWSWEEPER_PROOF_DENIED_LOG, 'network denied\n');
60+ throw new Error('Synthetic proof denies network');
61+ };
62+ globalThis.fetch = deny;
63+ require('node:net').Socket.prototype.connect = deny;
64+ for (const name of ['node:http', 'node:https']) {
65+ const module = require(name);
66+ module.request = deny;
67+ module.get = deny;
68+ }
69+ require('node:module').syncBuiltinESMExports();
70+ ` ,
5571) ;
5672const childEnv = {
5773 PATH : [ tripwireDir , dirname ( process . execPath ) , "/usr/bin" , "/bin" ] . join ( ":" ) ,
58- NODE_OPTIONS : `--require= ${ denyNetwork } ` ,
74+ CLAWSWEEPER_PROOF_DENIED_LOG : deniedLog ,
5975 CI : "1" ,
6076} ;
6177const commands = [ ] ;
@@ -66,7 +82,8 @@ function equal(actual, wanted, label) {
6682 assert . deepEqual ( actual , wanted , label ) ;
6783}
6884function run ( name , argv ) {
69- const result = spawnSync ( process . execPath , argv , {
85+ const nodeArgs = [ "--require" , denyNetwork , ...argv ] ;
86+ const result = spawnSync ( process . execPath , nodeArgs , {
7087 cwd : proofRoot ,
7188 env : childEnv ,
7289 encoding : "utf8" ,
@@ -76,8 +93,8 @@ function run(name, argv) {
7693 writeFileSync ( join ( proofRoot , `${ name } .stderr` ) , result . stderr ) ;
7794 commands . push ( {
7895 name,
79- argv : [ process . execPath , ...argv ] ,
80- argvSha256 : hash ( JSON . stringify ( [ process . execPath , ...argv ] ) ) ,
96+ argv : [ process . execPath , ...nodeArgs ] ,
97+ argvSha256 : hash ( JSON . stringify ( [ process . execPath , ...nodeArgs ] ) ) ,
8198 cwd : proofRoot ,
8299 exitCode : result . status ,
83100 } ) ;
@@ -87,6 +104,17 @@ const tripwireCheck = run("tripwire-self-check", [join(tripwireDir, "gh")]);
87104equal ( tripwireCheck . status , 97 , "the GitHub tripwire executes and denies commands" ) ;
88105equal ( readFileSync ( deniedLog , "utf8" ) , "gh denied\n" , "the GitHub tripwire records attempts" ) ;
89106unlinkSync ( deniedLog ) ;
107+ const networkCheck = run ( "network-self-check" , [ "--eval" , 'fetch("https://example.invalid");' ] ) ;
108+ equal (
109+ {
110+ exitCode : networkCheck . status ,
111+ deniedError : networkCheck . stderr . includes ( "Error: Synthetic proof denies network" ) ,
112+ } ,
113+ { exitCode : 1 , deniedError : true } ,
114+ "the application preload rejects fetch with its known denial error" ,
115+ ) ;
116+ equal ( readFileSync ( deniedLog , "utf8" ) , "network denied\n" , "the network tripwire records attempts" ) ;
117+ unlinkSync ( deniedLog ) ;
90118const requiredDecision = {
91119 required : true ,
92120 kind : "manual_review" ,
@@ -208,9 +236,28 @@ for (const { name, markdown, required, baselinePoisoned } of [
208236 const probe = join ( proofRoot , `${ name } -decisions.mjs` ) ;
209237 writeFileSync (
210238 probe ,
211- `import { readFileSync } from 'node:fs';\nimport { maintainerDecisionBlocksClose, buildDecisionPacketFromReport } from ${ JSON . stringify ( pathToFileURL ( join ( root , "dist/decision-packets.js" ) ) . href ) } ;\nconst none = readFileSync(${ JSON . stringify ( reportPath ) } , 'utf8'); const required = readFileSync(${ JSON . stringify ( requiredPath ) } , 'utf8');\nconsole.log(JSON.stringify({ noneBlocked: maintainerDecisionBlocksClose(none), nonePacket: buildDecisionPacketFromReport(none), requiredBlocked: maintainerDecisionBlocksClose(required), requiredPacket: buildDecisionPacketFromReport(required, { generatedAt: '2026-08-30T00:00:00.000Z', reportPath: 'records/openclaw-clawsweeper/items/321.md' }) }));\n` ,
239+ `import { readFileSync } from 'node:fs';
240+ import { pathToFileURL } from 'node:url';
241+ const { maintainerDecisionBlocksClose, buildDecisionPacketFromReport } = await import(pathToFileURL(process.argv[2]).href);
242+ const none = readFileSync(process.argv[3], 'utf8');
243+ const required = readFileSync(process.argv[4], 'utf8');
244+ console.log(JSON.stringify({
245+ noneBlocked: maintainerDecisionBlocksClose(none),
246+ nonePacket: buildDecisionPacketFromReport(none),
247+ requiredBlocked: maintainerDecisionBlocksClose(required),
248+ requiredPacket: buildDecisionPacketFromReport(required, {
249+ generatedAt: '2026-08-30T00:00:00.000Z',
250+ reportPath: 'records/openclaw-clawsweeper/items/321.md'
251+ })
252+ }));
253+ ` ,
212254 ) ;
213- const decisions = run ( `decisions-${ name } ` , [ probe ] ) ;
255+ const decisions = run ( `decisions-${ name } ` , [
256+ probe ,
257+ join ( root , "dist/decision-packets.js" ) ,
258+ reportPath ,
259+ requiredPath ,
260+ ] ) ;
214261 equal ( decisions . status , 0 , `${ name } : decision export invocation` ) ;
215262 const result = JSON . parse ( decisions . stdout ) ;
216263 equal ( result . noneBlocked , poisoned , `${ name } : no invented maintainer blocker` ) ;
@@ -261,9 +308,21 @@ equal(existsSync(join(proofRoot, "jobs")), false, "competing record writes no jo
261308const competingProbe = join ( proofRoot , "competing-decisions.mjs" ) ;
262309writeFileSync (
263310 competingProbe ,
264- `import { readFileSync } from 'node:fs';\nimport { maintainerDecisionBlocksClose, buildDecisionPacketFromReport } from ${ JSON . stringify ( pathToFileURL ( join ( root , "dist/decision-packets.js" ) ) . href ) } ;\nconst markdown = readFileSync(${ JSON . stringify ( competingPath ) } , 'utf8');\nconsole.log(JSON.stringify({ blocked: maintainerDecisionBlocksClose(markdown), packet: buildDecisionPacketFromReport(markdown) }));\n` ,
311+ `import { readFileSync } from 'node:fs';
312+ import { pathToFileURL } from 'node:url';
313+ const { maintainerDecisionBlocksClose, buildDecisionPacketFromReport } = await import(pathToFileURL(process.argv[2]).href);
314+ const markdown = readFileSync(process.argv[3], 'utf8');
315+ console.log(JSON.stringify({
316+ blocked: maintainerDecisionBlocksClose(markdown),
317+ packet: buildDecisionPacketFromReport(markdown)
318+ }));
319+ ` ,
265320) ;
266- const competingDecisions = run ( "decisions-competing-comment-list" , [ competingProbe ] ) ;
321+ const competingDecisions = run ( "decisions-competing-comment-list" , [
322+ competingProbe ,
323+ join ( root , "dist/decision-packets.js" ) ,
324+ competingPath ,
325+ ] ) ;
267326equal ( competingDecisions . status , 0 , "competing record decision exports execute" ) ;
268327const competingResult = JSON . parse ( competingDecisions . stdout ) ;
269328equal (
@@ -355,6 +414,8 @@ const sourcePaths = [
355414 "src/repair/create-job.ts" ,
356415 "src/repair/workflow-utils.ts" ,
357416] ;
417+ const tripwireSelfChecks = commands . filter ( ( { name } ) => name . endsWith ( "-self-check" ) ) . length ;
418+ const applicationInvocations = commands . length - tripwireSelfChecks ;
358419const manifest = {
359420 expected,
360421 assertions,
@@ -376,7 +437,9 @@ const manifest = {
376437 commands,
377438 observations,
378439 githubReads : 0 ,
379- tripwireSelfChecks : 1 ,
440+ tripwireSelfChecks,
441+ applicationInvocations,
442+ childEnvironment : childEnv ,
380443 networkAttempts : 0 ,
381444 jobsCreated : 0 ,
382445 environment :
@@ -391,6 +454,8 @@ console.log(
391454 expected,
392455 assertions,
393456 scenarios : observations . length ,
457+ tripwireSelfChecks,
458+ applicationInvocations,
394459 githubReads : 0 ,
395460 jobsCreated : 0 ,
396461 manifest : join ( proofRoot , "manifest.json" ) ,
0 commit comments