@@ -184,10 +184,13 @@ function requiredReviewedFindingsForPackage(
184184 return [ ...commonFindings , ...sourceLayout ] ;
185185}
186186
187- function isReviewedPublishableCriticalFinding ( key : string ) : boolean {
187+ function isReviewedPublishableCriticalFinding ( key : string , evidence : string ) : boolean {
188+ const sourceContract = OPTIONAL_REVIEWED_PUBLISHABLE_SOURCE_CRITICAL_FINDING_CONTRACTS . get ( key ) ;
189+ if ( sourceContract ) {
190+ return evidence === sourceContract . evidence ;
191+ }
188192 return (
189193 REQUIRED_REVIEWED_PUBLISHABLE_CRITICAL_FINDING_COUNTS . has ( key ) ||
190- OPTIONAL_REVIEWED_PUBLISHABLE_SOURCE_CRITICAL_FINDING_CONTRACTS . has ( key ) ||
191194 REVIEWED_CODEX_SOURCE_CRITICAL_FINDING_COUNTS . has ( key ) ||
192195 OPTIONAL_REVIEWED_PUBLISHABLE_DIST_CRITICAL_FINDING_COUNTS . has ( key )
193196 ) ;
@@ -369,7 +372,7 @@ async function scanPublishablePluginPackage(plugin: PublishablePluginPackage): P
369372 }
370373 const packedPath = normalizePackedFindingPath ( toRepoPath ( relative ( stageDir , finding . file ) ) ) ;
371374 const key = `${ plugin . packageName } :${ finding . ruleId } :${ packedPath } ` ;
372- if ( isReviewedPublishableCriticalFinding ( key ) ) {
375+ if ( isReviewedPublishableCriticalFinding ( key , finding . evidence ) ) {
373376 reviewedCriticalFindings . push ( key ) ;
374377 continue ;
375378 }
@@ -479,12 +482,30 @@ describe("publishable plugin npm package install security scan", () => {
479482 count : 1 ,
480483 evidence : "const child = spawn(invocation.command, invocation.argv, {" ,
481484 } ) ;
482- expect ( isReviewedPublishableCriticalFinding ( `${ openCodeFinding } .relocated` ) ) . toBe ( false ) ;
485+ expect (
486+ isReviewedPublishableCriticalFinding (
487+ openCodeFinding ,
488+ "const child = spawn(invocation.command, invocation.argv, {" ,
489+ ) ,
490+ ) . toBe ( true ) ;
491+ expect (
492+ isReviewedPublishableCriticalFinding (
493+ openCodeFinding ,
494+ "const child = spawn(other.command, other.argv, {" ,
495+ ) ,
496+ ) . toBe ( false ) ;
497+ expect (
498+ isReviewedPublishableCriticalFinding (
499+ `${ openCodeFinding } .relocated` ,
500+ "const child = spawn(invocation.command, invocation.argv, {" ,
501+ ) ,
502+ ) . toBe ( false ) ;
483503 } ) ;
484504
485- it ( "accepts only one occurrence of an optional reviewed source boundary " , ( ) => {
505+ it ( "rejects a decoy contract string paired with a different dangerous spawn " , ( ) => {
486506 const packageDir = mkdtempSync ( join ( tmpdir ( ) , "openclaw-reviewed-source-" ) ) ;
487507 const packedPath = "session-catalog.ts" ;
508+ const finding = "@openclaw/opencode-provider:dangerous-exec:session-catalog.ts" ;
488509 const evidence = "const child = spawn(invocation.command, invocation.argv, {" ;
489510 try {
490511 fs . writeFileSync ( join ( packageDir , packedPath ) , "export {};\n" ) ;
@@ -496,14 +517,24 @@ describe("publishable plugin npm package install security scan", () => {
496517 ) ,
497518 ) . toEqual ( [ ] ) ;
498519
499- fs . writeFileSync ( join ( packageDir , packedPath ) , `${ evidence } \n` ) ;
520+ fs . writeFileSync (
521+ join ( packageDir , packedPath ) ,
522+ `const reviewedBoundaryDecoy = ${ JSON . stringify ( evidence ) } ;\n` +
523+ "const child = spawn(other.command, other.argv, {\n" ,
524+ ) ;
500525 expect (
501526 expectedReviewedSourceFindingsForPackedPath (
502527 packageDir ,
503528 "@openclaw/opencode-provider" ,
504529 packedPath ,
505530 ) ,
506- ) . toEqual ( [ "@openclaw/opencode-provider:dangerous-exec:session-catalog.ts" ] ) ;
531+ ) . toEqual ( [ finding ] ) ;
532+ expect (
533+ isReviewedPublishableCriticalFinding (
534+ finding ,
535+ "const child = spawn(other.command, other.argv, {" ,
536+ ) ,
537+ ) . toBe ( false ) ;
507538
508539 fs . writeFileSync ( join ( packageDir , packedPath ) , `${ evidence } \n${ evidence } \n` ) ;
509540 expect ( ( ) =>
0 commit comments