Repository navigation
fix(core): authorize Bun Glob scans as reads - #65255
Conversation
There was a problem hiding this comment.
Looks good. Bun.Glob scans now ask read for the resolved listing root, with the same resource and save: ["*"] the file-access layer uses for other reads, and the external-directory approval still runs first. Writing the check inline instead of calling authorizeRead is justified, since that helper doesn't take kind: "directory".
I checked it by running the updated permission test against the base, where it fails (scans ask glob and a glob deny blocks them), and with the PR, where tool-execute.test.ts passes 37/37. tsc -b for core passes.
Public API is unchanged. No concerns.
There was a problem hiding this comment.
The new commit updates the target-environment test to expect read on the listing root instead of glob. That test failed at the previous head and now passes: tool-target-environment.test.ts plus tool-execute.test.ts give 39/39. Source is unchanged and the public API is unchanged. No concerns.
Issue for this PR
Denying the glob tool also blocks Bun.Glob in Code Mode. Bun's filesystem API should use read permission independently of that tool.
Type of change
What does this PR do?
I made Bun.Glob scans ask for read permission on the directory where listing starts. External-directory approval is unchanged, and the glob tool keeps its own permission.
new Bun.Glob("src/**/*.ts").scanSync() - asks glob permission for "src/**/*.ts" + asks read permission for "src"This separation is intentional: denying glob disables the tool, not filesystem reads from Code Mode.
How did you verify your code works?
Updated the existing permission tests to check read on the listing root, successful scanning with glob denied, and rejection with read denied.
bun run check: 35/35 tasks pass.Screenshots / recordings
N/A
Checklist