File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed
Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -232,7 +232,7 @@ export namespace PermissionNext {
232232 const result = new Set < string > ( )
233233 for ( const tool of tools ) {
234234 const permission = EDIT_TOOLS . includes ( tool ) ? "edit" : tool
235- const rule = ruleset . findLast ( ( r ) => Wildcard . match ( permission , r . pattern ) )
235+ const rule = ruleset . findLast ( ( r ) => Wildcard . match ( permission , r . permission ) )
236236 if ( ! rule ) continue
237237 if ( rule . pattern === "*" && rule . action === "deny" ) result . add ( tool )
238238 }
Original file line number Diff line number Diff line change @@ -359,17 +359,17 @@ test("disabled - does not disable when action is ask", () => {
359359 expect ( result . size ) . toBe ( 0 )
360360} )
361361
362- test ( "disabled - disables when wildcard deny even with specific allow" , ( ) => {
363- // Tool is disabled because evaluate("bash", "*", ...) returns " deny"
364- // The "echo *" allow rule doesn't match the "*" pattern we're checking
362+ test ( "disabled - does not disable when specific allow after wildcard deny " , ( ) => {
363+ // Tool is NOT disabled because a specific allow after wildcard deny means
364+ // there's at least some usage allowed
365365 const result = PermissionNext . disabled (
366366 [ "bash" ] ,
367367 [
368368 { permission : "bash" , pattern : "*" , action : "deny" } ,
369369 { permission : "bash" , pattern : "echo *" , action : "allow" } ,
370370 ] ,
371371 )
372- expect ( result . has ( "bash" ) ) . toBe ( true )
372+ expect ( result . has ( "bash" ) ) . toBe ( false )
373373} )
374374
375375test ( "disabled - does not disable when wildcard allow after deny" , ( ) => {
You can’t perform that action at this time.
0 commit comments