Repository navigation
Reject reader options that run programs or write files (T186) - #87
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #58
Sage task T186
Commands that name Sage's logbook no longer pass as plain reads when their options launch a program or write a file. Plain reads, option values and words after
--retain their existing behavior.The hook now checks rg preprocessing, compressed-file search and hostname programs; file magic compilation and external decompression; and diff pagination through pr. It also checks the overlapping state-tool reader exceptions and gh alias-file write checks. Resolved command evidence covers wrappers and function bodies while excluding literal arguments to known shell functions. The existing command-array normalization also applies before these checks.
This follows merged #86. Changes are in
packages/sage-claude/hooks/sage-hook.mjsandscripts/sage-hook.test.mjs; the build regenerates the Claude plugin. The shared command reader and Codex runtime are unchanged. Claude-owned work can rebase onto these localized hook changes.Validation
All test runs put inert ps, pgrep and kill programs first on PATH, unset NODE_TEST_CONTEXT, and use caffeinate. No submitted command strings reach a shell.
The six new behavior groups fail with assertion errors on detached main at
5282918. The copied test file matches the branch. They cover each of the three affected readers, resolved dispatches, state-tool reader exceptions and command arrays.Each failure is ERR_ASSERTION for a missing refusal; none is an infrastructure failure. Existing test assertions are unchanged. Independent code/security and QA reviews are clean on the final source. Review found and fixed a known-function false refusal and a command-array bypass before publication. Final independent checks include 60 option cases, 6 function ownership cases, 106 input cases, 32 array cases and 8 extra function controls.
GitHub CI passed on
0779831f0d0006fbd0d0301a3e347cf712c46367. The PR is ready for owner review and merge.Reader audit
Primary source references: file option table, GNU diffutils 3.12 source archive, GNU coreutils snapshot, GNU grep 3.12 source archive, and Apple grep source.
Option parsing preserves required values, attached values, short clusters, case and
--. file and diff support long-option abbreviations. The check conservatively treats an observed launch/write option as active; it does not simulate later cancellation flags or input-dependent execution.Limits and seen, not fixed
No test command payload, preprocessor, decompressor or pager ran. Tests send text to the hook. This is a command-policy change, not an operating-system sandbox or a live Codex lifecycle test.
The audit does not certify custom binaries, future versions, all library internals, configured shell hooks or special-device inputs. file --preserve-date restores access-time metadata; GNU tail --pid probes process existence; libxo can load an in-process encoder; zsh directory changes can call configured hooks. These are distinct from this issue's launch/separate-output option changes.
The owner reviews and merges this PR. No product decision is pending.