fix(permission): apply read filename deny rules consistently#16385
fix(permission): apply read filename deny rules consistently#16385SergioChan wants to merge 2 commits intoanomalyco:devfrom
Conversation
|
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
Please edit this PR description to address the above within 2 hours, or it will be automatically closed. If you believe this was flagged incorrectly, please let a maintainer know. |
|
Follow-up on issue-compliance check: I can’t run Bun-based local tests in this environment because is not installed ().\n\nWhat I did verify:\n- Scope is minimal and issue-linked ()\n- Change is limited to permission filename deny-rule handling\n- No unrelated files were modified\n\nIf maintainers want, I can also push a small CI-only validation note in the PR body format they prefer. |
|
Correction (previous comment had CLI quoting issues): I can’t run Bun-based local tests in this environment because What I did verify:
If maintainers prefer a different PR-template handling for constrained environments, I can adjust the PR body accordingly. |
|
This pull request has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window. Feel free to open a new pull request that follows our guidelines. |
Issue for this PR
Closes #16331
Type of change
What does this PR do?
readpermission checks were evaluating absolute paths, while typical deny rules for sensitive files are configured as relative filename patterns (for exampleappsettings.json,appsettings.*.json).This caused a mismatch where
.env*rules still matched but exact filename rules likeappsettings.jsoncould be bypassed.This PR aligns
readwith other file tools by evaluating the path relative to the project worktree before permission matching.It also extends
readpermission tests to coverappsettings.jsonandappsettings.Development.jsonas denied/ask-protected cases.How did you verify your code works?
I added targeted test coverage in
packages/opencode/test/tool/read.test.tsforappsettings.jsonpatterns.I could not run Bun tests in this environment because
bunis not installed (bun: command not found).Screenshots / recordings
N/A (non-UI change)
Checklist