Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion readonly-unix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ rules:
- allow: 'file *'
- allow: 'du *'
- allow: 'df *'
- allow: 'find !-delete|-fprint|-fprint0|-fprintf|-fls *'
- allow: 'find !-delete|-exec|-execdir|-ok|-okdir|-fprint|-fprint0|-fprintf|-fls *'
Comment thread
fohte marked this conversation as resolved.
- allow: 'fd *'
- allow: 'basename *'
- allow: 'dirname *'
Expand Down
20 changes: 18 additions & 2 deletions tests/test-cases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,22 @@ tests:
expected: ask
config: readonly-unix.yml
description: 'xxd -r reverts hex dump to binary, excluded by negation'
- command: 'find . -name "*.log" -exec rm {} \;'
expected: ask
config: readonly-unix.yml
description: 'find -exec can run arbitrary commands, excluded by negation'
- command: 'find . -name "*.log" -execdir rm {} \;'
expected: ask
config: readonly-unix.yml
description: 'find -execdir can run arbitrary commands, excluded by negation'
- command: 'find . -name "*.log" -ok rm {} \;'
expected: ask
config: readonly-unix.yml
description: 'find -ok can run arbitrary commands, excluded by negation'
- command: 'find . -name "*.log" -okdir rm {} \;'
expected: ask
config: readonly-unix.yml
description: 'find -okdir can run arbitrary commands, excluded by negation'

# ── readonly-unix.yml: commands not in allow list ──
- command: 'rm -rf /tmp/test'
Expand Down Expand Up @@ -309,9 +325,9 @@ tests:
config: base.yml
description: 'cat inside find -exec is allowed by readonly-unix.yml'
- command: 'find . -name "*.log" -exec rm {} \;'
expected: allow
expected: ask
config: base.yml
description: 'KNOWN ISSUE: find -exec rm should be ask but find pattern matches first'
description: 'find -exec rm is excluded by negation in find pattern'
- command: 'env FOO=bar cat /etc/hosts'
expected: allow
config: base.yml
Expand Down
Loading