From 67dd3449eb980f4d7b9e02ea99a8a4116383da46 Mon Sep 17 00:00:00 2001 From: garrytan Date: Tue, 13 Oct 2026 00:53:03 +0000 Subject: [PATCH] feat(sealed): sealed-output guard over every published commit, in the pre-push hook and gstack-pregate sealed A repo with a sealed key in .gstack/pregate.json (base branch union the pushed commit, so a push can tighten but never relax) refuses publishing sealed paths, transcripts, quoted answers, seeds or local home paths to a public or unknown destination (SEALED_OUTPUT_REFUSED); private warns. Path rules see every added, renamed or copied path in each published commit (git rev-list --not --remotes=), text rules each commit's added lines; waivers only from the base branch allow file; a malformed policy fails closed; visibility caches public 24 h, private 1 h. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> --- bin/gstack-doctor-components.sh | 1 + bin/gstack-pregate | 35 ++++ bin/gstack-redact-prepush | 29 ++- docs/pregate.md | 47 +++++ docs/troubleshooting.md | 20 ++ lib/pregate/config.ts | 7 +- lib/result-codes.ts | 5 + lib/sealed-guard.ts | 276 +++++++++++++++++++++++++ test/fixtures/module-size-ratchet.json | 3 +- test/pregate-guards.test.ts | 10 + test/sealed-guard.test.ts | 223 ++++++++++++++++++++ 11 files changed, 653 insertions(+), 3 deletions(-) create mode 100644 lib/sealed-guard.ts create mode 100644 test/sealed-guard.test.ts diff --git a/bin/gstack-doctor-components.sh b/bin/gstack-doctor-components.sh index 3998eed6a..b52a021fc 100644 --- a/bin/gstack-doctor-components.sh +++ b/bin/gstack-doctor-components.sh @@ -167,6 +167,7 @@ gstack_result_anchor() { BRIEF_INPUT_MISSING) printf '%s' 'brief-input-missing' ;; DRAFT_DIRECTION_UNRESOLVED) printf '%s' 'draft-direction-unresolved' ;; PREGATE_GUARD_FAILED) printf '%s' 'pregate-guard-failed' ;; + SEALED_OUTPUT_REFUSED) printf '%s' 'sealed-output-refused' ;; *) return 1 ;; esac } diff --git a/bin/gstack-pregate b/bin/gstack-pregate index 4721f1bee..574ecaf21 100755 --- a/bin/gstack-pregate +++ b/bin/gstack-pregate @@ -9,6 +9,8 @@ * gstack-pregate clear --remote --run-url | --bundle-lane