GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(core): match file permission rules without case on macOS by knp-sap · Pull Request #64626 · anomalyco/opencode

Conversation

@knp-sap

@knp-sap knp-sap commented Nov 18, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Issue for this PR

Closes #64624

Type of change

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

What does this PR do?

Wildcard.match ignores case only on Windows. macOS volumes ignore case by default, so .OPENCODE/plugins/x.ts is the same file as .opencode/plugins/x.ts, but it did not match a .opencode/* rule.

Permission.evaluate and the organization tool.use policy hook now match the resources of the file actions (read, edit, and external_directory) without case on macOS. The list of file actions lives in Permission.pathActions, which the agent config also uses. Windows is unchanged. On macOS, shell commands and other resources still match with case. On a case-sensitive APFS volume, file rules now also match other spellings; that makes ask and deny rules stricter, but allow rules broader too.

No feature flag: this is a bug fix.

How did you verify your code works?

  • New tests in packages/core/test/permission.test.ts and packages/core/test/config/policy.test.ts. They fail on macOS without the fix; the new Wildcard.match option is checked on every platform.
  • On macOS, in packages/core: bun run script/test.ts (7562 pass, 0 fail), bun typecheck, and bun run typecheck:tsc.

Screenshots / recordings

Not a UI change.

Checklist

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@knp-sap
fix(core): match file permission rules without case on macOS
ea01a43
macOS volumes ignore case by default, so an edit to .OPENCODE/plugins/x.ts writes into the directory that config discovery loads as .opencode, yet escaped a .opencode/* rule. Match read, edit, and external_directory resources without case on macOS, as Windows already does for every rule; commands and other resources keep their case.
opencodejr[bot]
opencodejr Bot reviewed Nov 18, 2026
View reviewed changes

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

The fix works. With process.platform set to darwin, Permission.evaluate on the base allowed an edit to .OPENCODE/plugins/x.ts and a read of secrets.ENV under .opencode/* ask and *.env deny rules. With this change they are ask and deny, and shell commands still match with case. The permission tests pass and typecheck:tsc is clean. This was simulated on Linux, not run on a real Mac.

Public API: unchanged. Wildcard.match gains an optional third argument, which is internal and backwards compatible.

One gap worth closing in this pull request: organization tool.use deny policies are checked in packages/core/src/config/plugin/policy.ts through a separate Wildcard.match(${event.action}:${resource}, policy.resource) call. That call still matches with case on macOS, so a managed policy like read:*.env deny can still be bypassed with secrets.ENV, the same problem as #64624 in the layer organizations rely on most. It would be worth applying the same case rule there, ideally from one shared helper rather than a second copy of the file-action list. That list already exists as pathActions in config/plugin/agent.ts.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread packages/core/src/permission.ts Outdated
export type Error = BlockedError | CorrectedError

// macOS volumes ignore case by default, so `.OPENCODE/x` opens `.opencode/x`; rules for file paths must match it too.
const fileActions = new Set(["read", "edit", "external_directory"])

@opencodejr opencodejr Bot Nov 18, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

This list repeats pathActions in config/plugin/agent.ts (external_directory, read, edit). The managed tool.use policy hook in config/plugin/policy.ts also matches <action>:<path> resources with case on macOS, so organization deny policies can still be bypassed by spelling the path in another case. Could the list live in one place and be used by both checks?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@knp-sap knp-sap Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Thanks, done in da78cd8. Permission now exports pathActions and ignoresCase(action), and evaluate, the tool.use hook in config/plugin/policy.ts, and config/plugin/agent.ts all use them, so the list lives in one place. agent.ts still checks it against the tool names.

A new policy test checks that an organization read:*.env deny also blocks secrets.ENV on macOS; it fails without the change. I ran the full core suite on a real Mac.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@opencodejr opencodejr Bot mentioned this pull request Nov 18, 2026
permission: file rules are case-sensitive on macOS, whose default file system is not #64624
Closed
@knp-sap
fix(core): match organization file policies without case on macOS
da78cd8
The tool.use policy hook matched action:path resources with case, so an organization read:*.env deny could still be bypassed on macOS by reading secrets.ENV. Share the file action list and the case rule through Permission, and use them in evaluate, the policy hook, and the agent config.
opencodejr[bot]
opencodejr Bot reviewed Nov 18, 2026
View reviewed changes

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

My earlier point is resolved. The organization tool.use policy hook now matches file actions without case on macOS, and the list of file actions lives only in Permission.pathActions. config/plugin/agent.ts still checks it against the tool names when type-checking. With the platform set to darwin, a read:*.env deny now matches secrets.ENV, and shell policies still match with case. The permission and policy tests pass (146) and typecheck:tsc is clean. This was simulated on Linux, not run on a real Mac.

Public API: unchanged. Permission.pathActions, Permission.ignoresCase and the optional Wildcard.match argument are internal to packages/core.

No further concerns.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@neriousy
refactor(core): inline the path action list in agent config
2250816
opencodejr[bot]
opencodejr Bot reviewed Nov 18, 2026
View reviewed changes

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

The new commit only changes how config/plugin/agent.ts reads Permission.pathActions, which is still type-checked against the tool names, so behavior is unchanged. The agent config, permission and policy tests pass and typecheck:tsc is clean. My earlier point about one shared list and the organization tool.use policies was addressed in da78cd8. Public API: unchanged. No further concerns.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@neriousy
neriousy merged commit 79bd2c6 into anomalyco:dev Nov 18, 2026
10 checks passed

Uh oh!

There was an error while loading. Please reload this page.

vergeal added a commit to vergeal/aicraft that referenced this pull request Nov 22, 2026
@vergeal
fix(core): match file permission rules without case on macOS (anomaly…
4bd7b12
…co#64626)

Adapted from upstream 79bd2c6. File actions (external_directory, read,
edit) ignore case on darwin, matching macOS volumes; commands keep their case.
@BrewTestBot BrewTestBot mentioned this pull request Nov 23, 2026
opencode 2.4.0 Homebrew/homebrew-core#327368
Merged
@amrkmn amrkmn mentioned this pull request Nov 23, 2026
opencode 2.4.0 amrkmn/homebrew-tap#1251
Closed
1 task
@github-actions github-actions Bot mentioned this pull request Nov 23, 2026
feat: opencode release v2.4.0 sprisa/opencode-server#95
Merged
This was referenced Nov 25, 2026
permission: file path rules can be bypassed on macOS by changing the case of the path AltimateAI/altimate-code#1841
Open
fix(permission): port upstream case-insensitive file permission matching on macOS (anomalyco/opencode#64626) AltimateAI/altimate-code#1842
Open
upstream: provider/security fixes not yet ported AltimateAI/altimate-code#1478
Open
@scottames-github-bot scottames-github-bot Bot mentioned this pull request Nov 27, 2026
chore(deps): update ⬆️ mise-packages scottames/dots#1181
Merged
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@opencodejr opencodejr[bot] opencodejr[bot] left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

permission: file rules are case-sensitive on macOS, whose default file system is not

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@knp-sap @neriousy
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.