Skip to content

feat(rule): enforce compound POSIX commands - #46

Open
ronheichman wants to merge 6 commits into
perplexityai:mainfrom
ronheichman:psi/enforce-compound-shell-commands
Open

ronheichman wants to merge 6 commits into
perplexityai:mainfrom
ronheichman:psi/enforce-compound-shell-commands

Conversation

@ronheichman

@ronheichman ronheichman commented Aug 28, 2026

Copy link
Copy Markdown

Summary

  • enforce already-matching shell rules against eligible static commands inside compound POSIX input
  • keep detection on the complete command list and preserve the rule's original CEL result
  • keep same-script function bodies, interpreter scripts, unsafe pipelines or enclosing redirects, malformed input, and compound PowerShell/CMD input detection-only
  • apply the same eligibility checks to sequence rules and invalidate persisted verdict masks from the previous behavior

Detection runs first against the complete event. Candidate evaluation can only suppress enforcement when no independently safe command satisfies the same rule; it cannot create a finding or turn a non-match into a deny. POSIX branch and loop commands count as requested code without attempting to predict runtime control flow. Function bodies remain detection-only because shell state can replace or remove a definition before it is called.

Candidate programs and projections are built only for enabled enforcement rules that reference shell_commands, keeping monitor-only startup and evaluation close to the existing cost.

There are no schema, wire-format, or dependency changes.

Why

An enforce-enabled rule can detect cat .env inside echo ready; cat .env, but the existing event-wide safety check prevents a deny. Independent candidate eligibility closes that gap without changing detection semantics or trusting inferred function state.

Verification

  • go test ./...
  • go test -race ./...
  • go vet ./...
  • golangci-lint v2.12.2 run
  • golangci-lint v2.12.2 fmt --diff
  • govulncheck v1.6.0 ./...
  • go generate ./rules with no generated diff
  • go mod tidy with no module diff
  • FuzzAnalyzeShellCommands for 30 seconds
  • CGO-free Darwin, Linux amd64, and Windows amd64 builds

@ronheichman
ronheichman marked this pull request as ready for review August 28, 2026 20:13
codex and others added 3 commits September 8, 2026 11:43
Remove expanded interpreter input analysis, preserve detection-only script handling, and cover pipeline grouping and native hook regressions.

Built with Codex.
@adel-pplx adel-pplx changed the title Enforce rules across compound POSIX commands feat(rule): enforce compound POSIX commands Sep 15, 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.

3 participants