Constraint: Task 5 is reporting/map ownership only; worker-1 owns implementation changes and shared security/path tests.\nRejected: Editing runtime enforcement failures from this lane | shared implementation/test ownership belongs to other workers unless re-scoped.\nConfidence: high\nScope-risk: narrow\nDirective: Keep this artifact synchronized with exact verification output before leader aggregation.\nTested: python3 scripts/validate_cc2_board.py --board .omx/cc2/board.json; python3 .omx/cc2/validate_issue_parity_intake.py .omx/cc2/issue-parity-intake.json; scripts/fmt.sh --check; cargo check --workspace; targeted runtime permission/path tests; mock parity harness.\nNot-tested: Full clippy and cargo test --workspace are not green due pre-existing/shared runtime/CLI failures documented in the artifact.
12 KiB
G002 alpha security map and verification plan
Generated by worker-4 for OMX team task 5 on 2026-05-14.
Scope and coordination
- Active goal context:
G002-alpha-security/ Stream 6 day-one security and permissions gate. - Worker ownership:
worker-1owns minimal implementation changes for workspace/path enforcement.worker-4owns this repository map, integration verification plan, changed-file/commit report, and exact verification evidence. - Boundary: this report does not mutate
.omx/ultragoaland does not edit shared security/path tests. - Parallel probe status: three native subagents were spawned for repository map, test probe, and change-slice probe, but all failed before returning findings with
429 Too Many Requests; local mapping below is based on direct repository inspection.
Current permission and path enforcement map
Runtime permission policy and enforcer
-
rust/crates/runtime/src/permissions.rs- Owns the
PermissionModeordering andPermissionPolicyauthorization contract. - Existing tests cover read-only denial, workspace-write escalation, prompt approvals/denials, danger-full-access allowance, override recording, and required-mode reporting.
- Integration risk: any new dynamic file/path rule must preserve the existing
PermissionPolicy::authorizesemantics so prompt/override audit events remain stable.
- Owns the
-
rust/crates/runtime/src/permission_enforcer.rsPermissionEnforcer::check,check_with_required_mode,check_file_write, andcheck_bashconvert policy outcomes into structuredEnforcementResultpayloads.check_file_writecurrently has the direct write gate for workspace-write mode.is_within_workspaceis a string-prefix boundary check after simple relative-path joining; it does not canonicalize symlinks,.., Windows drive prefixes, or case variants.- Existing tests cover read-only denial, workspace-write inside/outside paths, trailing slashes, root equality, bash read-only heuristics, prompt-mode denial payloads, and structured denied fields.
File tool path handling
rust/crates/runtime/src/file_ops.rsread_file,write_file, andedit_filenormalize paths before filesystem operations but do not themselves require a workspace root.read_file_in_workspace,write_file_in_workspace, andedit_file_in_workspaceexist as boundary-enforced wrappers.validate_workspace_boundarycanonicalizes through the caller-provided resolved path and checksstarts_with(workspace_root).is_symlink_escapedetects direct symlink escapes by comparing canonical target to canonical workspace root.- Search tools (
glob_search,grep_search) derive walk roots and prune heavy directories, but they are separate from the write enforcement path. - Existing tests cover oversized/binary reads, workspace-boundary read rejection, symlink escape detection, glob brace expansion, ignored directories, and grep/glob behavior.
Bash command validation
rust/crates/runtime/src/bash_validation.rsvalidate_commandruns mode validation, sed validation, destructive warning checks, then path validation.validate_read_onlyblocks write-like commands, state-modifying commands, write redirects, and mutating git subcommands in read-only mode.validate_modewarns when workspace-write commands appear to target hard-coded system paths.validate_pathswarns for../,~/, and$HOMEreferences; it is intentionally heuristic and does not resolve shell expansion or canonical targets.- Existing tests cover read-only blockers, destructive warnings, sed in-place blocking, path traversal/home warnings, command classification, and full pipeline allow/block/warn outcomes.
Sandbox and diagnostics surfaces
-
rust/crates/runtime/src/sandbox.rs- Owns container/sandbox status detection and workspace-only sandbox command construction.
- Relevant for day-one security because sandbox status must not overstate filesystem isolation.
-
rust/crates/rusty-claude-cli/src/main.rs- Owns CLI permission-mode parsing, direct JSON/text diagnostic output,
/permissions,/status,/doctor, and command dispatch paths. - Existing CLI integration tests under
rust/crates/rusty-claude-cli/tests/cover permission prompt scenarios and output-format contracts.
- Owns CLI permission-mode parsing, direct JSON/text diagnostic output,
-
rust/crates/rusty-claude-cli/tests/mock_parity_harness.rs- End-to-end harness includes
bash_permission_prompt_approved,bash_permission_prompt_denied, read/write file allow/deny, and plugin workspace-write scenarios.
- End-to-end harness includes
Existing G002-adjacent coverage
-
Unit-level permission coverage:
cargo test -p runtime permissions::testscargo test -p runtime permission_enforcer::testscargo test -p runtime bash_validation::testscargo test -p runtime file_ops::tests
-
CLI and integration coverage:
cargo test -p rusty-claude-cli --test mock_parity_harnesscargo test -p rusty-claude-cli --test output_format_contractcargo test -p rusty-claude-cli --test cli_flags_and_config_defaults
-
Board/report validation coverage:
python3 scripts/validate_cc2_board.py --board .omx/cc2/board.jsonpython3 .omx/cc2/validate_issue_parity_intake.py .omx/cc2/issue-parity-intake.json
Recommended safe work slices
Implementation lane (owned by worker-1 unless re-scoped)
-
Replace string-prefix workspace boundary checks with canonical path comparison in the runtime enforcement path.
- Primary files:
rust/crates/runtime/src/permission_enforcer.rs, possibly shared helper extraction fromrust/crates/runtime/src/file_ops.rs. - Regression cases:
../traversal, symlink escape, root prefix collision (/workspacevs/workspacex), relative paths, trailing slash root equality.
- Primary files:
-
Ensure direct file tools call workspace-aware wrappers when active permission mode is
workspace-write.- Primary files: likely
rust/crates/runtime/src/mcp_tool_bridge.rsand/or the runtime tool execution bridge that callsfile_ops. - Regression cases: direct read/write paths, missing parent creation, symlink parent escape, and error payload stability.
- Primary files: likely
-
Keep bash validation as a warning/classification layer unless a real shell-expansion resolver is introduced.
- Primary files:
rust/crates/runtime/src/bash_validation.rs,rust/crates/runtime/src/bash.rs. - Risk: heuristic parsing cannot faithfully resolve shell expansion, globs, aliases, or platform-specific path rules; avoid claiming hard enforcement unless execution sandbox or command resolver proves it.
- Primary files:
Test lane (coordinate with worker-3/worker-1 before editing)
-
Add unit regressions close to each enforcement function before changing behavior.
permission_enforcer.rs: canonical path boundary and Windows-shaped path cases.file_ops.rs: write/edit workspace wrappers with symlink parent escapes and missing file parent canonicalization.bash_validation.rs: shell expansion/glob/path warnings remain warnings unless a resolver is introduced.
-
Add at least one integration test proving the runtime bridge actually routes file tools through workspace enforcement, not only helper functions.
- Candidate:
rust/crates/rusty-claude-cli/tests/mock_parity_harness.rsfor direct write denial and no file created outside workspace.
- Candidate:
-
Preserve existing prompt/event visibility tests.
- Candidate surfaces: permission prompt scenarios in
mock_parity_harness.rs, status/doctor JSON inoutput_format_contract.rs.
- Candidate surfaces: permission prompt scenarios in
Docs/reporting lane (owned by worker-4)
- Keep this file as the integration handoff artifact for G002 mapping and verification.
- Report changed files and commits relative to
origin/mainso the leader can integrate worker branches deterministically. - Include exact command evidence in the task lifecycle result.
Changed files relative to origin/main at map time
The worktree currently contains these files added relative to origin/main before this task report:
.omx/cc2/board.json.omx/cc2/board.md.omx/cc2/issue-parity-intake.json.omx/cc2/issue-parity-intake.md.omx/cc2/render_board_md.py.omx/cc2/validate_issue_parity_intake.pyscripts/cc2_board.pyscripts/generate_cc2_board.pyscripts/validate_cc2_board.py
This task adds:
docs/g002-security-verification-map.md
Commits relative to origin/main at map time
8311655—omx(team): auto-checkpoint worker-1 [1]c6e2a7d—omx(team): merge worker-1481585f—omx(team): auto-checkpoint worker-1 [1]74bbf4b—omx(team): auto-checkpoint worker-4 [unknown]5c77896—omx(team): auto-checkpoint worker-1 [1]07dad88—Classify issue and parity intake for CC2 board integration424825f—task: G001 human board and docs renderingd15268e—Create a canonical CC2 board so every frozen ROADMAP heading is verifiably mapped45b43b5—Make the CC2 board schema executable for G001
Verification checklist for leader integration
Run these from the repository root unless noted:
-
Python board/schema validation:
python3 scripts/validate_cc2_board.py --board .omx/cc2/board.jsonpython3 .omx/cc2/validate_issue_parity_intake.py .omx/cc2/issue-parity-intake.json
-
Rust formatting and lint/type checks:
scripts/fmt.sh --check(cd rust && cargo check --workspace)(cd rust && cargo clippy --workspace --all-targets -- -D warnings)
-
Targeted G002 security tests:
(cd rust && cargo test -p runtime permissions::tests permission_enforcer::tests bash_validation::tests file_ops::tests)(cd rust && cargo test -p rusty-claude-cli --test mock_parity_harness)
-
Full regression:
(cd rust && cargo test --workspace)
Worker-4 verification evidence (2026-05-14)
PASS:
python3 scripts/validate_cc2_board.py --board .omx/cc2/board.json→PASS cc2 board validation; 729 items; ROADMAP headings124/124; ROADMAP actions542/542.python3 .omx/cc2/validate_issue_parity_intake.py .omx/cc2/issue-parity-intake.json→PASS issue/parity intake: 19 issue rows, 9 parity rows.scripts/fmt.sh --check→ no output and zero exit before Rust checks continued.(cd rust && cargo check --workspace)→Finished dev profilesuccessfully.(cd rust && cargo test -p runtime permissions::tests)→ 9 passed.(cd rust && cargo test -p runtime permission_enforcer::tests)→ 21 passed.(cd rust && cargo test -p runtime bash_validation::tests)→ 32 passed.(cd rust && cargo test -p runtime file_ops::tests)→ 14 passed.(cd rust && cargo test -p rusty-claude-cli --test mock_parity_harness)→ 1 passed.
FAIL / integration blockers observed on this worktree:
(cd rust && cargo clippy --workspace --all-targets -- -D warnings)failed in existing runtime code, not this docs-only task:rust/crates/runtime/src/compact.rs:215/:216:clippy::match_same_arms.rust/crates/runtime/src/policy_engine.rs:5:clippy::duration-suboptimal-units.rust/crates/runtime/src/sandbox.rs:295-302:clippy::map_unwrap_or.
(cd rust && cargo test --workspace)failed after broad success in API/commands/plugins/runtime tests becauserusty-claude-cliunit testtests::session_lifecycle_prefers_running_process_over_idle_shellassertedRunningProcessbut observedIdleShell.- Rerun of the specific failing test confirmed deterministic failure:
(cd rust && cargo test -p rusty-claude-cli --bin claw tests::session_lifecycle_prefers_running_process_over_idle_shell -- --exact --nocapture)→ 0 passed, 1 failed with the sameIdleShellvsRunningProcessassertion.
Recommended owner for failures: not worker-4 unless re-scoped. These failures are outside the docs/report artifact and touch shared runtime/CLI implementation files.