fix(readonly-unix): exclude arbitrary execution and file write options via negation#10
fix(readonly-unix): exclude arbitrary execution and file write options via negation#10
Conversation
The find pattern used a wildcard `*` that matched any remaining
arguments, allowing `find . -exec rm {} \;` to be allowed despite
being a read-only preset. These four options can execute arbitrary
commands, so they must be excluded via negation to prevent unintended
command execution in readonly-unix.yml (and base.yml which extends it).
Also update the base.yml KNOWN ISSUE test case that is now resolved,
and add E2E tests for all four negated options.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a critical security vulnerability in the Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
… commands Several commands in readonly-unix.yml allowed arbitrary command execution or file writes through options that the wildcard `*` matched without restriction. Add negation patterns for: - less: -o/-O/--log-file/--LOG-FILE (file writes) - fd: -x/--exec/-X/--exec-batch (command execution) - rg: --pre (command execution via preprocessor) - ag/ack: --pager (command execution) - sort: --compress-program (command execution) - tar: --use-compress-program/--checkpoint-action (command execution) Also add a comment documenting ldd's known binary execution risk. Co-Authored-By: Claude Opus 4.6 <[email protected]>
-exec family options to find pattern negationbat's --pager and man's -P/--pager options allow arbitrary command execution by specifying a custom pager program. GNU bc has a system() built-in function and GNU dc has a ! command, both allowing arbitrary command execution via language-internal features that cannot be controlled through CLI argument matching (same limitation as awk/gawk). Co-Authored-By: Claude Opus 4.6 <[email protected]>
Remove comments explaining why awk/gawk and bc/dc are not in the allow list — absent entries do not need documentation. Remove ldd because it may execute the target binary to resolve dependencies on Linux, which violates the read-only principle. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Why
readonly-unix.ymldid not exclude options that allow arbitrary command execution or file writesfind:-exec,-execdir,-ok,-okdir(arbitrary command execution)fd:-x/--exec,-X/--exec-batch(arbitrary command execution)rg:--pre(arbitrary command execution via preprocessor)ag/ack:--pager(arbitrary command execution)bat:--pager(arbitrary command execution)man:-P/--pager(arbitrary command execution)sort:--compress-program(arbitrary command execution)tar:--use-compress-program,--checkpoint-action(arbitrary command execution)less:-o/-O/--log-file/--LOG-FILE(file writes)bc,dc, andlddwere in the allow list despite having inherent command execution risks that cannot be controlled through CLI argument matchingWhat
bc,dc, andlddfrom the allow list