From 7655f2d0278766fe30123e5abb5fb97aa7f1acc3 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Mon, 13 Jul 2026 02:26:54 +0100 Subject: [PATCH] Confine repo personality smoke deletion --- .../bin/epiphany-repo-personality-smoke.rs | 40 ++++++++++++++++-- ...onceptual-substitution-audit-2026-07-12.md | 9 ++++ notes/fresh-workspace-handoff.md | 5 +++ state/ledgers.msgpack | Bin 461661 -> 461984 bytes state/map.yaml | 2 +- 5 files changed, 52 insertions(+), 4 deletions(-) diff --git a/epiphany-core/src/bin/epiphany-repo-personality-smoke.rs b/epiphany-core/src/bin/epiphany-repo-personality-smoke.rs index 0b60d624..64cebdb1 100644 --- a/epiphany-core/src/bin/epiphany-repo-personality-smoke.rs +++ b/epiphany-core/src/bin/epiphany-repo-personality-smoke.rs @@ -23,8 +23,8 @@ fn run_smoke() -> Result { let artifacts = root .join(".epiphany-smoke") .join("repo-personality-artifacts"); - reset_path(&workspace)?; - reset_path(&artifacts)?; + reset_smoke_path(&root, &workspace)?; + reset_smoke_path(&root, &artifacts)?; let cult_repo = create_repo( &workspace.join("CultTiny"), &[ @@ -717,13 +717,47 @@ fn run_git(repo: &Path, args: &[&str]) -> Result<()> { ) } -fn reset_path(path: &Path) -> Result<()> { +fn reset_smoke_path(root: &Path, path: &Path) -> Result<()> { + let quarantine = root.join(".epiphany-smoke"); + fs::create_dir_all(&quarantine)?; + let quarantine = quarantine.canonicalize()?; + let parent = path.parent().unwrap_or_else(|| Path::new(".")); + fs::create_dir_all(parent)?; + let resolved = if path.exists() { + path.canonicalize()? + } else { + parent.canonicalize()?.join( + path.file_name() + .ok_or_else(|| anyhow!("smoke path has no leaf"))?, + ) + }; + if resolved == quarantine || !resolved.starts_with(&quarantine) { + return Err(anyhow!( + "refusing to reset path outside smoke quarantine: {}", + path.display() + )); + } if path.exists() { fs::remove_dir_all(path).with_context(|| format!("failed to reset {}", path.display()))?; } fs::create_dir_all(path).with_context(|| format!("failed to create {}", path.display())) } +#[cfg(test)] +mod reset_tests { + use super::*; + + #[test] + fn reset_refuses_traversal_outside_smoke_quarantine() -> Result<()> { + let temp = tempfile::tempdir()?; + let escaped = temp.path().join(".epiphany-smoke").join(".."); + let error = reset_smoke_path(temp.path(), &escaped).expect_err("escape must fail"); + assert!(error.to_string().contains("outside smoke quarantine")); + assert!(temp.path().exists()); + Ok(()) + } +} + fn path_value(value: &Value, key: &str) -> Result { value .get(key) diff --git a/notes/conceptual-substitution-audit-2026-07-12.md b/notes/conceptual-substitution-audit-2026-07-12.md index 71952038..959cd5f8 100644 --- a/notes/conceptual-substitution-audit-2026-07-12.md +++ b/notes/conceptual-substitution-audit-2026-07-12.md @@ -842,6 +842,15 @@ families, while collapsing shared envelope syntax only where the shared owner and invariant can be named. Presentation-only markdown checks do not deserve a policy framework merely because they also use strings. +## Fixed smoke-path provenance substituted for deletion scope + +`epiphany-repo-personality-smoke` built workspace and artifact paths beneath a +fixed `.epiphany-smoke` spelling, then recursively deleted them without +resolving containment. A junction at either leaf could redirect deletion beyond +the quarantine. Reset now canonicalizes the quarantine and target immediately +before actuation and requires a strict descendant. A traversal-negative test +proves path spelling cannot grant deletion authority. + ## Unresolved: provider receipts without chronology Bifrost body-change/GitHub publication receipts are externally owned and their diff --git a/notes/fresh-workspace-handoff.md b/notes/fresh-workspace-handoff.md index 59ed0d87..ced914b8 100644 --- a/notes/fresh-workspace-handoff.md +++ b/notes/fresh-workspace-handoff.md @@ -245,6 +245,11 @@ inputs, emitted state, forbidden writers, and negative proof before changing code. Also audit remaining non-receipt smoke binaries for path escape or destructive scope. +`epiphany-repo-personality-smoke` reset is now canonically confined beneath +`.epiphany-smoke`; fixed default provenance no longer authorizes recursive +deletion. Continue the same resolved-containment audit across remaining smoke +reset helpers. + The latest structural count is 32 closure family branches, 744 remaining substring assertions in the closure region, and 1,284 lines in `closure_contracts.rs`. Do not blindly generate a struct forest for every diff --git a/state/ledgers.msgpack b/state/ledgers.msgpack index bb5bbffd1a95f776598cd8469a04b66f11e165b3..d732e5514a5668cd4c1329a392239ace608aa696 100644 GIT binary patch delta 242 zcmWlRF-inM5Jl}-ofb`mjaF7DG&c}6(8L>PEEp6$Q zyn%QF1MwCfz@FgofAIeQeHkxa$8RIIc6fBKfBw1T*YDnUTW0%4qA3T1f?^;kk_@2|LzXKNI|fsnlSVB2cc~0mrlj0meCM0POTM83 VW@uB0Gb&4#Nw@gRN8PsfyZ;64R5$D`{GWs=7Won