You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Harden runtime system path policy handling by adding shared system path utilities, tightening exec/runtime evaluation for protected path writes, and extending action/runtime cloud test coverage.
high — src/utils/system-paths.ts / src/runtime/evaluator.ts / src/action/detectors/exec.ts
The new system-path classifier only handles a small set of exact/prefix cases and can be bypassed with common path tricks or alternative path forms. For example, shell commands like rm -rf /etc/.., /etc//passwd, symlinked paths, ./../etc/passwd, or file-tool inputs using relative paths from a sensitive working directory may not classify as protected. This can let destructive or sensitive operations through without block/approval. Fix: resolve and normalize paths against the relevant working directory/root before classification, and reject/approve on canonicalized paths rather than raw strings. Add tests for .., duplicate slashes, relative paths, and symlink-like traversal cases.
medium — src/action/detectors/exec.ts (redirectionFindings, shellCommandSegments, shellTokens)
The shell parsing logic is incomplete and can miss protected-path writes or hidden network commands in realistic shell syntax. It does not fully handle command substitution nesting, here-docs, process substitution, subshells, or redirections with spaces/quoting variations, so dangerous writes such as printf x > "$TARGET" or cmd > /etc/passwd 2>&1-style forms may not be detected consistently. Fix: either use a shell parser or add explicit handling for more shell constructs and redirection forms, with regression tests for quoted variables, command substitution, heredocs, and mixed redirections.
medium — src/utils/system-paths.ts (normalizeSystemPath) normalizeSystemPath strips trailing ),.; and wildcard suffixes from any path string. That can misclassify valid paths (or hide dangerous ones) and cause false negatives/positives, especially for filenames that legitimately end with those characters or for globbed paths where the base directory should still be protected. Fix: remove ad hoc suffix stripping and instead parse path segments more conservatively; if glob support is needed, classify the parent directory while preserving the original path semantics.
low — src/runtime/evaluator.ts (matchesPattern / isRootRmRfCommand)
The special-case root rm -rf / detection appears to depend on exact normalization of the whole command and does not account for shell wrappers like sudo sh -c 'rm -rf /', environment prefixes, or alias/function indirection. That can allow a root-delete policy pattern to be bypassed if any enforcement relies on this matcher. Fix: evaluate the underlying command after stripping common wrappers (sudo, sh -c, bash -c, env assignments) or apply the root-delete check during command analysis on the effective command segment.
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
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.
Summary
Harden runtime system path policy handling by adding shared system path utilities, tightening exec/runtime evaluation for protected path writes, and extending action/runtime cloud test coverage.
Type
Testing
npm run buildpassesnpm testpasses (377 tests)Related Issues
Closes #