Skip to content

fix(core): authorize Bun Glob scans as reads - #65255

Merged
rekram1-node merged 2 commits into
devfrom
bun-glob-read
Nov 20, 2026
Merged

rekram1-node merged 2 commits into
devfrom
bun-glob-read

Conversation

@rekram1-node

Copy link
Copy Markdown
Member

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

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

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.

  • Code Mode execution tests: 370 pass across 10 runs.
  • Core typecheck passes.
  • Root bun run check: 35/35 tasks pass.

Screenshots / recordings

N/A

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@rekram1-node
rekram1-node enabled auto-merge (squash) November 20, 2026 18:58

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@rekram1-node
rekram1-node merged commit 4122af0 into dev Nov 20, 2026
10 checks passed
@rekram1-node
rekram1-node deleted the bun-glob-read branch November 20, 2026 19:11

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant