Skip to content

test: capture env var prefix permission bypass (#16075)#16086

Open
fazzledev wants to merge 1 commit intoanomalyco:devfrom
fazzledev:fix/env-var-permission-bypass
Open

test: capture env var prefix permission bypass (#16075)#16086
fazzledev wants to merge 1 commit intoanomalyco:devfrom
fazzledev:fix/env-var-permission-bypass

Conversation

@fazzledev
Copy link

@fazzledev fazzledev commented Mar 5, 2026

Issue for this PR

Fixes #16075

Note: This PR does not fix the bug — it only adds a test case capturing the current (buggy) behavior. The fix requires a design decision on how to strip variable_assignment AST nodes from commandText without losing redirect info. See the issue for options.

Type of change

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

What does this PR do?

Adds a test case that captures the env var prefix permission bypass bug. Commands like CI=true git commit produce a permission pattern of "CI=true git commit -m \"test\"" instead of "git commit -m \"test\"", so a rule like "git *": "ask" won't match and the command runs without a dialog.

The test currently asserts the buggy behavior with a TODO to flip the assertions once the fix lands.

How did you verify your code works?

Ran bun test test/tool/bash.test.ts test/permission/arity.test.ts test/permission/next.test.ts — 84 pass, 0 fail.

Screenshots / recordings

N/A — no UI change.

Checklist

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

@github-actions github-actions bot added needs:compliance This means the issue will auto-close after 2 hours. needs:issue and removed needs:compliance This means the issue will auto-close after 2 hours. labels Mar 5, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 5, 2026

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 5, 2026

Thanks for updating your PR! It now meets our contributing guidelines. 👍

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.

[Bug]: Inline env var prefix (e.g. CI=true git commit) bypasses bash permission rules

1 participant