Skip to content

security: reject shell variable expansion in read-only grants - #566

Open
harneet2512 wants to merge 1 commit into
andrewyng:mainfrom
harneet2512:fix/security-readonly-variable-expansion
Open

security: reject shell variable expansion in read-only grants#566
harneet2512 wants to merge 1 commit into
andrewyng:mainfrom
harneet2512:fix/security-readonly-variable-expansion

Conversation

@harneet2512

@harneet2512 harneet2512 commented Aug 26, 2026

Copy link
Copy Markdown

What changed

Reject unquoted shell variable expansion in the automatic read-only classifier.

Before this change, a granted read-only session accepted commands such as:

cat $env:APPDATA\coworker\secrets.json
cat $HOME/.config/coworker/secrets.json
cat ${HOME}/.config/coworker/secrets.json

The shell expanded the operand after authorization, so an out-of-scope file could be read without another approval. These commands now follow the normal approval path. $ inside single-quoted awk/grep programs remains supported.

This complements #559: that PR hardens command syntax; this change covers shell-expanded operands and filesystem scope.

Tests

Added regression coverage for PowerShell, POSIX, and braced variable expansion, plus quoted shell programs.

101 passed, 1 unrelated integration test deselected

@harneet2512
harneet2512 force-pushed the fix/security-readonly-variable-expansion branch from 77e8ade to 07d948b Compare August 26, 2026 15:01
@harneet2512

Copy link
Copy Markdown
Author

Refreshing the source branch after correcting commit author metadata; reopening immediately.

@harneet2512 harneet2512 reopened this Aug 26, 2026
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