@@ -1096,7 +1096,7 @@ $0 \\"$1\\"" touch {marker}`,
10961096 { command : "pnpm run build -- node" , executable : "pnpm" } ,
10971097 { command : "pnpm test -- node" , executable : "pnpm" } ,
10981098 { command : "pnpm install" , executable : "pnpm" } ,
1099- { command : "yarn run build -- node " , executable : "yarn" } ,
1099+ { command : "yarn install " , executable : "yarn" } ,
11001100 ] ) (
11011101 "keeps exec-like arguments on known non-exec package-manager subcommands allowlisted: $command" ,
11021102 async ( { command, executable } ) => {
@@ -1152,6 +1152,71 @@ $0 \\"$1\\"" touch {marker}`,
11521152 ) . toBe ( true ) ;
11531153 } ) ;
11541154
1155+ it ( "rejects stale pnpm allow-always entries for cwd implicit exec shorthands" , async ( ) => {
1156+ if ( process . platform === "win32" ) {
1157+ return ;
1158+ }
1159+ const dir = makeTempDir ( ) ;
1160+ const pnpmPath = makeExecutable ( dir , "pnpm" ) ;
1161+ makeExecutable ( dir , "eslint" ) ;
1162+ const env = makePathEnv ( dir ) ;
1163+ const safeBins = resolveSafeBins ( undefined ) ;
1164+
1165+ const result = await evaluateShellAllowlistWithAuthorization ( {
1166+ command : "pnpm -C ./package eslint ." ,
1167+ allowlist : [ { pattern : pnpmPath , source : "allow-always" } ] ,
1168+ safeBins,
1169+ cwd : dir ,
1170+ env,
1171+ platform : process . platform ,
1172+ } ) ;
1173+
1174+ expect ( result . allowlistSatisfied ) . toBe ( false ) ;
1175+ expect ( result . segmentAllowlistEntries ) . toEqual ( [ null ] ) ;
1176+ expect (
1177+ requiresExecApproval ( {
1178+ ask : "on-miss" ,
1179+ security : "allowlist" ,
1180+ analysisOk : result . analysisOk ,
1181+ allowlistSatisfied : result . allowlistSatisfied ,
1182+ } ) ,
1183+ ) . toBe ( true ) ;
1184+ } ) ;
1185+
1186+ it . each ( [ "yarn run eslint ." , "yarn eslint ." ] ) (
1187+ "rejects stale yarn allow-always entries for script or bin fallback: %s" ,
1188+ async ( command ) => {
1189+ if ( process . platform === "win32" ) {
1190+ return ;
1191+ }
1192+ const dir = makeTempDir ( ) ;
1193+ const yarnPath = makeExecutable ( dir , "yarn" ) ;
1194+ makeExecutable ( dir , "eslint" ) ;
1195+ const env = makePathEnv ( dir ) ;
1196+ const safeBins = resolveSafeBins ( undefined ) ;
1197+
1198+ const result = await evaluateShellAllowlistWithAuthorization ( {
1199+ command,
1200+ allowlist : [ { pattern : yarnPath , source : "allow-always" } ] ,
1201+ safeBins,
1202+ cwd : dir ,
1203+ env,
1204+ platform : process . platform ,
1205+ } ) ;
1206+
1207+ expect ( result . allowlistSatisfied ) . toBe ( false ) ;
1208+ expect ( result . segmentAllowlistEntries ) . toEqual ( [ null ] ) ;
1209+ expect (
1210+ requiresExecApproval ( {
1211+ ask : "on-miss" ,
1212+ security : "allowlist" ,
1213+ analysisOk : result . analysisOk ,
1214+ allowlistSatisfied : result . allowlistSatisfied ,
1215+ } ) ,
1216+ ) . toBe ( true ) ;
1217+ } ,
1218+ ) ;
1219+
11551220 it ( "requires bound args for package-manager shell script carriers" , async ( ) => {
11561221 if ( process . platform === "win32" ) {
11571222 return ;
@@ -1267,6 +1332,16 @@ $0 \\"$1\\"" touch {marker}`,
12671332 } ) ;
12681333 expect ( inner . allowlistSatisfied ) . toBe ( true ) ;
12691334
1335+ const pnpmCwdInner = await evaluateShellAllowlistWithAuthorization ( {
1336+ command : "pnpm -C ./package exec -- tsx ./run.ts" ,
1337+ allowlist : [ { pattern : tsxPath , source : "allow-always" } ] ,
1338+ safeBins,
1339+ cwd : dir ,
1340+ env,
1341+ platform : process . platform ,
1342+ } ) ;
1343+ expect ( pnpmCwdInner . allowlistSatisfied ) . toBe ( true ) ;
1344+
12701345 const npmInner = await evaluateShellAllowlistWithAuthorization ( {
12711346 command : "npm --loglevel=silent exec -- tsx ./run.ts" ,
12721347 allowlist : [ { pattern : tsxPath , source : "allow-always" } ] ,
0 commit comments