@@ -23,28 +23,32 @@ type PublishablePluginPackage = {
2323} ;
2424
2525const execFileAsync = promisify ( execFile ) ;
26- const REQUIRED_REVIEWED_PUBLISHABLE_CRITICAL_FINDINGS = new Set ( [
27- "@openclaw/acpx:dangerous-exec:src/codex-auth-bridge.ts" ,
28- "@openclaw/acpx:dangerous-exec:src/runtime-internals/mcp-proxy.mjs" ,
29- "@openclaw/codex:dangerous-exec:src/app-server/sandbox-exec-server/http.ts" ,
30- "@openclaw/codex:dangerous-exec:src/app-server/sandbox-exec-server/processes.ts" ,
31- "@openclaw/codex:dangerous-exec:src/app-server/transport-stdio.ts" ,
32- "@openclaw/codex:dangerous-exec:src/node-cli-sessions.ts" ,
33- "@openclaw/discord:dangerous-exec:src/voice/audio.ts" ,
34- "@openclaw/google-meet:dangerous-exec:src/node-host.ts" ,
35- "@openclaw/mxc-sandbox:dangerous-exec:src/readiness.ts" ,
36- "@openclaw/raft:dangerous-exec:src/gateway.ts" ,
37- "@openclaw/signal:dangerous-exec:src/daemon.ts" ,
38- "@openclaw/voice-call:dangerous-exec:src/tunnel.ts" ,
26+ const REQUIRED_REVIEWED_PUBLISHABLE_CRITICAL_FINDING_COUNTS = new Map < string , number > ( [
27+ [ "@openclaw/acpx:dangerous-exec:src/codex-auth-bridge.ts" , 1 ] ,
28+ [ "@openclaw/acpx:dangerous-exec:src/runtime-internals/mcp-proxy.mjs" , 1 ] ,
29+ [ "@openclaw/codex:dangerous-exec:src/app-server/sandbox-exec-server/http.ts" , 1 ] ,
30+ [ "@openclaw/codex:dangerous-exec:src/app-server/sandbox-exec-server/processes.ts" , 1 ] ,
31+ [ "@openclaw/codex:dangerous-exec:src/app-server/transport-stdio.ts" , 1 ] ,
32+ [ "@openclaw/codex:dangerous-exec:src/node-cli-sessions.ts" , 1 ] ,
33+ [ "@openclaw/discord:dangerous-exec:src/voice/audio.ts" , 1 ] ,
34+ [ "@openclaw/google-meet:dangerous-exec:src/node-host.ts" , 1 ] ,
35+ [ "@openclaw/mxc-sandbox:dangerous-exec:src/readiness.ts" , 2 ] ,
36+ [ "@openclaw/raft:dangerous-exec:src/gateway.ts" , 1 ] ,
37+ [ "@openclaw/signal:dangerous-exec:src/daemon.ts" , 1 ] ,
38+ [ "@openclaw/voice-call:dangerous-exec:src/tunnel.ts" , 1 ] ,
3939] ) ;
4040
41- const OPTIONAL_REVIEWED_PUBLISHABLE_DIST_CRITICAL_FINDINGS = new Set ( [
42- "@openclaw/acpx:dangerous-exec:dist/mcp-proxy.mjs" ,
43- "@openclaw/acpx:dangerous-exec:dist/service-<hash>.js" ,
44- "@openclaw/codex:dangerous-exec:dist/client-<hash>.js" ,
45- "@openclaw/google-meet:dangerous-exec:dist/index.js" ,
46- "@openclaw/slack:dynamic-code-execution:dist/outbound-payload.test-harness-<hash>.js" ,
47- "@openclaw/voice-call:dangerous-exec:dist/runtime-entry-<hash>.js" ,
41+ // Generated chunks can contain multiple reviewed execution sites. Counts are
42+ // part of the contract so an added or missing site fails the release scan.
43+ const OPTIONAL_REVIEWED_PUBLISHABLE_DIST_CRITICAL_FINDING_COUNTS = new Map < string , number > ( [
44+ [ "@openclaw/acpx:dangerous-exec:dist/mcp-proxy.mjs" , 1 ] ,
45+ [ "@openclaw/acpx:dangerous-exec:dist/service-<hash>.js" , 1 ] ,
46+ [ "@openclaw/codex:dangerous-exec:dist/run-attempt-<hash>.js" , 2 ] ,
47+ [ "@openclaw/codex:dangerous-exec:dist/session-catalog-<hash>.js" , 1 ] ,
48+ [ "@openclaw/codex:dangerous-exec:dist/transport-stdio-<hash>.js" , 1 ] ,
49+ [ "@openclaw/google-meet:dangerous-exec:dist/index.js" , 1 ] ,
50+ [ "@openclaw/slack:dynamic-code-execution:dist/outbound-payload.test-harness-<hash>.js" , 1 ] ,
51+ [ "@openclaw/voice-call:dangerous-exec:dist/runtime-entry-<hash>.js" , 1 ] ,
4852] ) ;
4953
5054function parseNpmPackFiles ( raw : string , packageName : string ) : string [ ] {
@@ -87,7 +91,14 @@ function isScannerWalkedPackedPath(packedPath: string): boolean {
8791}
8892
8993function normalizePackedFindingPath ( packedPath : string ) : string {
90- for ( const prefix of [ "client" , "outbound-payload.test-harness" , "runtime-entry" , "service" ] ) {
94+ for ( const prefix of [
95+ "outbound-payload.test-harness" ,
96+ "run-attempt" ,
97+ "runtime-entry" ,
98+ "service" ,
99+ "session-catalog" ,
100+ "transport-stdio" ,
101+ ] ) {
91102 if ( packedPath . startsWith ( `dist/${ prefix } -` ) && packedPath . endsWith ( ".js" ) ) {
92103 return `dist/${ prefix } -<hash>.js` ;
93104 }
@@ -100,8 +111,12 @@ function expectedOptionalReviewedFindingsForPackedPath(
100111 packedPath : string ,
101112) : string [ ] {
102113 const normalizedPath = normalizePackedFindingPath ( packedPath ) ;
103- return [ ...OPTIONAL_REVIEWED_PUBLISHABLE_DIST_CRITICAL_FINDINGS ] . filter (
104- ( key ) => key . startsWith ( `${ packageName } :` ) && key . endsWith ( `:${ normalizedPath } ` ) ,
114+ const keyPrefix = `${ packageName } :` ;
115+ const keySuffix = `:${ normalizedPath } ` ;
116+ return [ ...OPTIONAL_REVIEWED_PUBLISHABLE_DIST_CRITICAL_FINDING_COUNTS ] . flatMap ( ( [ key , count ] ) =>
117+ key . startsWith ( keyPrefix ) && key . endsWith ( keySuffix )
118+ ? Array . from ( { length : count } , ( ) => key )
119+ : [ ] ,
105120 ) ;
106121}
107122
@@ -240,8 +255,8 @@ async function scanPublishablePluginPackage(plugin: PublishablePluginPackage): P
240255 const packedPath = normalizePackedFindingPath ( toRepoPath ( relative ( stageDir , finding . file ) ) ) ;
241256 const key = `${ plugin . packageName } :${ finding . ruleId } :${ packedPath } ` ;
242257 if (
243- REQUIRED_REVIEWED_PUBLISHABLE_CRITICAL_FINDINGS . has ( key ) ||
244- OPTIONAL_REVIEWED_PUBLISHABLE_DIST_CRITICAL_FINDINGS . has ( key )
258+ REQUIRED_REVIEWED_PUBLISHABLE_CRITICAL_FINDING_COUNTS . has ( key ) ||
259+ OPTIONAL_REVIEWED_PUBLISHABLE_DIST_CRITICAL_FINDING_COUNTS . has ( key )
245260 ) {
246261 reviewedCriticalFindings . push ( key ) ;
247262 continue ;
@@ -281,7 +296,7 @@ describe("publishable plugin npm package install security scan", () => {
281296 ) ;
282297 const missingPackages = [
283298 ...new Set (
284- [ ...REQUIRED_REVIEWED_PUBLISHABLE_CRITICAL_FINDINGS ] . map ( ( key ) =>
299+ [ ...REQUIRED_REVIEWED_PUBLISHABLE_CRITICAL_FINDING_COUNTS . keys ( ) ] . map ( ( key ) =>
285300 key . slice ( 0 , key . indexOf ( ":" ) ) ,
286301 ) ,
287302 ) ,
@@ -301,25 +316,52 @@ describe("publishable plugin npm package install security scan", () => {
301316 } ) ;
302317 } ) ;
303318
319+ it ( "does not review unknown Codex dist chunk names" , ( ) => {
320+ const packedPath = "dist/future-exec-unknown.js" ;
321+
322+ expect ( normalizePackedFindingPath ( packedPath ) ) . toBe ( packedPath ) ;
323+ expect ( expectedOptionalReviewedFindingsForPackedPath ( "@openclaw/codex" , packedPath ) ) . toEqual (
324+ [ ] ,
325+ ) ;
326+ } ) ;
327+
328+ it ( "requires exact occurrence counts for reviewed Codex dist chunks" , ( ) => {
329+ const runAttemptKey = "@openclaw/codex:dangerous-exec:dist/run-attempt-<hash>.js" ;
330+
331+ expect (
332+ expectedOptionalReviewedFindingsForPackedPath (
333+ "@openclaw/codex" ,
334+ "dist/run-attempt-current.js" ,
335+ ) ,
336+ ) . toEqual ( [ runAttemptKey , runAttemptKey ] ) ;
337+ expect (
338+ expectedOptionalReviewedFindingsForPackedPath (
339+ "@openclaw/codex" ,
340+ "dist/session-catalog-current.js" ,
341+ ) ,
342+ ) . toEqual ( [ "@openclaw/codex:dangerous-exec:dist/session-catalog-<hash>.js" ] ) ;
343+ expect (
344+ expectedOptionalReviewedFindingsForPackedPath ( "@openclaw/codex" , "dist/client-retired.js" ) ,
345+ ) . toEqual ( [ ] ) ;
346+ } ) ;
347+
304348 test . concurrent . each ( publishablePluginPackages ) (
305349 "keeps $packageName files clear of unexpected critical hits" ,
306350 async ( plugin ) => {
307351 const result = scanResultsByPackageName . get ( plugin . packageName ) ;
308352 if ( ! result ) {
309353 throw new Error ( `Missing package scan result for ${ plugin . packageName } ` ) ;
310354 }
311- const expectedReviewedCriticalFindings = new Set (
312- [ ...REQUIRED_REVIEWED_PUBLISHABLE_CRITICAL_FINDINGS ] . filter ( ( key ) =>
313- key . startsWith ( `${ plugin . packageName } :` ) ,
355+ const expectedReviewedCriticalFindings = [
356+ ... [ ...REQUIRED_REVIEWED_PUBLISHABLE_CRITICAL_FINDING_COUNTS ] . flatMap ( ( [ key , count ] ) =>
357+ key . startsWith ( `${ plugin . packageName } :` ) ? Array . from ( { length : count } , ( ) => key ) : [ ] ,
314358 ) ,
315- ) ;
316- for ( const key of result . expectedReviewedCriticalFindings ) {
317- expectedReviewedCriticalFindings . add ( key ) ;
318- }
359+ ...result . expectedReviewedCriticalFindings ,
360+ ] ;
319361
320362 expect ( result . unexpectedCriticalFindings . toSorted ( ) ) . toStrictEqual ( [ ] ) ;
321363 expect ( result . reviewedCriticalFindings . toSorted ( ) ) . toEqual (
322- [ ... expectedReviewedCriticalFindings ] . toSorted ( ) ,
364+ expectedReviewedCriticalFindings . toSorted ( ) ,
323365 ) ;
324366 } ,
325367 ) ;
0 commit comments