feat(platformctl): harden sacred path safety #157
No reviewers
Labels
No labels
W6d-automerge-calibration
agent/claude-code
agent/codex
agent/hermes
agent/iskra
agent/ollama
agent/patchwarden
automerge-candidate
class/security-sensitive
cutover-gate
dependency/blocked
dependency/blocks-others
dependency/cross-repo
dependency/needs-confirmation
domain:agents
domain:ci
domain:docs
domain:forgejo
domain:infra
domain:memory
domain:runtime
domain:signal
domain:ux
flow/architecture
flow/blocked
flow/deployed
flow/done
flow/implementation
flow/intake
flow/maintained
flow/observed
flow/ready
flow/refining
flow/retired
flow/review
iterating
judge/codex-candidate
judge/hermes-candidate
judge/low-confidence
judge/needs-refinement
judge/operator-needed
judge/p0
judge/p1
judge/p2
judge/p3
judge/park
judge/patchwarden-candidate
judge/stale-priority
kind/adr
kind/bug
kind/chore
kind/feature
kind/infra
kind/ops
kind/refactor
kind/research
large-impact
merge/auto
merge/manual
merge/manual-dependency-conflict
merge/manual-failing-tests
merge/manual-merge-conflict
merge/manual-missing-review
merge/manual-operator-preference
merge/manual-red-zone
merge/manual-security-sensitive
merge/manual-unclear-scope
merge/manual-unknown
meta
mode:operator-only
mode:patchwarden-iskra-approved
mode:safe-auto
needs-operator-decision
needs-triage
not-ready
observed/erroring
observed/needs-followup
observed/pending
observed/retire-candidate
observed/unused
observed/used
operator-emotional
owner-attention
phase/02
phase/03
priority:p0
priority:p1
priority:p2
priority:p3
proposed
ready-for-agent
ready-for-operator
recovery
review:claude-reviewed
review:codex-reviewed
review:dziadek-reviewed
review:needs-human
risk/exposure
risk/process
risk/product
risk/runtime
safety:external-write
safety:no-prod-mutation
safety:prod-impact
safety:secret-touch
size/large
size/medium
size/small
size/tiny
size/unknown
source/adr
source/agent-generated
source/manual
source/operator-chat
source/voice-note
status:blocked
status:codex-ready
status:merged:pending-evidence
status:needs-evidence
status:operator-needed
status:parked
tier/full
tier/lite
tier/stacked
tier:0-platform-substrate
tier:1-iskra-value-layer
tier:2-tools-products-modules
type:bug
type:chore
type:docs
type:feat
type:policy
type:research
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
pdurlej/platform!157
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "codex/issues/142-phase3-safety"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Canary status: missing — fire canary 3+3 manually before merge
Canary Context Pack
Product story
Phase 3 needs
platformctlto be allowed to inspect and eventually apply platform state without risking sacred runtime data. This PR hardens the deterministic safety layer before transport/apply work builds on it.What changed
is_sacred_path()andcheck_command()for command-level mutation refusal.>&,-t/--target-directory,sed --in-place,--option terminators, shell flags before-c, shell positional arguments after-c, fail-closed command substitution/parse failure, common mutating file utilities,curl/wgetoutput targets,scpremote-path targets, inheritedcd/initial cwd context, semicolon separators, nested shells aftercd,$HOME/tilde/$OPENCLAW_HOMEexpansion, shell-glob overlap, sacred-exact directory targets, and&&/||mutation sequences.Why it changed
Phase 3 Packet 3.5 requires a central sacred-path enforcer before any SSH transport or apply command can be trusted.
Files touched
control-plane/platformctl/safety.pycontrol-plane/platformctl/tests/test_safety_phase3.pyRelevant context
prompts/codex-cutover-flight/phase-3-operational.mdPacket 3.5PLATFORM_CHARTER.md§11 sacred pathsdocs/forgejo-agent-operations.mdAGENTS.mdsecurity-sensitive class of serviceRuntime evidence
No runtime mutation. Code-only PR.
Known constraints
policies/sacred-paths.yamlis referenced by the charter but does not exist onorigin/main; this PR keeps enforcement in existingsafety.pyand tests the charter categories directly.Explicit out-of-scope
platformctl applyimplementation.Requested decision
Review as security-sensitive Phase 3 foundation. Merge only after full canary / operator process.
Merge blockers
Spec sources read
prompts/codex-cutover-flight/dispatch.md— phase sequencing and gatesprompts/codex-cutover-flight/phase-3-operational.md— Packet 3.5 acceptance criteriaPLATFORM_CHARTER.md§11 — sacred path categoriesdocs/forgejo-agent-operations.md— Forgejo/identity protocolAGENTS.md— security-sensitive class of service and PR rulescontrol-plane/platformctl/safety.py— implementation targetcontrol-plane/platformctl/tests/test_smoke.pyandtest_validate.py— existing test conventionsTests
PYTHONPATH=control-plane python3 -m pytest control-plane/platformctl/tests/test_safety_phase3.py -q— 128 passedPYTHONPATH=control-plane python3 -m pytest control-plane/platformctl/tests -q— 311 passedPYTHONPATH=control-plane python3 -m platformctl.cli validate modules/honcho-redis --strict-v2 --json— exit 0git diff --check— cleanIteration note 1: amended after Ollama caught redirect-without-whitespace and env-dir deletion bypasses; added tests for
cmd>path,&>, env dir, cp/install/ln/rsync/sed -i/bash -c/cd-then-rm.Iteration note 2: amended after expensive review caught fd append redirects,
-ttarget options,sed --in-place,--option terminator handling, shell flags before-c, andcdflags.Iteration note 3: amended after expensive review caught clobber redirect
>|,$HOMEexpansion,cd+ relative redirect, nested shell after outercd, and missing direct postgres directory coverage.Iteration note 4: amended after expensive review caught tilde remote-home bypass; also hardened semicolon separators,
>&,touch,mkdir,zsh -c, andOPENCLAW_HOMEexpansion.Iteration note 5: amended after expensive review caught shell-glob/direct directory-copy bypasses and unset $OPENCLAW_HOME remote expansion; added conservative glob overlap and sacred-exact directory target refusal, with cached rule normalization to keep tests fast.
Iteration note 6: amended after Kimi non-blocking review surfaced shell
-cpositional-argument hiding and parse-failure fallback risk; added fail-closed tokenization, shell-argument path checks, optionalinitial_cwd, and exact-prefixmkdir -pevidence tests.Iteration note 7: amended after DeepSeek review found command-substitution bypass (
rm $(echo /etc/ssh/sshd_config)); added fail-closed$(/backtick handling and tests.Iteration note 8: amended after DeepSeek review found missing common mutators; added
chattr,shred,rename,fallocate,setfacl, andsetfattrcoverage.Iteration note 9: amended after Kimi analysis surfaced common file-write tools; added
curl -o/--output,wget -O/--output-document, andscp host:/pathtarget handling.Iteration note 10: amended after DeepSeek review found
$0positional-argument bypass forbash -c; now all shell-carguments are checked.Refs #142
745d746587b99969e68cb99969e68c42c5e8a6e142c5e8a6e126e8ef139c26e8ef139cf1f43a1cc2f1f43a1cc2f3a2e17df2f3a2e17df211fe3869c911fe3869c9b49bf7089cb49bf7089c6a6f0063326a6f0063324e3e2370df4e3e2370dfcd59296be9Phase 3 safety status for final commit
cd59296be91b05e321434acde14937819221de4f:PYTHONPATH=control-plane python3 -m pytest control-plane/platformctl/tests/test_safety_phase3.py -q— 128 passedPYTHONPATH=control-plane python3 -m pytest control-plane/platformctl/tests -q— 311 passedPYTHONPATH=control-plane python3 -m platformctl.cli validate modules/honcho-redis --strict-v2 --json— passgit diff --check— cleancodex <codex@noreply.git.pdurlej.com>Ollama Cloud expensive review, final counted pass:
deepseek-v4-pro:cloud— APPROVE, blocking findings: Nonekimi-k2.6:cloud— APPROVE, blocking findings: Noneminimax-m2.7:cloud— APPROVE, blocking findings: NoneEarlier review iterations found real bypass classes and were fixed in this PR: shell globs, unset
$OPENCLAW_HOME, directory-copy targets, shell-cpositional args including$0, command substitution, common mutating utilities, andcurl/wget/scpwrite targets.Official canary status remains as the PR body says:
missing— this PR still needs the normal platform canary/owner merge process before merge.