@warpgogol/forge 9.6.2 → 9.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +62 -0
- package/CONTRIBUTING.md +19 -25
- package/README.md +14 -2
- package/README.uk.md +2 -2
- package/bin/cli.ts +40 -2
- package/dist/bin/cli.js +39 -2
- package/dist/bin/cli.js.map +1 -1
- package/dist/os/adr/handlers/implement-stamp.d.ts.map +1 -1
- package/dist/os/adr/handlers/implement-stamp.js +55 -19
- package/dist/os/adr/handlers/implement-stamp.js.map +1 -1
- package/dist/os/adr/handlers/validate.d.ts.map +1 -1
- package/dist/os/adr/handlers/validate.js +55 -21
- package/dist/os/adr/handlers/validate.js.map +1 -1
- package/dist/os/adversarial/adversarial.module.d.ts +3 -0
- package/dist/os/adversarial/adversarial.module.d.ts.map +1 -0
- package/dist/os/adversarial/adversarial.module.js +128 -0
- package/dist/os/adversarial/adversarial.module.js.map +1 -0
- package/dist/os/adversarial/catalog.d.ts +11 -0
- package/dist/os/adversarial/catalog.d.ts.map +1 -0
- package/dist/os/adversarial/catalog.js +72 -0
- package/dist/os/adversarial/catalog.js.map +1 -0
- package/dist/os/adversarial/runner.d.ts +17 -0
- package/dist/os/adversarial/runner.d.ts.map +1 -0
- package/dist/os/adversarial/runner.js +479 -0
- package/dist/os/adversarial/runner.js.map +1 -0
- package/dist/os/agent/handlers/agent-tiers-validate.d.ts.map +1 -1
- package/dist/os/agent/handlers/agent-tiers-validate.js +21 -7
- package/dist/os/agent/handlers/agent-tiers-validate.js.map +1 -1
- package/dist/os/agent/index.js +1 -1
- package/dist/os/agent-tools/agent-tools.module.d.ts +3 -0
- package/dist/os/agent-tools/agent-tools.module.d.ts.map +1 -0
- package/dist/os/agent-tools/agent-tools.module.js +80 -0
- package/dist/os/agent-tools/agent-tools.module.js.map +1 -0
- package/dist/os/agent-tools/generate.d.ts +18 -0
- package/dist/os/agent-tools/generate.d.ts.map +1 -0
- package/dist/os/agent-tools/generate.js +79 -0
- package/dist/os/agent-tools/generate.js.map +1 -0
- package/dist/os/agent-tools/handlers/tools-generate.d.ts +16 -0
- package/dist/os/agent-tools/handlers/tools-generate.d.ts.map +1 -0
- package/dist/os/agent-tools/handlers/tools-generate.js +108 -0
- package/dist/os/agent-tools/handlers/tools-generate.js.map +1 -0
- package/dist/os/agent-tools/index.d.ts +7 -0
- package/dist/os/agent-tools/index.d.ts.map +1 -0
- package/dist/os/agent-tools/index.js +16 -0
- package/dist/os/agent-tools/index.js.map +1 -0
- package/dist/os/agent-tools/manifest.d.ts +26 -0
- package/dist/os/agent-tools/manifest.d.ts.map +1 -0
- package/dist/os/agent-tools/manifest.js +70 -0
- package/dist/os/agent-tools/manifest.js.map +1 -0
- package/dist/os/agent-tools/serve.d.ts +21 -0
- package/dist/os/agent-tools/serve.d.ts.map +1 -0
- package/dist/os/agent-tools/serve.js +99 -0
- package/dist/os/agent-tools/serve.js.map +1 -0
- package/dist/os/agent-tools/server.d.ts +53 -0
- package/dist/os/agent-tools/server.d.ts.map +1 -0
- package/dist/os/agent-tools/server.js +381 -0
- package/dist/os/agent-tools/server.js.map +1 -0
- package/dist/os/agent-tools/types.d.ts +72 -0
- package/dist/os/agent-tools/types.d.ts.map +1 -0
- package/dist/os/agent-tools/types.js +74 -0
- package/dist/os/agent-tools/types.js.map +1 -0
- package/dist/os/authority/authority.module.d.ts.map +1 -1
- package/dist/os/authority/authority.module.js +17 -2
- package/dist/os/authority/authority.module.js.map +1 -1
- package/dist/os/checks/checks.module.d.ts.map +1 -1
- package/dist/os/checks/checks.module.js +44 -11
- package/dist/os/checks/checks.module.js.map +1 -1
- package/dist/os/checks/handlers/contribution-report.d.ts +3 -0
- package/dist/os/checks/handlers/contribution-report.d.ts.map +1 -1
- package/dist/os/checks/handlers/contribution-report.js +142 -23
- package/dist/os/checks/handlers/contribution-report.js.map +1 -1
- package/dist/os/checks/handlers/counters-export.d.ts.map +1 -1
- package/dist/os/checks/handlers/counters-export.js +75 -8
- package/dist/os/checks/handlers/counters-export.js.map +1 -1
- package/dist/os/checks/handlers/counters-validate.d.ts.map +1 -1
- package/dist/os/checks/handlers/counters-validate.js +1 -1
- package/dist/os/checks/handlers/counters-validate.js.map +1 -1
- package/dist/os/codebase/handlers/codebase-measure.d.ts.map +1 -1
- package/dist/os/codebase/handlers/codebase-measure.js +15 -18
- package/dist/os/codebase/handlers/codebase-measure.js.map +1 -1
- package/dist/os/codebase/index.d.ts.map +1 -1
- package/dist/os/codebase/index.js +4 -1
- package/dist/os/codebase/index.js.map +1 -1
- package/dist/os/compass/handlers/compass-audit-handler.d.ts +4 -2
- package/dist/os/compass/handlers/compass-audit-handler.d.ts.map +1 -1
- package/dist/os/compass/handlers/compass-audit-handler.js +229 -37
- package/dist/os/compass/handlers/compass-audit-handler.js.map +1 -1
- package/dist/os/compass/handlers/compass-header-scaffold-handler.d.ts.map +1 -1
- package/dist/os/compass/handlers/compass-header-scaffold-handler.js +45 -2
- package/dist/os/compass/handlers/compass-header-scaffold-handler.js.map +1 -1
- package/dist/os/compass/handlers/compass-migrate-handler.d.ts.map +1 -1
- package/dist/os/compass/handlers/compass-migrate-handler.js +44 -4
- package/dist/os/compass/handlers/compass-migrate-handler.js.map +1 -1
- package/dist/os/compass/handlers/git-revision.d.ts +31 -5
- package/dist/os/compass/handlers/git-revision.d.ts.map +1 -1
- package/dist/os/compass/handlers/git-revision.js +153 -55
- package/dist/os/compass/handlers/git-revision.js.map +1 -1
- package/dist/os/compass/handlers/summary-record.d.ts.map +1 -1
- package/dist/os/compass/handlers/summary-record.js +44 -9
- package/dist/os/compass/handlers/summary-record.js.map +1 -1
- package/dist/os/context/context.module.d.ts.map +1 -1
- package/dist/os/context/context.module.js +23 -4
- package/dist/os/context/context.module.js.map +1 -1
- package/dist/os/context/handlers/context-assemble.d.ts.map +1 -1
- package/dist/os/context/handlers/context-assemble.js +109 -16
- package/dist/os/context/handlers/context-assemble.js.map +1 -1
- package/dist/os/context/handlers/context-slate-eval.d.ts.map +1 -1
- package/dist/os/context/handlers/context-slate-eval.js +34 -9
- package/dist/os/context/handlers/context-slate-eval.js.map +1 -1
- package/dist/os/context/handlers/index-build.d.ts.map +1 -1
- package/dist/os/context/handlers/index-build.js +119 -26
- package/dist/os/context/handlers/index-build.js.map +1 -1
- package/dist/os/core/archive-regen.d.ts +55 -4
- package/dist/os/core/archive-regen.d.ts.map +1 -1
- package/dist/os/core/archive-regen.js +144 -11
- package/dist/os/core/archive-regen.js.map +1 -1
- package/dist/os/core/core.module.d.ts.map +1 -1
- package/dist/os/core/core.module.js +182 -50
- package/dist/os/core/core.module.js.map +1 -1
- package/dist/os/core/handlers/forge-autonomy-validate.d.ts +9 -2
- package/dist/os/core/handlers/forge-autonomy-validate.d.ts.map +1 -1
- package/dist/os/core/handlers/forge-autonomy-validate.js +81 -0
- package/dist/os/core/handlers/forge-autonomy-validate.js.map +1 -1
- package/dist/os/core/handlers/package-health.js +6 -6
- package/dist/os/core/handlers/policy-digest.d.ts +11 -0
- package/dist/os/core/handlers/policy-digest.d.ts.map +1 -0
- package/dist/os/core/handlers/policy-digest.js +421 -0
- package/dist/os/core/handlers/policy-digest.js.map +1 -0
- package/dist/os/correctness/audit/snapshot.d.ts.map +1 -1
- package/dist/os/correctness/audit/snapshot.js +46 -15
- package/dist/os/correctness/audit/snapshot.js.map +1 -1
- package/dist/os/correctness/correctness.module.d.ts.map +1 -1
- package/dist/os/correctness/correctness.module.js +5 -3
- package/dist/os/correctness/correctness.module.js.map +1 -1
- package/dist/os/correctness/gate/frozen.d.ts +84 -9
- package/dist/os/correctness/gate/frozen.d.ts.map +1 -1
- package/dist/os/correctness/gate/frozen.js +573 -53
- package/dist/os/correctness/gate/frozen.js.map +1 -1
- package/dist/os/correctness/gate/origin.d.ts +2 -0
- package/dist/os/correctness/gate/origin.d.ts.map +1 -1
- package/dist/os/correctness/gate/origin.js +68 -35
- package/dist/os/correctness/gate/origin.js.map +1 -1
- package/dist/os/correctness/gate/repo.d.ts +58 -2
- package/dist/os/correctness/gate/repo.d.ts.map +1 -1
- package/dist/os/correctness/gate/repo.js +177 -15
- package/dist/os/correctness/gate/repo.js.map +1 -1
- package/dist/os/correctness/gate/run.d.ts +6 -0
- package/dist/os/correctness/gate/run.d.ts.map +1 -1
- package/dist/os/correctness/gate/run.js +394 -62
- package/dist/os/correctness/gate/run.js.map +1 -1
- package/dist/os/correctness/gate/runner.d.ts.map +1 -1
- package/dist/os/correctness/gate/runner.js +42 -8
- package/dist/os/correctness/gate/runner.js.map +1 -1
- package/dist/os/correctness/gate/tests/gate-fixture.d.ts +5 -1
- package/dist/os/correctness/gate/tests/gate-fixture.d.ts.map +1 -1
- package/dist/os/correctness/gate/tests/gate-fixture.js +23 -1
- package/dist/os/correctness/gate/tests/gate-fixture.js.map +1 -1
- package/dist/os/correctness/gate/types.d.ts +3 -0
- package/dist/os/correctness/gate/types.d.ts.map +1 -1
- package/dist/os/correctness/gate/types.js +1 -0
- package/dist/os/correctness/gate/types.js.map +1 -1
- package/dist/os/correctness/handlers/gate.d.ts.map +1 -1
- package/dist/os/correctness/handlers/gate.js +2 -0
- package/dist/os/correctness/handlers/gate.js.map +1 -1
- package/dist/os/correctness/handlers/validate.d.ts +30 -0
- package/dist/os/correctness/handlers/validate.d.ts.map +1 -1
- package/dist/os/correctness/handlers/validate.js +20 -7
- package/dist/os/correctness/handlers/validate.js.map +1 -1
- package/dist/os/correctness/manifest-schema.d.ts +2 -2
- package/dist/os/correctness/references.d.ts +19 -0
- package/dist/os/correctness/references.d.ts.map +1 -1
- package/dist/os/correctness/references.js +57 -22
- package/dist/os/correctness/references.js.map +1 -1
- package/dist/os/correctness/workspace.d.ts +22 -2
- package/dist/os/correctness/workspace.d.ts.map +1 -1
- package/dist/os/correctness/workspace.js +194 -18
- package/dist/os/correctness/workspace.js.map +1 -1
- package/dist/os/flow/branch-name.d.ts.map +1 -1
- package/dist/os/flow/branch-name.js +2 -4
- package/dist/os/flow/branch-name.js.map +1 -1
- package/dist/os/flow/correctness-step.d.ts.map +1 -1
- package/dist/os/flow/correctness-step.js +83 -17
- package/dist/os/flow/correctness-step.js.map +1 -1
- package/dist/os/flow/digest.d.ts +27 -10
- package/dist/os/flow/digest.d.ts.map +1 -1
- package/dist/os/flow/digest.js +530 -165
- package/dist/os/flow/digest.js.map +1 -1
- package/dist/os/flow/dup-id-scan.d.ts +23 -0
- package/dist/os/flow/dup-id-scan.d.ts.map +1 -0
- package/dist/os/flow/dup-id-scan.js +171 -0
- package/dist/os/flow/dup-id-scan.js.map +1 -0
- package/dist/os/flow/flow.module.d.ts.map +1 -1
- package/dist/os/flow/flow.module.js +132 -18
- package/dist/os/flow/flow.module.js.map +1 -1
- package/dist/os/flow/git.d.ts +77 -11
- package/dist/os/flow/git.d.ts.map +1 -1
- package/dist/os/flow/git.js +661 -84
- package/dist/os/flow/git.js.map +1 -1
- package/dist/os/flow/guard-files.d.ts.map +1 -1
- package/dist/os/flow/guard-files.js +3 -5
- package/dist/os/flow/guard-files.js.map +1 -1
- package/dist/os/flow/handlers/flow-backmerge.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-backmerge.js +2 -2
- package/dist/os/flow/handlers/flow-backmerge.js.map +1 -1
- package/dist/os/flow/handlers/flow-check.js +2 -2
- package/dist/os/flow/handlers/flow-cut.d.ts +38 -0
- package/dist/os/flow/handlers/flow-cut.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-cut.js +325 -186
- package/dist/os/flow/handlers/flow-cut.js.map +1 -1
- package/dist/os/flow/handlers/flow-digest.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-digest.js +2 -1
- package/dist/os/flow/handlers/flow-digest.js.map +1 -1
- package/dist/os/flow/handlers/flow-discard.js +6 -6
- package/dist/os/flow/handlers/flow-discard.js.map +1 -1
- package/dist/os/flow/handlers/flow-fix.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-fix.js +34 -12
- package/dist/os/flow/handlers/flow-fix.js.map +1 -1
- package/dist/os/flow/handlers/flow-hold.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-hold.js +12 -21
- package/dist/os/flow/handlers/flow-hold.js.map +1 -1
- package/dist/os/flow/handlers/flow-install.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-install.js +19 -18
- package/dist/os/flow/handlers/flow-install.js.map +1 -1
- package/dist/os/flow/handlers/flow-integrate.d.ts +50 -2
- package/dist/os/flow/handlers/flow-integrate.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-integrate.js +624 -135
- package/dist/os/flow/handlers/flow-integrate.js.map +1 -1
- package/dist/os/flow/handlers/flow-open.d.ts +11 -0
- package/dist/os/flow/handlers/flow-open.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-open.js +82 -12
- package/dist/os/flow/handlers/flow-open.js.map +1 -1
- package/dist/os/flow/handlers/flow-publication-retire.d.ts +2 -2
- package/dist/os/flow/handlers/flow-publication-retire.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-publication-retire.js +36 -16
- package/dist/os/flow/handlers/flow-publication-retire.js.map +1 -1
- package/dist/os/flow/handlers/flow-push.d.ts +12 -4
- package/dist/os/flow/handlers/flow-push.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-push.js +297 -47
- package/dist/os/flow/handlers/flow-push.js.map +1 -1
- package/dist/os/flow/handlers/flow-status.d.ts +6 -0
- package/dist/os/flow/handlers/flow-status.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-status.js +13 -10
- package/dist/os/flow/handlers/flow-status.js.map +1 -1
- package/dist/os/flow/handlers/flow-swept.d.ts +30 -0
- package/dist/os/flow/handlers/flow-swept.d.ts.map +1 -0
- package/dist/os/flow/handlers/flow-swept.js +135 -0
- package/dist/os/flow/handlers/flow-swept.js.map +1 -0
- package/dist/os/flow/handlers/flow-version.d.ts.map +1 -1
- package/dist/os/flow/handlers/flow-version.js +3 -5
- package/dist/os/flow/handlers/flow-version.js.map +1 -1
- package/dist/os/flow/index.d.ts +2 -0
- package/dist/os/flow/index.d.ts.map +1 -1
- package/dist/os/flow/index.js +7 -4
- package/dist/os/flow/index.js.map +1 -1
- package/dist/os/flow/line-version.d.ts.map +1 -1
- package/dist/os/flow/line-version.js +20 -3
- package/dist/os/flow/line-version.js.map +1 -1
- package/dist/os/flow/locks.d.ts +7 -0
- package/dist/os/flow/locks.d.ts.map +1 -1
- package/dist/os/flow/locks.js +15 -5
- package/dist/os/flow/locks.js.map +1 -1
- package/dist/os/flow/markers.d.ts +1 -1
- package/dist/os/flow/markers.d.ts.map +1 -1
- package/dist/os/flow/markers.js +14 -5
- package/dist/os/flow/markers.js.map +1 -1
- package/dist/os/flow/ops-registry.d.ts.map +1 -1
- package/dist/os/flow/ops-registry.js +19 -6
- package/dist/os/flow/ops-registry.js.map +1 -1
- package/dist/os/flow/post-rebase-regen.d.ts +30 -8
- package/dist/os/flow/post-rebase-regen.d.ts.map +1 -1
- package/dist/os/flow/post-rebase-regen.js +172 -20
- package/dist/os/flow/post-rebase-regen.js.map +1 -1
- package/dist/os/flow/pre-lock.d.ts +61 -0
- package/dist/os/flow/pre-lock.d.ts.map +1 -0
- package/dist/os/flow/pre-lock.js +265 -0
- package/dist/os/flow/pre-lock.js.map +1 -0
- package/dist/os/flow/preflight.d.ts +6 -0
- package/dist/os/flow/preflight.d.ts.map +1 -1
- package/dist/os/flow/preflight.js +85 -13
- package/dist/os/flow/preflight.js.map +1 -1
- package/dist/os/flow/primary-dirt.d.ts +63 -0
- package/dist/os/flow/primary-dirt.d.ts.map +1 -0
- package/dist/os/flow/primary-dirt.js +259 -0
- package/dist/os/flow/primary-dirt.js.map +1 -0
- package/dist/os/flow/publish.d.ts.map +1 -1
- package/dist/os/flow/publish.js +32 -10
- package/dist/os/flow/publish.js.map +1 -1
- package/dist/os/flow/registry.d.ts +12 -4
- package/dist/os/flow/registry.d.ts.map +1 -1
- package/dist/os/flow/registry.js +15 -8
- package/dist/os/flow/registry.js.map +1 -1
- package/dist/os/flow/release-level.d.ts +2 -0
- package/dist/os/flow/release-level.d.ts.map +1 -1
- package/dist/os/flow/release-level.js +23 -5
- package/dist/os/flow/release-level.js.map +1 -1
- package/dist/os/flow/release-lines.js +1 -1
- package/dist/os/flow/release-tags.d.ts +1 -1
- package/dist/os/flow/release-tags.d.ts.map +1 -1
- package/dist/os/flow/release-tags.js +43 -19
- package/dist/os/flow/release-tags.js.map +1 -1
- package/dist/os/flow/repo-kind.d.ts.map +1 -1
- package/dist/os/flow/repo-kind.js +6 -3
- package/dist/os/flow/repo-kind.js.map +1 -1
- package/dist/os/flow/scripts.d.ts.map +1 -1
- package/dist/os/flow/scripts.js +40 -7
- package/dist/os/flow/scripts.js.map +1 -1
- package/dist/os/flow/semver.js +1 -1
- package/dist/os/flow/session-checkout.js +3 -3
- package/dist/os/flow/standalone-invoke.js +2 -2
- package/dist/os/flow/tests/helpers.d.ts +28 -1
- package/dist/os/flow/tests/helpers.d.ts.map +1 -1
- package/dist/os/flow/tests/helpers.js +159 -19
- package/dist/os/flow/tests/helpers.js.map +1 -1
- package/dist/os/flow/version-files.d.ts.map +1 -1
- package/dist/os/flow/version-files.js +3 -2
- package/dist/os/flow/version-files.js.map +1 -1
- package/dist/os/flow/worktree-path.d.ts.map +1 -1
- package/dist/os/flow/worktree-path.js +1 -1
- package/dist/os/flow/worktree-path.js.map +1 -1
- package/dist/os/friction/friction.module.d.ts.map +1 -1
- package/dist/os/friction/friction.module.js +134 -30
- package/dist/os/friction/friction.module.js.map +1 -1
- package/dist/os/friction/handlers/friction-add.d.ts +13 -0
- package/dist/os/friction/handlers/friction-add.d.ts.map +1 -0
- package/dist/os/friction/handlers/friction-add.js +196 -0
- package/dist/os/friction/handlers/friction-add.js.map +1 -0
- package/dist/os/friction/handlers/friction-migrate.d.ts +23 -0
- package/dist/os/friction/handlers/friction-migrate.d.ts.map +1 -0
- package/dist/os/friction/handlers/friction-migrate.js +168 -0
- package/dist/os/friction/handlers/friction-migrate.js.map +1 -0
- package/dist/os/friction/handlers/friction-validate.d.ts.map +1 -1
- package/dist/os/friction/handlers/friction-validate.js +144 -106
- package/dist/os/friction/handlers/friction-validate.js.map +1 -1
- package/dist/os/friction/index.d.ts +2 -0
- package/dist/os/friction/index.d.ts.map +1 -1
- package/dist/os/friction/index.js +3 -1
- package/dist/os/friction/index.js.map +1 -1
- package/dist/os/friction/store.d.ts +68 -0
- package/dist/os/friction/store.d.ts.map +1 -0
- package/dist/os/friction/store.js +231 -0
- package/dist/os/friction/store.js.map +1 -0
- package/dist/os/friction/types.d.ts +1 -1
- package/dist/os/friction/types.d.ts.map +1 -1
- package/dist/os/friction/types.js +11 -13
- package/dist/os/friction/types.js.map +1 -1
- package/dist/os/gate/gate.module.d.ts.map +1 -1
- package/dist/os/gate/gate.module.js +47 -6
- package/dist/os/gate/gate.module.js.map +1 -1
- package/dist/os/gate/handlers/gate-probe-catalog.d.ts +17 -2
- package/dist/os/gate/handlers/gate-probe-catalog.d.ts.map +1 -1
- package/dist/os/gate/handlers/gate-probe-catalog.js +343 -44
- package/dist/os/gate/handlers/gate-probe-catalog.js.map +1 -1
- package/dist/os/gate/handlers/gate-probe.d.ts.map +1 -1
- package/dist/os/gate/handlers/gate-probe.js +90 -10
- package/dist/os/gate/handlers/gate-probe.js.map +1 -1
- package/dist/os/gate/handlers/liveness.d.ts +30 -0
- package/dist/os/gate/handlers/liveness.d.ts.map +1 -0
- package/dist/os/gate/handlers/liveness.js +94 -0
- package/dist/os/gate/handlers/liveness.js.map +1 -0
- package/dist/os/gate/handlers/probe-runs-journal.d.ts +44 -0
- package/dist/os/gate/handlers/probe-runs-journal.d.ts.map +1 -0
- package/dist/os/gate/handlers/probe-runs-journal.js +157 -0
- package/dist/os/gate/handlers/probe-runs-journal.js.map +1 -0
- package/dist/os/gate-run/gate-run.module.d.ts.map +1 -1
- package/dist/os/gate-run/gate-run.module.js +3 -0
- package/dist/os/gate-run/gate-run.module.js.map +1 -1
- package/dist/os/gate-run/index.d.ts.map +1 -1
- package/dist/os/gate-run/index.js +10 -0
- package/dist/os/gate-run/index.js.map +1 -1
- package/dist/os/gate-run/record.d.ts +1 -0
- package/dist/os/gate-run/record.d.ts.map +1 -1
- package/dist/os/gate-run/record.js +2 -0
- package/dist/os/gate-run/record.js.map +1 -1
- package/dist/os/gate-run/status.d.ts.map +1 -1
- package/dist/os/gate-run/status.js +4 -1
- package/dist/os/gate-run/status.js.map +1 -1
- package/dist/os/gate-run/types.d.ts +7 -0
- package/dist/os/gate-run/types.d.ts.map +1 -1
- package/dist/os/gate-run/types.js +1 -0
- package/dist/os/gate-run/types.js.map +1 -1
- package/dist/os/instructions/handlers/scar-migrate.d.ts +3 -0
- package/dist/os/instructions/handlers/scar-migrate.d.ts.map +1 -1
- package/dist/os/instructions/handlers/scar-migrate.js +23 -66
- package/dist/os/instructions/handlers/scar-migrate.js.map +1 -1
- package/dist/os/instructions/instructions.module.d.ts.map +1 -1
- package/dist/os/instructions/instructions.module.js +32 -5
- package/dist/os/instructions/instructions.module.js.map +1 -1
- package/dist/os/knowledge/handlers/knowledge-authz-probe.d.ts.map +1 -1
- package/dist/os/knowledge/handlers/knowledge-authz-probe.js +31 -10
- package/dist/os/knowledge/handlers/knowledge-authz-probe.js.map +1 -1
- package/dist/os/knowledge/handlers/knowledge-rebuild.d.ts.map +1 -1
- package/dist/os/knowledge/handlers/knowledge-rebuild.js +24 -12
- package/dist/os/knowledge/handlers/knowledge-rebuild.js.map +1 -1
- package/dist/os/knowledge/knowledge.module.d.ts.map +1 -1
- package/dist/os/knowledge/knowledge.module.js +20 -4
- package/dist/os/knowledge/knowledge.module.js.map +1 -1
- package/dist/os/mission/lockfile.d.ts.map +1 -1
- package/dist/os/mission/lockfile.js +44 -20
- package/dist/os/mission/lockfile.js.map +1 -1
- package/dist/os/naming/naming-convention.js +2 -2
- package/dist/os/naming/naming-convention.js.map +1 -1
- package/dist/os/program/discovery.d.ts +14 -5
- package/dist/os/program/discovery.d.ts.map +1 -1
- package/dist/os/program/discovery.js +64 -46
- package/dist/os/program/discovery.js.map +1 -1
- package/dist/os/program/handlers/complete.d.ts.map +1 -1
- package/dist/os/program/handlers/complete.js +28 -10
- package/dist/os/program/handlers/complete.js.map +1 -1
- package/dist/os/program/handlers/lease.js +12 -2
- package/dist/os/program/handlers/lease.js.map +1 -1
- package/dist/os/program/handlers/seal.js +3 -3
- package/dist/os/program/handlers/seal.js.map +1 -1
- package/dist/os/program/handlers/validate.js +3 -3
- package/dist/os/program/handlers/validate.js.map +1 -1
- package/dist/os/queue/handlers/queue-decision.d.ts +10 -0
- package/dist/os/queue/handlers/queue-decision.d.ts.map +1 -0
- package/dist/os/queue/handlers/queue-decision.js +177 -0
- package/dist/os/queue/handlers/queue-decision.js.map +1 -0
- package/dist/os/queue/handlers/queue-validate.d.ts.map +1 -1
- package/dist/os/queue/handlers/queue-validate.js +18 -22
- package/dist/os/queue/handlers/queue-validate.js.map +1 -1
- package/dist/os/queue/manifest.d.ts.map +1 -1
- package/dist/os/queue/manifest.js +1 -2
- package/dist/os/queue/manifest.js.map +1 -1
- package/dist/os/queue/queue.module.d.ts.map +1 -1
- package/dist/os/queue/queue.module.js +89 -4
- package/dist/os/queue/queue.module.js.map +1 -1
- package/dist/os/rfc/frontmatter-io.d.ts.map +1 -1
- package/dist/os/rfc/frontmatter-io.js +4 -3
- package/dist/os/rfc/frontmatter-io.js.map +1 -1
- package/dist/os/rfc/handlers/implement-stamp-origin.d.ts.map +1 -1
- package/dist/os/rfc/handlers/implement-stamp-origin.js +6 -3
- package/dist/os/rfc/handlers/implement-stamp-origin.js.map +1 -1
- package/dist/os/rfc/handlers/implement-stamp.d.ts.map +1 -1
- package/dist/os/rfc/handlers/implement-stamp.js +65 -29
- package/dist/os/rfc/handlers/implement-stamp.js.map +1 -1
- package/dist/os/rfc/handlers/index-graph.d.ts.map +1 -1
- package/dist/os/rfc/handlers/index-graph.js +13 -0
- package/dist/os/rfc/handlers/index-graph.js.map +1 -1
- package/dist/os/rfc/handlers/rfc-evidence-sync.d.ts.map +1 -1
- package/dist/os/rfc/handlers/rfc-evidence-sync.js +52 -10
- package/dist/os/rfc/handlers/rfc-evidence-sync.js.map +1 -1
- package/dist/os/rfc/handlers/validate-rules.d.ts +1 -0
- package/dist/os/rfc/handlers/validate-rules.d.ts.map +1 -1
- package/dist/os/rfc/handlers/validate-rules.js +172 -50
- package/dist/os/rfc/handlers/validate-rules.js.map +1 -1
- package/dist/os/rfc/handlers/validate.d.ts.map +1 -1
- package/dist/os/rfc/handlers/validate.js +0 -3
- package/dist/os/rfc/handlers/validate.js.map +1 -1
- package/dist/os/rfc/next-id.d.ts +7 -1
- package/dist/os/rfc/next-id.d.ts.map +1 -1
- package/dist/os/rfc/next-id.js +122 -5
- package/dist/os/rfc/next-id.js.map +1 -1
- package/dist/os/rfc/outcome-probe.d.ts.map +1 -1
- package/dist/os/rfc/outcome-probe.js +5 -2
- package/dist/os/rfc/outcome-probe.js.map +1 -1
- package/dist/os/rfc/reachable-symbol.d.ts.map +1 -1
- package/dist/os/rfc/reachable-symbol.js +61 -19
- package/dist/os/rfc/reachable-symbol.js.map +1 -1
- package/dist/os/rfc/rfc.module.d.ts.map +1 -1
- package/dist/os/rfc/rfc.module.js +26 -4
- package/dist/os/rfc/rfc.module.js.map +1 -1
- package/dist/os/rfc/types.d.ts +28 -3
- package/dist/os/rfc/types.d.ts.map +1 -1
- package/dist/os/rfc/types.js +13 -3
- package/dist/os/rfc/types.js.map +1 -1
- package/dist/os/rfc/verification-evidence.d.ts.map +1 -1
- package/dist/os/rfc/verification-evidence.js +72 -24
- package/dist/os/rfc/verification-evidence.js.map +1 -1
- package/dist/os/rfc/verification-origin.d.ts +41 -3
- package/dist/os/rfc/verification-origin.d.ts.map +1 -1
- package/dist/os/rfc/verification-origin.js +314 -50
- package/dist/os/rfc/verification-origin.js.map +1 -1
- package/dist/os/rfc/verifier/rfc-1391/support.js +1 -1
- package/dist/os/rfc/verify-workspace.d.ts.map +1 -1
- package/dist/os/rfc/verify-workspace.js +148 -48
- package/dist/os/rfc/verify-workspace.js.map +1 -1
- package/dist/os/session/handlers/metrics-rfc.d.ts.map +1 -1
- package/dist/os/session/handlers/metrics-rfc.js +42 -11
- package/dist/os/session/handlers/metrics-rfc.js.map +1 -1
- package/dist/os/session/handlers/save.d.ts.map +1 -1
- package/dist/os/session/handlers/save.js +50 -24
- package/dist/os/session/handlers/save.js.map +1 -1
- package/dist/os/session/handlers/session-audit-report.d.ts.map +1 -1
- package/dist/os/session/handlers/session-audit-report.js +21 -6
- package/dist/os/session/handlers/session-audit-report.js.map +1 -1
- package/dist/os/session/handlers/session-audit.d.ts.map +1 -1
- package/dist/os/session/handlers/session-audit.js +22 -9
- package/dist/os/session/handlers/session-audit.js.map +1 -1
- package/dist/os/session/session.module.d.ts.map +1 -1
- package/dist/os/session/session.module.js +29 -9
- package/dist/os/session/session.module.js.map +1 -1
- package/dist/os/system/handlers/system-outbox-scan.d.ts.map +1 -1
- package/dist/os/system/handlers/system-outbox-scan.js +36 -18
- package/dist/os/system/handlers/system-outbox-scan.js.map +1 -1
- package/dist/os/system/handlers/system-task-dispatch.d.ts.map +1 -1
- package/dist/os/system/handlers/system-task-dispatch.js +14 -16
- package/dist/os/system/handlers/system-task-dispatch.js.map +1 -1
- package/dist/os/system/handlers/system-versionset-record.js +3 -3
- package/dist/os/system/scenario-schemas.js +1 -1
- package/dist/os/system/system.module.d.ts.map +1 -1
- package/dist/os/system/system.module.js +14 -9
- package/dist/os/system/system.module.js.map +1 -1
- package/dist/os/system/task-schemas.d.ts +3 -3
- package/dist/os/trajectory/handlers/journal-io.d.ts.map +1 -1
- package/dist/os/trajectory/handlers/journal-io.js +2 -2
- package/dist/os/trajectory/handlers/journal-io.js.map +1 -1
- package/dist/os/trajectory/handlers/outcome-record.d.ts.map +1 -1
- package/dist/os/trajectory/handlers/outcome-record.js +49 -9
- package/dist/os/trajectory/handlers/outcome-record.js.map +1 -1
- package/dist/os/trajectory/handlers/trajectory-index.d.ts.map +1 -1
- package/dist/os/trajectory/handlers/trajectory-index.js +75 -21
- package/dist/os/trajectory/handlers/trajectory-index.js.map +1 -1
- package/dist/os/trajectory/handlers/trajectory-recall.d.ts.map +1 -1
- package/dist/os/trajectory/handlers/trajectory-recall.js +38 -10
- package/dist/os/trajectory/handlers/trajectory-recall.js.map +1 -1
- package/dist/os/trajectory/trajectory.module.d.ts.map +1 -1
- package/dist/os/trajectory/trajectory.module.js +35 -7
- package/dist/os/trajectory/trajectory.module.js.map +1 -1
- package/dist/src/adversarial/types.d.ts +44 -0
- package/dist/src/adversarial/types.d.ts.map +1 -0
- package/dist/src/adversarial/types.js +82 -0
- package/dist/src/adversarial/types.js.map +1 -0
- package/dist/src/authority/delegations.d.ts +1 -1
- package/dist/src/authority/delegations.d.ts.map +1 -1
- package/dist/src/authority/delegations.js +9 -2
- package/dist/src/authority/delegations.js.map +1 -1
- package/dist/src/command-modules.d.ts.map +1 -1
- package/dist/src/command-modules.js +2 -0
- package/dist/src/command-modules.js.map +1 -1
- package/dist/src/config/forge-config.d.ts +65 -1
- package/dist/src/config/forge-config.d.ts.map +1 -1
- package/dist/src/config/forge-config.js +114 -12
- package/dist/src/config/forge-config.js.map +1 -1
- package/dist/src/correctness/policy-bundle.d.ts +72 -0
- package/dist/src/correctness/policy-bundle.d.ts.map +1 -0
- package/dist/src/correctness/policy-bundle.js +170 -0
- package/dist/src/correctness/policy-bundle.js.map +1 -0
- package/dist/src/knowledge/paths.d.ts +21 -0
- package/dist/src/knowledge/paths.d.ts.map +1 -0
- package/dist/src/knowledge/paths.js +57 -0
- package/dist/src/knowledge/paths.js.map +1 -0
- package/dist/src/knowledge/sync.d.ts +7 -0
- package/dist/src/knowledge/sync.d.ts.map +1 -1
- package/dist/src/knowledge/sync.js +41 -13
- package/dist/src/knowledge/sync.js.map +1 -1
- package/dist/src/migration-adapters/ignored-files.d.ts +14 -0
- package/dist/src/migration-adapters/ignored-files.d.ts.map +1 -1
- package/dist/src/migration-adapters/ignored-files.js +62 -0
- package/dist/src/migration-adapters/ignored-files.js.map +1 -1
- package/dist/src/migration-adapters/index.d.ts +3 -3
- package/dist/src/migration-adapters/index.d.ts.map +1 -1
- package/dist/src/migration-adapters/index.js +2 -2
- package/dist/src/migration-adapters/index.js.map +1 -1
- package/dist/src/migration-adapters/node-typescript-pnpm/index.d.ts.map +1 -1
- package/dist/src/migration-adapters/node-typescript-pnpm/index.js +9 -7
- package/dist/src/migration-adapters/node-typescript-pnpm/index.js.map +1 -1
- package/dist/src/migration-adapters/phaser-pnpm/index.d.ts.map +1 -1
- package/dist/src/migration-adapters/phaser-pnpm/index.js +9 -7
- package/dist/src/migration-adapters/phaser-pnpm/index.js.map +1 -1
- package/dist/src/migration-adapters/types.d.ts +19 -1
- package/dist/src/migration-adapters/types.d.ts.map +1 -1
- package/dist/src/migration-adapters/types.js +19 -0
- package/dist/src/migration-adapters/types.js.map +1 -1
- package/dist/src/onboarding/init.d.ts.map +1 -1
- package/dist/src/onboarding/init.js +19 -5
- package/dist/src/onboarding/init.js.map +1 -1
- package/dist/src/onboarding/npm-token-check.d.ts.map +1 -1
- package/dist/src/onboarding/npm-token-check.js +9 -1
- package/dist/src/onboarding/npm-token-check.js.map +1 -1
- package/dist/src/onboarding/scaffold-project.d.ts.map +1 -1
- package/dist/src/onboarding/scaffold-project.js +17 -5
- package/dist/src/onboarding/scaffold-project.js.map +1 -1
- package/dist/src/onboarding/trust-boundary.d.ts +16 -0
- package/dist/src/onboarding/trust-boundary.d.ts.map +1 -0
- package/dist/src/onboarding/trust-boundary.js +806 -0
- package/dist/src/onboarding/trust-boundary.js.map +1 -0
- package/dist/src/onboarding/upgrade.d.ts +4 -0
- package/dist/src/onboarding/upgrade.d.ts.map +1 -1
- package/dist/src/onboarding/upgrade.js +120 -9
- package/dist/src/onboarding/upgrade.js.map +1 -1
- package/dist/src/types.d.ts +6 -1
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js +3 -3
- package/dist/src/utils/verifier-git.d.ts +1303 -0
- package/dist/src/utils/verifier-git.d.ts.map +1 -0
- package/dist/src/utils/verifier-git.js +7797 -0
- package/dist/src/utils/verifier-git.js.map +1 -0
- package/dist/src/validators/skill-validate.d.ts.map +1 -1
- package/dist/src/validators/skill-validate.js +17 -5
- package/dist/src/validators/skill-validate.js.map +1 -1
- package/docs/adversarial/downgrade-forge/scenario.yaml +22 -0
- package/docs/adversarial/drop-manifest-entry/scenario.yaml +25 -0
- package/docs/adversarial/edit-frozen-file/scenario.yaml +24 -0
- package/docs/adversarial/edit-policy-key/scenario.yaml +41 -0
- package/docs/adversarial/forge-review-record/scenario.yaml +34 -0
- package/docs/adversarial/grow-allow/scenario.yaml +46 -0
- package/docs/adversarial/mixed-weakening/scenario.yaml +26 -0
- package/docs/adversarial/rebind-checkrun/scenario.yaml +41 -0
- package/docs/adversarial/self-exempt/scenario.yaml +41 -0
- package/docs/adversarial/shrink-policy-decl/scenario.yaml +41 -0
- package/docs/adversarial/spoof-verifier-trailer/scenario.yaml +26 -0
- package/docs/adversarial/weaken-oracle/scenario.yaml +22 -0
- package/docs/concepts/why-forge.md +1 -1
- package/docs/evidence/release-9.6.2.md +31 -0
- package/docs/grants/devin-startups.md +25 -0
- package/docs/guides/existing-project.md +5 -5
- package/docs/integrations/devin.md +14 -0
- package/docs/maintainers/publishing.md +1 -1
- package/docs/reference/cli.md +2 -2
- package/docs/reference/correctness-gate.md +35 -5
- package/docs/reference/forge-yaml.md +17 -1
- package/docs/reference/trust-boundary.md +36 -0
- package/os/adr/handlers/implement-stamp.ts +56 -26
- package/os/adr/handlers/validate.ts +66 -28
- package/os/adversarial/adversarial.module.ts +147 -0
- package/os/adversarial/catalog.test.ts +96 -0
- package/os/adversarial/catalog.ts +79 -0
- package/os/adversarial/runner.ts +533 -0
- package/os/agent/handlers/agent-tiers-validate.ts +39 -10
- package/os/agent/index.ts +1 -1
- package/os/agent-tools/agent-tools.module.ts +84 -0
- package/os/agent-tools/generate.ts +104 -0
- package/os/agent-tools/handlers/tools-generate.ts +137 -0
- package/os/agent-tools/index.ts +23 -0
- package/os/agent-tools/manifest.ts +95 -0
- package/os/agent-tools/serve.ts +127 -0
- package/os/agent-tools/server.ts +460 -0
- package/os/agent-tools/tool-server.test.ts +226 -0
- package/os/agent-tools/tools-generate.test.ts +204 -0
- package/os/agent-tools/types.ts +139 -0
- package/os/authority/authority.module.ts +17 -2
- package/os/checks/checks.module.ts +46 -11
- package/os/checks/handlers/contribution-liveness.test.ts +142 -0
- package/os/checks/handlers/contribution-report.test.ts +46 -11
- package/os/checks/handlers/contribution-report.ts +222 -44
- package/os/checks/handlers/counters-export.test.ts +179 -8
- package/os/checks/handlers/counters-export.ts +77 -9
- package/os/checks/handlers/counters-journal.test.ts +25 -5
- package/os/checks/handlers/counters-validate.test.ts +21 -6
- package/os/checks/handlers/counters-validate.ts +4 -2
- package/os/checks/handlers/variant-candidates.test.ts +6 -2
- package/os/codebase/handlers/codebase-measure.ts +17 -20
- package/os/codebase/index.ts +4 -1
- package/os/compass/handlers/compass-audit-handler.ts +236 -38
- package/os/compass/handlers/compass-header-scaffold-handler.ts +47 -2
- package/os/compass/handlers/compass-migrate-handler.ts +46 -4
- package/os/compass/handlers/git-revision.ts +183 -63
- package/os/compass/handlers/summary-record.ts +48 -10
- package/os/context/context.module.ts +23 -4
- package/os/context/handlers/context-assemble.test.ts +5 -2
- package/os/context/handlers/context-assemble.ts +144 -28
- package/os/context/handlers/context-slate-eval.test.ts +11 -5
- package/os/context/handlers/context-slate-eval.ts +36 -10
- package/os/context/handlers/index-build.ts +179 -40
- package/os/context/handlers/no-model-deps.test.ts +8 -3
- package/os/context/handlers/slate-fill.test.ts +7 -2
- package/os/core/archive-regen.ts +178 -13
- package/os/core/core.module.ts +208 -51
- package/os/core/docs-archive.test.ts +134 -37
- package/os/core/handlers/forge-autonomy-validate.ts +104 -2
- package/os/core/handlers/package-health.ts +6 -6
- package/os/core/handlers/policy-digest.test.ts +143 -0
- package/os/core/handlers/policy-digest.ts +470 -0
- package/os/correctness/audit/snapshot.ts +46 -22
- package/os/correctness/correctness-chain.test.ts +6 -2
- package/os/correctness/correctness.module.ts +6 -3
- package/os/correctness/gate/anchor-events.test.ts +5 -1
- package/os/correctness/gate/freeze-coverage.test.ts +1 -1
- package/os/correctness/gate/freeze-diff.test.ts +1 -1
- package/os/correctness/gate/frozen.ts +691 -58
- package/os/correctness/gate/gate-mode.test.ts +5 -1
- package/os/correctness/gate/hardening.test.ts +5 -2
- package/os/correctness/gate/origin.ts +77 -37
- package/os/correctness/gate/policy-freeze-cx.test.ts +174 -0
- package/os/correctness/gate/policy-freeze-cx10.test.ts +873 -0
- package/os/correctness/gate/policy-freeze-cx11.test.ts +534 -0
- package/os/correctness/gate/policy-freeze-cx12.test.ts +488 -0
- package/os/correctness/gate/policy-freeze-cx13.test.ts +734 -0
- package/os/correctness/gate/policy-freeze-cx14.test.ts +533 -0
- package/os/correctness/gate/policy-freeze-cx15.test.ts +830 -0
- package/os/correctness/gate/policy-freeze-cx16.test.ts +652 -0
- package/os/correctness/gate/policy-freeze-cx17.test.ts +717 -0
- package/os/correctness/gate/policy-freeze-cx18.test.ts +705 -0
- package/os/correctness/gate/policy-freeze-cx19.test.ts +376 -0
- package/os/correctness/gate/policy-freeze-cx2.test.ts +691 -0
- package/os/correctness/gate/policy-freeze-cx20.test.ts +572 -0
- package/os/correctness/gate/policy-freeze-cx21.test.ts +423 -0
- package/os/correctness/gate/policy-freeze-cx22.test.ts +978 -0
- package/os/correctness/gate/policy-freeze-cx23.test.ts +431 -0
- package/os/correctness/gate/policy-freeze-cx24.test.ts +509 -0
- package/os/correctness/gate/policy-freeze-cx25.test.ts +1064 -0
- package/os/correctness/gate/policy-freeze-cx3.test.ts +569 -0
- package/os/correctness/gate/policy-freeze-cx4.test.ts +731 -0
- package/os/correctness/gate/policy-freeze-cx5.test.ts +577 -0
- package/os/correctness/gate/policy-freeze-cx6.test.ts +944 -0
- package/os/correctness/gate/policy-freeze-cx7.test.ts +622 -0
- package/os/correctness/gate/policy-freeze-cx8.test.ts +638 -0
- package/os/correctness/gate/policy-freeze-cx9.test.ts +959 -0
- package/os/correctness/gate/policy-freeze.test.ts +249 -0
- package/os/correctness/gate/repo.ts +194 -15
- package/os/correctness/gate/run.ts +444 -65
- package/os/correctness/gate/runner.ts +41 -8
- package/os/correctness/gate/tests/gate-fixture.ts +27 -2
- package/os/correctness/gate/tier-high.test.ts +5 -1
- package/os/correctness/gate/trust-boundary-cx1.test.ts +1020 -0
- package/os/correctness/gate/trust-boundary-cx10.test.ts +755 -0
- package/os/correctness/gate/trust-boundary-cx11.test.ts +515 -0
- package/os/correctness/gate/trust-boundary-cx12.test.ts +552 -0
- package/os/correctness/gate/trust-boundary-cx13.test.ts +446 -0
- package/os/correctness/gate/trust-boundary-cx14.test.ts +375 -0
- package/os/correctness/gate/trust-boundary-cx15.test.ts +421 -0
- package/os/correctness/gate/trust-boundary-cx16.test.ts +487 -0
- package/os/correctness/gate/trust-boundary-cx17.test.ts +319 -0
- package/os/correctness/gate/trust-boundary-cx18.test.ts +516 -0
- package/os/correctness/gate/trust-boundary-cx19.test.ts +514 -0
- package/os/correctness/gate/trust-boundary-cx2.test.ts +979 -0
- package/os/correctness/gate/trust-boundary-cx20.test.ts +216 -0
- package/os/correctness/gate/trust-boundary-cx22.test.ts +193 -0
- package/os/correctness/gate/trust-boundary-cx23.test.ts +283 -0
- package/os/correctness/gate/trust-boundary-cx24.test.ts +180 -0
- package/os/correctness/gate/trust-boundary-cx25.test.ts +482 -0
- package/os/correctness/gate/trust-boundary-cx26.test.ts +408 -0
- package/os/correctness/gate/trust-boundary-cx27.test.ts +983 -0
- package/os/correctness/gate/trust-boundary-cx28.test.ts +587 -0
- package/os/correctness/gate/trust-boundary-cx29a.test.ts +226 -0
- package/os/correctness/gate/trust-boundary-cx29b.test.ts +271 -0
- package/os/correctness/gate/trust-boundary-cx29c.test.ts +217 -0
- package/os/correctness/gate/trust-boundary-cx29d.test.ts +544 -0
- package/os/correctness/gate/trust-boundary-cx29e.test.ts +207 -0
- package/os/correctness/gate/trust-boundary-cx29f.test.ts +226 -0
- package/os/correctness/gate/trust-boundary-cx29g.test.ts +74 -0
- package/os/correctness/gate/trust-boundary-cx3.test.ts +929 -0
- package/os/correctness/gate/trust-boundary-cx30a.test.ts +195 -0
- package/os/correctness/gate/trust-boundary-cx30b.test.ts +296 -0
- package/os/correctness/gate/trust-boundary-cx31a.test.ts +129 -0
- package/os/correctness/gate/trust-boundary-cx31b.test.ts +333 -0
- package/os/correctness/gate/trust-boundary-cx31c.test.ts +259 -0
- package/os/correctness/gate/trust-boundary-cx31d.test.ts +132 -0
- package/os/correctness/gate/trust-boundary-cx32a.test.ts +275 -0
- package/os/correctness/gate/trust-boundary-cx32b.test.ts +509 -0
- package/os/correctness/gate/trust-boundary-cx32c.test.ts +211 -0
- package/os/correctness/gate/trust-boundary-cx32d.test.ts +184 -0
- package/os/correctness/gate/trust-boundary-cx33a.test.ts +250 -0
- package/os/correctness/gate/trust-boundary-cx33b.test.ts +287 -0
- package/os/correctness/gate/trust-boundary-cx33c.test.ts +122 -0
- package/os/correctness/gate/trust-boundary-cx33d.test.ts +357 -0
- package/os/correctness/gate/trust-boundary-cx33e.test.ts +96 -0
- package/os/correctness/gate/trust-boundary-cx34a.test.ts +283 -0
- package/os/correctness/gate/trust-boundary-cx34b.test.ts +228 -0
- package/os/correctness/gate/trust-boundary-cx34d.test.ts +282 -0
- package/os/correctness/gate/trust-boundary-cx34e.test.ts +224 -0
- package/os/correctness/gate/trust-boundary-cx34f.test.ts +250 -0
- package/os/correctness/gate/trust-boundary-cx34g.test.ts +179 -0
- package/os/correctness/gate/trust-boundary-cx34h.test.ts +293 -0
- package/os/correctness/gate/trust-boundary-cx34i.test.ts +245 -0
- package/os/correctness/gate/trust-boundary-cx35a.test.ts +181 -0
- package/os/correctness/gate/trust-boundary-cx35b.test.ts +137 -0
- package/os/correctness/gate/trust-boundary-cx35c.test.ts +149 -0
- package/os/correctness/gate/trust-boundary-cx35d.test.ts +121 -0
- package/os/correctness/gate/trust-boundary-cx35e.test.ts +108 -0
- package/os/correctness/gate/trust-boundary-cx36.test.ts +120 -0
- package/os/correctness/gate/trust-boundary-cx37.test.ts +430 -0
- package/os/correctness/gate/trust-boundary-cx38.test.ts +436 -0
- package/os/correctness/gate/trust-boundary-cx39.test.ts +432 -0
- package/os/correctness/gate/trust-boundary-cx4.test.ts +764 -0
- package/os/correctness/gate/trust-boundary-cx40.test.ts +264 -0
- package/os/correctness/gate/trust-boundary-cx41.test.ts +460 -0
- package/os/correctness/gate/trust-boundary-cx42.test.ts +432 -0
- package/os/correctness/gate/trust-boundary-cx43.test.ts +257 -0
- package/os/correctness/gate/trust-boundary-cx5.test.ts +998 -0
- package/os/correctness/gate/trust-boundary-cx6.test.ts +701 -0
- package/os/correctness/gate/trust-boundary-cx7.test.ts +1007 -0
- package/os/correctness/gate/trust-boundary-cx8.test.ts +929 -0
- package/os/correctness/gate/trust-boundary-cx9.test.ts +993 -0
- package/os/correctness/gate/types.ts +4 -0
- package/os/correctness/handlers/gate.ts +2 -0
- package/os/correctness/handlers/validate.ts +63 -12
- package/os/correctness/references.ts +63 -20
- package/os/correctness/workspace.ts +203 -22
- package/os/flow/branch-name.ts +3 -6
- package/os/flow/correctness-step.ts +91 -17
- package/os/flow/digest.ts +598 -178
- package/os/flow/dup-id-scan.ts +187 -0
- package/os/flow/flow.module.ts +138 -18
- package/os/flow/git.ts +757 -86
- package/os/flow/guard-files.ts +5 -14
- package/os/flow/handlers/flow-backmerge.ts +11 -22
- package/os/flow/handlers/flow-check.ts +2 -2
- package/os/flow/handlers/flow-cut.ts +459 -252
- package/os/flow/handlers/flow-digest.ts +2 -1
- package/os/flow/handlers/flow-discard.ts +6 -6
- package/os/flow/handlers/flow-fix.ts +104 -29
- package/os/flow/handlers/flow-hold.ts +24 -37
- package/os/flow/handlers/flow-install.ts +61 -33
- package/os/flow/handlers/flow-integrate.ts +992 -209
- package/os/flow/handlers/flow-open.ts +104 -12
- package/os/flow/handlers/flow-publication-retire.ts +38 -17
- package/os/flow/handlers/flow-push.ts +337 -73
- package/os/flow/handlers/flow-status.ts +32 -13
- package/os/flow/handlers/flow-swept.ts +185 -0
- package/os/flow/handlers/flow-version.ts +5 -18
- package/os/flow/index.ts +8 -4
- package/os/flow/line-version.ts +21 -8
- package/os/flow/locks.ts +21 -10
- package/os/flow/markers.ts +16 -5
- package/os/flow/ops-registry.ts +25 -7
- package/os/flow/post-rebase-regen.ts +218 -25
- package/os/flow/pre-lock.ts +334 -0
- package/os/flow/preflight.ts +108 -17
- package/os/flow/primary-dirt.ts +319 -0
- package/os/flow/publish.ts +35 -17
- package/os/flow/registry.ts +23 -13
- package/os/flow/release-level.ts +25 -12
- package/os/flow/release-lines.ts +4 -5
- package/os/flow/release-tags.ts +47 -19
- package/os/flow/repo-kind.ts +6 -3
- package/os/flow/scripts.ts +40 -7
- package/os/flow/semver.ts +1 -1
- package/os/flow/session-checkout.ts +3 -3
- package/os/flow/standalone-invoke.ts +2 -2
- package/os/flow/tests/branch-name.test.ts +15 -7
- package/os/flow/tests/flow-backmerge.test.ts +8 -6
- package/os/flow/tests/flow-check.test.ts +6 -11
- package/os/flow/tests/flow-cut-prepare.test.ts +64 -15
- package/os/flow/tests/flow-cut.rerun.test.ts +1 -1
- package/os/flow/tests/flow-cut.test.ts +230 -11
- package/os/flow/tests/flow-detachable.test.ts +10 -2
- package/os/flow/tests/flow-digest.test.ts +109 -29
- package/os/flow/tests/flow-fix.test.ts +96 -20
- package/os/flow/tests/flow-guard-parity.test.ts +55 -53
- package/os/flow/tests/flow-guard-push.test.ts +39 -2
- package/os/flow/tests/flow-guard.test.ts +5 -10
- package/os/flow/tests/flow-hold.test.ts +43 -10
- package/os/flow/tests/flow-install-markers.test.ts +47 -20
- package/os/flow/tests/flow-install.rerun.test.ts +18 -9
- package/os/flow/tests/flow-install.test.ts +19 -19
- package/os/flow/tests/flow-integrate-correctness-gate.test.ts +3 -4
- package/os/flow/tests/flow-integrate-prelock.test.ts +392 -0
- package/os/flow/tests/flow-integrate.gate-report.test.ts +2 -4
- package/os/flow/tests/flow-integrate.post-rebase-regen.test.ts +33 -0
- package/os/flow/tests/flow-integrate.preflight.test.ts +36 -1
- package/os/flow/tests/flow-integrate.test.ts +375 -21
- package/os/flow/tests/flow-open.test.ts +123 -9
- package/os/flow/tests/flow-publication-retire.test.ts +13 -6
- package/os/flow/tests/flow-push-publish.test.ts +45 -19
- package/os/flow/tests/flow-push-supersede.test.ts +37 -34
- package/os/flow/tests/flow-push-verifier-review.test.ts +190 -0
- package/os/flow/tests/flow-push.test.ts +15 -7
- package/os/flow/tests/flow-status.test.ts +54 -1
- package/os/flow/tests/flow-swept.test.ts +105 -0
- package/os/flow/tests/flow-task-files.test.ts +18 -4
- package/os/flow/tests/helpers.test.ts +91 -0
- package/os/flow/tests/helpers.ts +188 -19
- package/os/flow/tests/locks.test.ts +5 -4
- package/os/flow/tests/post-rebase-regen.test.ts +315 -0
- package/os/flow/tests/scripts.test.ts +8 -4
- package/os/flow/tests/state-roots.test.ts +8 -11
- package/os/flow/version-files.ts +4 -2
- package/os/flow/worktree-path.ts +3 -9
- package/os/friction/friction-add.test.ts +141 -0
- package/os/friction/friction-migrate.test.ts +138 -0
- package/os/friction/friction-store.test.ts +184 -0
- package/os/friction/friction-validate.test.ts +133 -21
- package/os/friction/friction.module.ts +140 -30
- package/os/friction/handlers/friction-add.ts +268 -0
- package/os/friction/handlers/friction-migrate.ts +206 -0
- package/os/friction/handlers/friction-validate.ts +238 -176
- package/os/friction/index.ts +14 -1
- package/os/friction/qa-log-shards.test.ts +111 -0
- package/os/friction/store.ts +284 -0
- package/os/friction/types.ts +11 -13
- package/os/gate/gate.module.ts +47 -6
- package/os/gate/handlers/gate-probe-catalog.test.ts +1 -1
- package/os/gate/handlers/gate-probe-catalog.ts +413 -42
- package/os/gate/handlers/gate-probe-ratchet.test.ts +329 -0
- package/os/gate/handlers/gate-probe.test.ts +27 -5
- package/os/gate/handlers/gate-probe.ts +110 -12
- package/os/gate/handlers/liveness.ts +113 -0
- package/os/gate/handlers/probe-runs-journal.ts +167 -0
- package/os/gate-run/gate-run.module.ts +3 -0
- package/os/gate-run/index.ts +11 -0
- package/os/gate-run/record.ts +8 -1
- package/os/gate-run/status.ts +9 -1
- package/os/gate-run/tests/gate-run-record.test.ts +11 -1
- package/os/gate-run/tests/gate-run-status.test.ts +2 -0
- package/os/gate-run/types.ts +8 -0
- package/os/instructions/budget.test.ts +32 -7
- package/os/instructions/handlers/scar-migrate.ts +55 -66
- package/os/instructions/instructions.module.ts +32 -5
- package/os/knowledge/handlers/knowledge-authz-probe.ts +38 -12
- package/os/knowledge/handlers/knowledge-rebuild.test.ts +5 -2
- package/os/knowledge/handlers/knowledge-rebuild.ts +39 -16
- package/os/knowledge/knowledge.module.ts +21 -4
- package/os/mission/handlers/archive.test.ts +47 -30
- package/os/mission/lockfile.ts +47 -20
- package/os/naming/naming-convention.test.ts +1 -0
- package/os/naming/naming-convention.ts +2 -2
- package/os/program/discovery.ts +70 -44
- package/os/program/handlers/complete.ts +28 -10
- package/os/program/handlers/lease.ts +11 -2
- package/os/program/handlers/seal.ts +3 -3
- package/os/program/handlers/validate.ts +3 -3
- package/os/queue/handlers/queue-decision.ts +253 -0
- package/os/queue/handlers/queue-validate.ts +24 -23
- package/os/queue/manifest.ts +1 -2
- package/os/queue/queue-decision.test.ts +262 -0
- package/os/queue/queue.module.ts +93 -4
- package/os/rfc/frontmatter-io.ts +6 -3
- package/os/rfc/handlers/implement-stamp-origin.ts +6 -3
- package/os/rfc/handlers/implement-stamp.ts +65 -46
- package/os/rfc/handlers/index-graph.ts +14 -0
- package/os/rfc/handlers/rfc-evidence-sync.ts +62 -22
- package/os/rfc/handlers/validate-moves.test.ts +221 -0
- package/os/rfc/handlers/validate-probe-meta.test.ts +21 -1
- package/os/rfc/handlers/validate-rules.ts +216 -60
- package/os/rfc/handlers/validate.ts +1 -5
- package/os/rfc/next-id.ts +155 -21
- package/os/rfc/outcome-probe.ts +13 -4
- package/os/rfc/reachable-symbol.ts +65 -43
- package/os/rfc/rfc-0000-template.md +10 -0
- package/os/rfc/rfc.module.ts +26 -4
- package/os/rfc/types.ts +31 -3
- package/os/rfc/verification-evidence.ts +74 -25
- package/os/rfc/verification-origin.ts +358 -62
- package/os/rfc/verifier/rfc-1333/imp12-binding.acceptance.test.ts +1 -1
- package/os/rfc/verifier/rfc-1333/imp12-gate.acceptance.test.ts +1 -1
- package/os/rfc/verifier/rfc-1333/skills-and-types.acceptance.test.ts +1 -1
- package/os/rfc/verifier/rfc-1333/verify-workspace.acceptance.test.ts +1 -1
- package/os/rfc/verifier/rfc-1391/fixtures/no-report.proof.test.ts +1 -1
- package/os/rfc/verifier/rfc-1391/fixtures/small-domain.proof.test.ts +1 -1
- package/os/rfc/verifier/rfc-1391/support.ts +1 -1
- package/os/rfc/verify-workspace.ts +147 -53
- package/os/session/handlers/metrics-rfc.ts +42 -11
- package/os/session/handlers/save.ts +52 -28
- package/os/session/handlers/session-audit-detectors.test.ts +16 -6
- package/os/session/handlers/session-audit-report.test.ts +9 -3
- package/os/session/handlers/session-audit-report.ts +34 -8
- package/os/session/handlers/session-audit.test.ts +25 -7
- package/os/session/handlers/session-audit.ts +49 -23
- package/os/session/session.module.ts +31 -9
- package/os/system/handlers/system-outbox-scan.ts +45 -17
- package/os/system/handlers/system-task-dispatch.ts +17 -21
- package/os/system/handlers/system-versionset-record.ts +3 -3
- package/os/system/scenario-schemas.ts +1 -1
- package/os/system/system.module.ts +14 -9
- package/os/system/tests/scenario-pin-drift-check.test.ts +2 -0
- package/os/system/tests/scenario-validator-check.test.ts +2 -0
- package/os/system/tests/system-task-collect.test.ts +25 -15
- package/os/system/tests/system-task-dispatch.test.ts +18 -7
- package/os/system/tests/system-task-status.test.ts +7 -1
- package/os/system/tests/system-task.test.ts +15 -4
- package/os/system/tests/version-set-v2.test.ts +2 -0
- package/os/trajectory/handlers/extract-units.test.ts +11 -6
- package/os/trajectory/handlers/journal-io.ts +21 -7
- package/os/trajectory/handlers/outcome-record.test.ts +28 -8
- package/os/trajectory/handlers/outcome-record.ts +65 -18
- package/os/trajectory/handlers/producer-trust.test.ts +22 -8
- package/os/trajectory/handlers/trajectory-index.test.ts +75 -29
- package/os/trajectory/handlers/trajectory-index.ts +116 -38
- package/os/trajectory/handlers/trajectory-recall.test.ts +67 -19
- package/os/trajectory/handlers/trajectory-recall.ts +115 -41
- package/os/trajectory/handlers/trajectory.test.ts +19 -7
- package/os/trajectory/handlers/verdict-binding.test.ts +138 -33
- package/os/trajectory/trajectory.module.ts +35 -7
- package/os/yaml/scalars.test.ts +1 -1
- package/package.json +32 -2
- package/profiles/godot-game.yaml +4 -4
- package/skills/_shared/fo-pipeline-conventions.md +15 -13
- package/skills/fo/fo-handoff/SKILL.md +10 -2
- package/skills/fo/fo-idea-audit/SKILL.md +4 -0
- package/skills/fo/fo-idea-create-rfc/SKILL.md +21 -10
- package/skills/fo/fo-idea-implement/SKILL.md +2 -10
- package/skills/fo/fo-idea-plan/SKILL.md +7 -5
- package/skills/fo/fo-knowledge-distill/SKILL.md +15 -4
- package/skills/fo/fo-memory-sync/SKILL.md +7 -6
- package/skills/fo/fo-reproduce/SKILL.md +2 -1
- package/skills/fo/fo-session-retro/SKILL.md +87 -44
- package/skills/fo/fo-session-save/SKILL.md +4 -3
- package/skills/fo/fo-system-dispatch/SKILL.md +9 -0
- package/skills/meta/forge-bootstrap/SKILL.md +18 -12
- package/skills/shared/grilling/SKILL.md +17 -9
- package/skills/shared/knowledge/learned-principles.md +1 -1
- package/skills/shared/writing-great-skills/SKILL.md +4 -3
- package/src/adversarial/types.ts +100 -0
- package/src/authority/delegations.ts +9 -2
- package/src/command-modules.ts +6 -0
- package/src/config/forge-config.ts +146 -13
- package/src/correctness/policy-bundle.ts +187 -0
- package/src/knowledge/paths.ts +75 -0
- package/src/knowledge/sync.ts +42 -18
- package/src/migration-adapters/ignored-files.ts +64 -0
- package/src/migration-adapters/index.ts +19 -3
- package/src/migration-adapters/node-typescript-pnpm/index.ts +21 -5
- package/src/migration-adapters/phaser-pnpm/index.ts +21 -5
- package/src/migration-adapters/types.ts +36 -1
- package/src/onboarding/init.ts +20 -5
- package/src/onboarding/npm-token-check.ts +9 -1
- package/src/onboarding/scaffold-project.ts +16 -5
- package/src/onboarding/trust-boundary.test.ts +179 -0
- package/src/onboarding/trust-boundary.ts +825 -0
- package/src/onboarding/upgrade.ts +149 -9
- package/src/scaffold/github/CODEOWNERS.template +14 -0
- package/src/scaffold/github/forge-policy.template.yml +40 -0
- package/src/tests/bindings-schema.test.ts +5 -1
- package/src/tests/create.test.ts +74 -20
- package/src/tests/forge-config.test.ts +5 -2
- package/src/tests/knowledge-paths.test.ts +80 -0
- package/src/tests/migration-adapters.test.ts +73 -5
- package/src/tests/skill-validate.test.ts +76 -0
- package/src/types.ts +10 -5
- package/src/utils/verifier-git.ts +8684 -0
- package/src/validators/skill-validate.ts +17 -5
- /package/skills/fo/fo-memory-sync/{qa-log.md → qa-log/legacy.md} +0 -0
- /package/skills/fo/fo-session-save/{qa-log.md → qa-log/legacy.md} +0 -0
- /package/skills/shared/grilling/{qa-log.md → qa-log/legacy.md} +0 -0
|
@@ -0,0 +1,993 @@
|
|
|
1
|
+
/*
|
|
2
|
+
<MODULE_CONTRACT>
|
|
3
|
+
<purpose>
|
|
4
|
+
RFC-1616 acceptance probes — independent round-9 adversarial verification of
|
|
5
|
+
the external-verification trust boundary. Every probe FAILS while its
|
|
6
|
+
counterexample is live and PASSES once closed; numbering continues from
|
|
7
|
+
CX-110 (round 8 reported CX-103..CX-110 + two holds).
|
|
8
|
+
|
|
9
|
+
Round-9 attack surfaces (assumptions the r8 remediation left open):
|
|
10
|
+
- scanLooseObjects re-hashes only `.git/objects/<fanout>/` files — the
|
|
11
|
+
`objects/pack/` directory is never inspected. A session-crafted
|
|
12
|
+
pack-*.pack / pack-*.idx pair answers `cat-file`/`show`/`ls-tree` with
|
|
13
|
+
arbitrary inflated bytes for ANY sha the committed trees reference —
|
|
14
|
+
the same verbatim-forgery primitive as CX-104a, on the path the loose
|
|
15
|
+
scan cannot see. No git read re-hashes pack payloads (only the
|
|
16
|
+
`cat-file --batch` consumer in verification-origin re-hashes — the
|
|
17
|
+
single `run(["show", …])` consumers do not).
|
|
18
|
+
- The loose-object hash memo is keyed (path, mtimeMs, size) — a rewrite
|
|
19
|
+
that preserves both stat fields is never re-scanned, so bytes verified
|
|
20
|
+
once can be replaced wholesale (mtime precision is beatable by setting
|
|
21
|
+
the memoized timestamp to a whole millisecond first).
|
|
22
|
+
- The raw `execFile(gitEnvForCwd())` channels (verify-workspace run(),
|
|
23
|
+
implement-stamp execGit, rfc-evidence-sync, correctness audit gitGrep)
|
|
24
|
+
carry the scrubbed env but NO `-c` pins and no argv judgment — only
|
|
25
|
+
`createOriginGit`/`verifierGit` calls the surface preflight, and only
|
|
26
|
+
as a gate (non-refused config levers stay live on the origin channel).
|
|
27
|
+
`core.fsmonitor` therefore execs a session program inside
|
|
28
|
+
runRfcImplementStamp's `git status`; `exportTree`'s `spawn("tar")`
|
|
29
|
+
inherits ambient env outright (PATH shim); export-ignore/export-subst
|
|
30
|
+
attributes and `core.quotepath` reshape the "committed candidate"
|
|
31
|
+
export the clean-context verifier receives.
|
|
32
|
+
- `.git/index` is session-writable: an entry carrying the worktree
|
|
33
|
+
file's stat tuple but HEAD's blob sha makes `status`/`diff` report a
|
|
34
|
+
clean tree on dirty bytes — the gate's dirtiness verdict and
|
|
35
|
+
RFC-IMP-04 file-clean check are fabricated.
|
|
36
|
+
- The heredoc lexer arms on `<<` inside quoted strings (raw-line scan,
|
|
37
|
+
no quote context). A fake arm hides a REAL opener's lines as body —
|
|
38
|
+
a quoted `'<<A'` arm + `cat <<B` + `A` terminator + gate lines inside
|
|
39
|
+
B's real body → the judge counts invocations bash feeds to cat →
|
|
40
|
+
dead CI adopted (the CX-90 direction, new vector).
|
|
41
|
+
</purpose>
|
|
42
|
+
<non-goals>
|
|
43
|
+
<item>Not a contract source of truth — the boundary implementation owns behaviour.</item>
|
|
44
|
+
<item>Remote-side config on the operator's real remote, real-network MITM, /etc files — noted, not probed.</item>
|
|
45
|
+
</non-goals>
|
|
46
|
+
</MODULE_CONTRACT>
|
|
47
|
+
*/
|
|
48
|
+
|
|
49
|
+
import { execFileSync } from "node:child_process";
|
|
50
|
+
import {
|
|
51
|
+
chmodSync,
|
|
52
|
+
existsSync,
|
|
53
|
+
mkdirSync,
|
|
54
|
+
mkdtempSync,
|
|
55
|
+
readFileSync,
|
|
56
|
+
rmSync,
|
|
57
|
+
statSync,
|
|
58
|
+
utimesSync,
|
|
59
|
+
writeFileSync,
|
|
60
|
+
} from "node:fs";
|
|
61
|
+
import { createHash } from "node:crypto";
|
|
62
|
+
import { deflateSync } from "node:zlib";
|
|
63
|
+
import os from "node:os";
|
|
64
|
+
import path from "node:path";
|
|
65
|
+
|
|
66
|
+
import { afterEach, beforeAll, describe, expect, it } from "vitest";
|
|
67
|
+
|
|
68
|
+
import { ambientIo } from "../../../src/utils/io.ts";
|
|
69
|
+
import { scaffoldTrustBoundary } from "../../../src/onboarding/trust-boundary.ts";
|
|
70
|
+
import { verifierGit } from "../../../src/utils/verifier-git.ts";
|
|
71
|
+
import { gitEvidence } from "../../flow/git.ts";
|
|
72
|
+
import { createOriginGit } from "../../rfc/verification-origin.ts";
|
|
73
|
+
import { buildManifestReviewWorkspace } from "../../rfc/verify-workspace.ts";
|
|
74
|
+
import {
|
|
75
|
+
evaluateEvidenceReuse,
|
|
76
|
+
readCommittedEnvelope,
|
|
77
|
+
} from "../../rfc/handlers/rfc-evidence-sync.ts";
|
|
78
|
+
import { readAcceptanceReports, runRfcImplementStamp } from "../../rfc/handlers/implement-stamp.ts";
|
|
79
|
+
import { listWorkspaceFiles } from "../workspace.ts";
|
|
80
|
+
import { runPolicyDigest } from "../../core/handlers/policy-digest.ts";
|
|
81
|
+
import type { ForgeCommandInput, ForgeRuntimeContext } from "../../../src/types.ts";
|
|
82
|
+
|
|
83
|
+
const dirs: string[] = [];
|
|
84
|
+
afterEach(() => {
|
|
85
|
+
for (const d of dirs.splice(0)) rmSync(d, { recursive: true, force: true });
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
const CLEAN_PATH = (process.env["PATH"] ?? "")
|
|
89
|
+
.split(path.delimiter)
|
|
90
|
+
.filter((d) => d.length > 0 && !existsSync(path.join(d, "git-wrapper.sh")))
|
|
91
|
+
.join(path.delimiter);
|
|
92
|
+
beforeAll(() => {
|
|
93
|
+
process.env["PATH"] = CLEAN_PATH;
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
const gitIn = (root: string, args: string[], input?: string | Buffer) =>
|
|
97
|
+
execFileSync("git", args, {
|
|
98
|
+
cwd: root,
|
|
99
|
+
encoding: "utf8",
|
|
100
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
101
|
+
input,
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
function repo(prefix: string): string {
|
|
105
|
+
const root = mkdtempSync(path.join(os.tmpdir(), prefix));
|
|
106
|
+
dirs.push(root);
|
|
107
|
+
gitIn(root, ["init", "-q"]);
|
|
108
|
+
gitIn(root, ["config", "user.email", "t@t"]);
|
|
109
|
+
gitIn(root, ["config", "user.name", "t"]);
|
|
110
|
+
gitIn(root, ["config", "commit.gpgsign", "false"]);
|
|
111
|
+
return root;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const digestCtx = (root: string): ForgeRuntimeContext => ({
|
|
115
|
+
workspaceRoot: root,
|
|
116
|
+
logger: { section: () => {}, info: () => {}, warn: () => {}, error: () => {}, success: () => {} },
|
|
117
|
+
dryRun: false,
|
|
118
|
+
outputFormat: "json",
|
|
119
|
+
io: ambientIo,
|
|
120
|
+
});
|
|
121
|
+
const digestInp = (flags: Record<string, unknown>): ForgeCommandInput => ({
|
|
122
|
+
argv: [],
|
|
123
|
+
flags: flags as ForgeCommandInput["flags"],
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
const POLICY_YAML = `schema: forge/config@1
|
|
127
|
+
project:
|
|
128
|
+
name: demo
|
|
129
|
+
paths:
|
|
130
|
+
rfcsDir: docs/rfcs
|
|
131
|
+
policy:
|
|
132
|
+
mutable: [project]
|
|
133
|
+
additive: [bindings]
|
|
134
|
+
freezeFiles:
|
|
135
|
+
- "hooks/**"
|
|
136
|
+
agentTools:
|
|
137
|
+
deny: [deploy]
|
|
138
|
+
`;
|
|
139
|
+
|
|
140
|
+
function policyRepo(): string {
|
|
141
|
+
const root = repo("cx9-policy-");
|
|
142
|
+
writeFileSync(path.join(root, "forge.yaml"), POLICY_YAML);
|
|
143
|
+
mkdirSync(path.join(root, "hooks"), { recursive: true });
|
|
144
|
+
writeFileSync(path.join(root, "hooks", "pre-commit.sh"), "#!/bin/sh\nexit 0\n");
|
|
145
|
+
gitIn(root, ["add", "-A"]);
|
|
146
|
+
gitIn(root, ["commit", "-qm", "seed"]);
|
|
147
|
+
return root;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// ─── pack forgery primitives ───────────────────────────────────────────────
|
|
151
|
+
|
|
152
|
+
const CRC_TABLE = (() => {
|
|
153
|
+
const t = new Uint32Array(256);
|
|
154
|
+
for (let n = 0; n < 256; n++) {
|
|
155
|
+
let c = n;
|
|
156
|
+
for (let k = 0; k < 8; k++) c = c & 1 ? 0xedb88320 ^ (c >>> 1) : c >>> 1;
|
|
157
|
+
t[n] = c >>> 0;
|
|
158
|
+
}
|
|
159
|
+
return t;
|
|
160
|
+
})();
|
|
161
|
+
function crc32(buf: Buffer): number {
|
|
162
|
+
let c = 0xffffffff;
|
|
163
|
+
for (const b of buf) c = CRC_TABLE[(c ^ b) & 0xff]! ^ (c >>> 8);
|
|
164
|
+
return (c ^ 0xffffffff) >>> 0;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/** git pack object header: (type<<4 | size&15) then 7-bit size groups. */
|
|
168
|
+
function packObjHeader(type: number, size: number): Buffer {
|
|
169
|
+
const out = [(type << 4) | (size & 0x0f)];
|
|
170
|
+
size = Math.floor(size / 16);
|
|
171
|
+
while (size) {
|
|
172
|
+
out[out.length - 1]! |= 0x80;
|
|
173
|
+
out.push(size & 0x7f);
|
|
174
|
+
size = Math.floor(size / 128);
|
|
175
|
+
}
|
|
176
|
+
return Buffer.from(out);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Write `.git/objects/pack/pack-<n>.{pack,idx}` carrying `entries`
|
|
181
|
+
* (sha → {type, content}) — git serves these bytes by sha on every read
|
|
182
|
+
* path with no re-hash, and no boundary surface check looks at packs.
|
|
183
|
+
*/
|
|
184
|
+
function forgePack(
|
|
185
|
+
root: string,
|
|
186
|
+
entries: Array<{ sha: string; type: 1 | 2 | 3 | 4; content: Buffer }>,
|
|
187
|
+
): void {
|
|
188
|
+
const sorted = [...entries].sort((a, b) => (a.sha < b.sha ? -1 : 1));
|
|
189
|
+
const bodies = sorted.map((e) =>
|
|
190
|
+
Buffer.concat([packObjHeader(e.type, e.content.length), deflateSync(e.content)]),
|
|
191
|
+
);
|
|
192
|
+
const offsets = bodies.reduce<number[]>((acc, b, i) => {
|
|
193
|
+
acc.push(i === 0 ? 12 : acc[i - 1]! + bodies[i - 1]!.length);
|
|
194
|
+
return acc;
|
|
195
|
+
}, []);
|
|
196
|
+
let pack = Buffer.concat([
|
|
197
|
+
Buffer.from("PACK"),
|
|
198
|
+
Buffer.from([0, 0, 0, 2, 0, 0, 0, sorted.length]),
|
|
199
|
+
...bodies,
|
|
200
|
+
]);
|
|
201
|
+
const packSha = createHash("sha1").update(pack).digest();
|
|
202
|
+
pack = Buffer.concat([pack, packSha]);
|
|
203
|
+
|
|
204
|
+
const fanout = new Array<number>(256).fill(0);
|
|
205
|
+
for (const e of sorted)
|
|
206
|
+
for (let i = e.sha ? parseInt(e.sha.slice(0, 2), 16) : 0; i < 256; i++) fanout[i]++;
|
|
207
|
+
const idxBody = Buffer.concat([
|
|
208
|
+
Buffer.from([0xff, 0x74, 0x4f, 0x63, 0, 0, 0, 2]),
|
|
209
|
+
Buffer.from(
|
|
210
|
+
fanout.flatMap((n) => [(n >>> 24) & 255, (n >>> 16) & 255, (n >>> 8) & 255, n & 255]),
|
|
211
|
+
),
|
|
212
|
+
...sorted.map((e) => Buffer.from(e.sha, "hex")),
|
|
213
|
+
...bodies.map((b) => {
|
|
214
|
+
const u = Buffer.alloc(4);
|
|
215
|
+
u.writeUInt32BE(crc32(b));
|
|
216
|
+
return u;
|
|
217
|
+
}),
|
|
218
|
+
...offsets.map((o) => {
|
|
219
|
+
const u = Buffer.alloc(4);
|
|
220
|
+
u.writeUInt32BE(o);
|
|
221
|
+
return u;
|
|
222
|
+
}),
|
|
223
|
+
packSha,
|
|
224
|
+
]);
|
|
225
|
+
const idx = Buffer.concat([idxBody, createHash("sha1").update(idxBody).digest()]);
|
|
226
|
+
|
|
227
|
+
const pdir = path.join(root, ".git/objects/pack");
|
|
228
|
+
mkdirSync(pdir, { recursive: true });
|
|
229
|
+
const name = `pack-${"f".repeat(8)}${createHash("sha1").update(pack).digest("hex").slice(0, 8)}`;
|
|
230
|
+
writeFileSync(path.join(pdir, `${name}.pack`), pack);
|
|
231
|
+
writeFileSync(path.join(pdir, `${name}.idx`), idx);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/** `git mktree --missing` — a tree referencing object names that need not exist. */
|
|
235
|
+
function mkTree(root: string, lines: string): string {
|
|
236
|
+
return gitIn(root, ["mktree", "--missing"], lines).trim();
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
// ─── workflow adoption plumbing (mirrors the r8 file) ──────────────────────
|
|
240
|
+
|
|
241
|
+
const adoptedWorkflow = (body: string): boolean => {
|
|
242
|
+
const root = mkdtempSync(path.join(os.tmpdir(), "cx9-scaffold-"));
|
|
243
|
+
dirs.push(root);
|
|
244
|
+
const rel = ".github/workflows/forge-policy.yml";
|
|
245
|
+
const p = path.join(root, rel);
|
|
246
|
+
mkdirSync(path.dirname(p), { recursive: true });
|
|
247
|
+
writeFileSync(p, body);
|
|
248
|
+
return scaffoldTrustBoundary(root, "@operator").skipped.some((s) => s.includes(rel));
|
|
249
|
+
};
|
|
250
|
+
|
|
251
|
+
const WORKFLOW_HEAD = `name: forge-policy
|
|
252
|
+
on: [push, pull_request]
|
|
253
|
+
jobs:
|
|
254
|
+
policy-surface:
|
|
255
|
+
runs-on: ubuntu-latest
|
|
256
|
+
steps:
|
|
257
|
+
`;
|
|
258
|
+
|
|
259
|
+
const workflowWithRun = (run: string): string =>
|
|
260
|
+
`${WORKFLOW_HEAD} - run: |\n${run
|
|
261
|
+
.split("\n")
|
|
262
|
+
.map((l) => ` ${l}`)
|
|
263
|
+
.join("\n")}\n`;
|
|
264
|
+
|
|
265
|
+
// ===========================================================================
|
|
266
|
+
// CX-113 — the pack store is never scanned: forged pack+idx answers every
|
|
267
|
+
// committed-object read with session bytes (CX-104a's surviving twin)
|
|
268
|
+
// ===========================================================================
|
|
269
|
+
|
|
270
|
+
describe("RFC-1616 r9 — pack-carried objects are unverified", () => {
|
|
271
|
+
it(
|
|
272
|
+
"CX-113: a session-written pack+idx serves fabricated bytes for a sha only committed trees reference — `show <c>:forge.yaml` on the evidence and origin channels returns forged content, and policy.digest --verify --base <c> skips the attestation trailer check because baseDigest == current sha256",
|
|
273
|
+
{ timeout: 120_000 },
|
|
274
|
+
async () => {
|
|
275
|
+
const root = policyRepo();
|
|
276
|
+
const base = gitIn(root, ["rev-parse", "HEAD"]).trim();
|
|
277
|
+
// Advance the policy surface without the attestation trailer (control
|
|
278
|
+
// must fail).
|
|
279
|
+
writeFileSync(
|
|
280
|
+
path.join(root, "forge.yaml"),
|
|
281
|
+
POLICY_YAML.replace("deny: [deploy]", "deny: []"),
|
|
282
|
+
);
|
|
283
|
+
gitIn(root, ["commit", "-qam", "weaken the deny list"]);
|
|
284
|
+
await runPolicyDigest(digestInp({ write: true }), digestCtx(root));
|
|
285
|
+
gitIn(root, ["add", ".forge/policy.digest"]);
|
|
286
|
+
gitIn(root, ["commit", "-qm", "regenerate digest — no trailer"]);
|
|
287
|
+
const head = gitIn(root, ["rev-parse", "HEAD"]).trim();
|
|
288
|
+
const honest = await runPolicyDigest(digestInp({ verify: true, base }), digestCtx(root));
|
|
289
|
+
expect(
|
|
290
|
+
honest.exitCode !== 0,
|
|
291
|
+
"control: unattested advance must still fail against the real base",
|
|
292
|
+
).toBe(true);
|
|
293
|
+
|
|
294
|
+
// Fabricated blob name — a sha nothing contains until the pack does.
|
|
295
|
+
const BF = `deadbee${"f".repeat(33)}`;
|
|
296
|
+
// Fake base: HEAD's tree with forge.yaml pointing at BF — every other
|
|
297
|
+
// surface file keeps its real sha so baseDigest's file list matches.
|
|
298
|
+
const treeLines = gitIn(root, ["ls-tree", "HEAD"])
|
|
299
|
+
.split("\n")
|
|
300
|
+
.filter((l) => l.length > 0)
|
|
301
|
+
.map((l) => (l.endsWith("\tforge.yaml") ? `100644 blob ${BF}\tforge.yaml` : l))
|
|
302
|
+
.join("\n");
|
|
303
|
+
const tFake = mkTree(root, `${treeLines}\n`);
|
|
304
|
+
const cFake = gitIn(root, ["commit-tree", tFake, "-p", base, "-m", "fake base"]).trim();
|
|
305
|
+
// Rebuild the two tip commits on top of the fake base so it is an
|
|
306
|
+
// ancestor of HEAD.
|
|
307
|
+
const c2 = gitIn(root, ["rev-parse", "HEAD~1"]).trim();
|
|
308
|
+
const c2p = gitIn(root, [
|
|
309
|
+
"commit-tree",
|
|
310
|
+
gitIn(root, ["rev-parse", `${c2}^{tree}`]).trim(),
|
|
311
|
+
"-p",
|
|
312
|
+
cFake,
|
|
313
|
+
"-m",
|
|
314
|
+
"c2",
|
|
315
|
+
]).trim();
|
|
316
|
+
const c3p = gitIn(root, [
|
|
317
|
+
"commit-tree",
|
|
318
|
+
gitIn(root, ["rev-parse", `${head}^{tree}`]).trim(),
|
|
319
|
+
"-p",
|
|
320
|
+
c2p,
|
|
321
|
+
"-m",
|
|
322
|
+
"c3",
|
|
323
|
+
]).trim();
|
|
324
|
+
gitIn(root, ["update-ref", "refs/heads/master", c3p]);
|
|
325
|
+
|
|
326
|
+
// Without the pack, the fabricated blob is simply missing — the read
|
|
327
|
+
// fails closed (control for the A/B).
|
|
328
|
+
let missing = "";
|
|
329
|
+
try {
|
|
330
|
+
gitIn(root, ["cat-file", "-p", BF]);
|
|
331
|
+
} catch (e) {
|
|
332
|
+
missing = String(e);
|
|
333
|
+
}
|
|
334
|
+
expect(missing.length > 0).toBe(true);
|
|
335
|
+
const unfed = await runPolicyDigest(
|
|
336
|
+
digestInp({ verify: true, base: cFake }),
|
|
337
|
+
digestCtx(root),
|
|
338
|
+
);
|
|
339
|
+
expect(unfed.exitCode !== 0, "control: a dangling blob sha must fail the base read").toBe(
|
|
340
|
+
true,
|
|
341
|
+
);
|
|
342
|
+
|
|
343
|
+
// The session drops a pack+idx answering BF with the CURRENT yaml —
|
|
344
|
+
// objects/pack is outside scanLooseObjects' fanout sweep.
|
|
345
|
+
forgePack(root, [
|
|
346
|
+
{
|
|
347
|
+
sha: BF,
|
|
348
|
+
type: 3,
|
|
349
|
+
content: Buffer.from(POLICY_YAML.replace("deny: [deploy]", "deny: []")),
|
|
350
|
+
},
|
|
351
|
+
]);
|
|
352
|
+
// Premise: raw git serves the pack bytes for the fabricated sha.
|
|
353
|
+
expect(gitIn(root, ["cat-file", "-p", BF])).toBe(
|
|
354
|
+
POLICY_YAML.replace("deny: [deploy]", "deny: []"),
|
|
355
|
+
);
|
|
356
|
+
// The evidence channel and the origin channel serve the same forgery.
|
|
357
|
+
const ev = await gitEvidence(root, ["show", `${cFake}:forge.yaml`]);
|
|
358
|
+
const og = await createOriginGit(root).run(["show", `${cFake}:forge.yaml`]);
|
|
359
|
+
const forged = await runPolicyDigest(
|
|
360
|
+
digestInp({ verify: true, base: cFake }),
|
|
361
|
+
digestCtx(root),
|
|
362
|
+
);
|
|
363
|
+
expect(
|
|
364
|
+
forged.exitCode !== 0 || ev.stdout !== POLICY_YAML.replace("deny: [deploy]", "deny: []"),
|
|
365
|
+
`a forged pack answered the anchored base — verify=${forged.data?.status} ` +
|
|
366
|
+
`violations=${JSON.stringify(forged.data?.violations)} ` +
|
|
367
|
+
`evidence=${JSON.stringify(ev.stdout.slice(0, 60))} origin=${JSON.stringify((og ?? "").slice(0, 60))}`,
|
|
368
|
+
).toBe(true);
|
|
369
|
+
},
|
|
370
|
+
);
|
|
371
|
+
});
|
|
372
|
+
|
|
373
|
+
// ===========================================================================
|
|
374
|
+
// CX-114 — same-stat rewrite slips the loose-object hash memo
|
|
375
|
+
// ===========================================================================
|
|
376
|
+
|
|
377
|
+
describe("RFC-1616 r9 — loose-object memo trusts (mtimeMs, size)", () => {
|
|
378
|
+
it(
|
|
379
|
+
"CX-114: rewriting a scanned loose object in place with an equal-size payload and the memoized mtime makes the next evidence read serve the forged bytes — the memo's (path, mtimeMs, size) key is the only integrity check, and both fields are session-forgeable",
|
|
380
|
+
{ timeout: 60_000 },
|
|
381
|
+
async () => {
|
|
382
|
+
const root = repo("cx9-memo-");
|
|
383
|
+
const real = Buffer.from("a".repeat(4000));
|
|
384
|
+
const sha = gitIn(root, ["hash-object", "-w", "--stdin", "-t", "blob"], real).trim();
|
|
385
|
+
const objPath = path.join(root, ".git/objects", sha.slice(0, 2), sha.slice(2));
|
|
386
|
+
chmodSync(objPath, 0o644);
|
|
387
|
+
// Pin the memo tuple to a whole millisecond so it is exactly restorable.
|
|
388
|
+
const stamp = new Date(1_700_000_000_000);
|
|
389
|
+
utimesSync(objPath, stamp, stamp);
|
|
390
|
+
const st0 = statSync(objPath);
|
|
391
|
+
|
|
392
|
+
// First evidence read — preflight scans, hashes real bytes, memoizes.
|
|
393
|
+
const first = await gitEvidence(root, ["cat-file", "-p", sha]);
|
|
394
|
+
expect(first.exitCode).toBe(0);
|
|
395
|
+
expect(first.stdout).toBe(real.toString());
|
|
396
|
+
|
|
397
|
+
// Forge: any body whose deflated loose-object byte size equals the
|
|
398
|
+
// original — vary the body length; a uniform run makes the search
|
|
399
|
+
// deterministic.
|
|
400
|
+
let forged: Buffer | null = null;
|
|
401
|
+
for (let m = real.length - 2000; m <= real.length + 2000; m++) {
|
|
402
|
+
const body = Buffer.concat([
|
|
403
|
+
Buffer.from("FORGED-BYTES-EVIDENCE\n"),
|
|
404
|
+
Buffer.from("b".repeat(Math.max(0, m - 22))),
|
|
405
|
+
]).subarray(0, m);
|
|
406
|
+
if (body.length !== m) continue;
|
|
407
|
+
const f = deflateSync(Buffer.concat([Buffer.from(`blob ${body.length}\0`), body]));
|
|
408
|
+
if (f.length === st0.size) {
|
|
409
|
+
forged = Buffer.concat([Buffer.from(`blob ${body.length}\0`), body]);
|
|
410
|
+
break;
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
expect(forged, "could not build an equal-size forged payload").not.toBeNull();
|
|
414
|
+
chmodSync(objPath, 0o644);
|
|
415
|
+
writeFileSync(objPath, deflateSync(forged!));
|
|
416
|
+
utimesSync(objPath, stamp, stamp);
|
|
417
|
+
const st1 = statSync(objPath);
|
|
418
|
+
expect(st1.mtimeMs).toBe(st0.mtimeMs);
|
|
419
|
+
expect(st1.size).toBe(st0.size);
|
|
420
|
+
|
|
421
|
+
// Second evidence read — the memo matches, so no re-hash runs and
|
|
422
|
+
// git inflates the forged payload verbatim.
|
|
423
|
+
const second = await gitEvidence(root, ["cat-file", "-p", sha]);
|
|
424
|
+
const served = second.stdout;
|
|
425
|
+
const forgedBody = forged!.subarray(forged!.indexOf(0) + 1).toString();
|
|
426
|
+
expect(
|
|
427
|
+
second.exitCode !== 0 || served !== forgedBody,
|
|
428
|
+
`the memo let a same-stat rewrite serve forged bytes (exit=${second.exitCode}, out=${JSON.stringify(served.slice(0, 40))})`,
|
|
429
|
+
).toBe(true);
|
|
430
|
+
},
|
|
431
|
+
);
|
|
432
|
+
});
|
|
433
|
+
|
|
434
|
+
// ===========================================================================
|
|
435
|
+
// CX-115 — unpinned `core.fsmonitor` execs inside the stamp channel's
|
|
436
|
+
// `git status` (execGit carries gitEnvForCwd only — no `-c` pins, no preflight)
|
|
437
|
+
// ===========================================================================
|
|
438
|
+
|
|
439
|
+
describe("RFC-1616 r9 — raw gitEnvForCwd channels honor config programs", () => {
|
|
440
|
+
it(
|
|
441
|
+
"CX-115: `core.fsmonitor=<session program>` executes inside runRfcImplementStamp's `git status --porcelain` — execGit runs with the scrubbed env but no evidenceConfigArgs pins and no evidenceRepoPreflight, so a refused-on-evidence lever fires on the trusted stamp path",
|
|
442
|
+
{ timeout: 90_000 },
|
|
443
|
+
async () => {
|
|
444
|
+
const root = repo("cx9-fsm-");
|
|
445
|
+
const marker = path.join(root, ".fsm-marker");
|
|
446
|
+
const hook = path.join(root, "fsm.sh");
|
|
447
|
+
writeFileSync(
|
|
448
|
+
hook,
|
|
449
|
+
`#!/bin/sh\necho EXEC-FSMONITOR > ${JSON.stringify(marker).slice(1, -1)}\nexit 0\n`,
|
|
450
|
+
);
|
|
451
|
+
chmodSync(hook, 0o755);
|
|
452
|
+
gitIn(root, ["config", "core.fsmonitor", hook]);
|
|
453
|
+
// The stamp's own evidence channel would refuse this config — prove it.
|
|
454
|
+
const refused = await verifierGit(root, ["status", "--porcelain"]);
|
|
455
|
+
expect(
|
|
456
|
+
refused.exitCode !== 0,
|
|
457
|
+
"control: the pinned evidence channel must refuse the fsmonitor lever",
|
|
458
|
+
).toBe(true);
|
|
459
|
+
expect(existsSync(marker)).toBe(false);
|
|
460
|
+
|
|
461
|
+
// Minimal stamping fixture: an accepted RFC plus an implementation-
|
|
462
|
+
// shaped commit naming it, so the handler reaches isRfcFileClean.
|
|
463
|
+
mkdirSync(path.join(root, "docs/rfcs"), { recursive: true });
|
|
464
|
+
writeFileSync(
|
|
465
|
+
path.join(root, "docs/rfcs/rfc-9001-poc.md"),
|
|
466
|
+
"---\nid: RFC-9001\ntitle: poc\nstatus: accepted\n---\n\n# RFC-9001\n",
|
|
467
|
+
);
|
|
468
|
+
gitIn(root, ["add", "-A"]);
|
|
469
|
+
gitIn(root, ["commit", "-qm", "implement: RFC-9001 poc"]);
|
|
470
|
+
// `git add`/`git commit` invoke the fsmonitor hook themselves (worktree
|
|
471
|
+
// scan) — the marker they leave is fixture noise, not the stamp's read.
|
|
472
|
+
// Clear it so the assertion isolates git spawns inside the stamp.
|
|
473
|
+
rmSync(marker, { force: true });
|
|
474
|
+
|
|
475
|
+
await runRfcImplementStamp(digestInp({ id: "RFC-9001" }), digestCtx(root));
|
|
476
|
+
expect(
|
|
477
|
+
!existsSync(marker),
|
|
478
|
+
"the session's fsmonitor program executed inside the stamp's git status",
|
|
479
|
+
).toBe(true);
|
|
480
|
+
},
|
|
481
|
+
);
|
|
482
|
+
});
|
|
483
|
+
|
|
484
|
+
// ===========================================================================
|
|
485
|
+
// CX-116/117 — the clean-context export channel: ambient `tar` exec and
|
|
486
|
+
// committed `.gitattributes` divergence
|
|
487
|
+
// ===========================================================================
|
|
488
|
+
|
|
489
|
+
describe("RFC-1616 r9 — rfc.verify.workspace export channel", () => {
|
|
490
|
+
const manifestExport = async (root: string, out: string) =>
|
|
491
|
+
buildManifestReviewWorkspace({ workspaceRoot: root, candidateSha: "HEAD", outDir: out });
|
|
492
|
+
|
|
493
|
+
it(
|
|
494
|
+
'CX-116: `spawn("tar", ["-x","-f","-"], {cwd: out})` in exportTree carries NO env — the ambient PATH resolves tar, so a session PATH shim executes inside the export and fabricates the extracted candidate tree',
|
|
495
|
+
{ timeout: 90_000 },
|
|
496
|
+
async () => {
|
|
497
|
+
const root = repo("cx9-tar-");
|
|
498
|
+
writeFileSync(path.join(root, "a.txt"), "real\n");
|
|
499
|
+
gitIn(root, ["add", "-A"]);
|
|
500
|
+
gitIn(root, ["commit", "-qm", "seed"]);
|
|
501
|
+
|
|
502
|
+
const shimDir = mkdtempSync(path.join(os.tmpdir(), "cx9-shim-"));
|
|
503
|
+
dirs.push(shimDir);
|
|
504
|
+
const marker = path.join(shimDir, "tar-marker");
|
|
505
|
+
writeFileSync(
|
|
506
|
+
path.join(shimDir, "tar"),
|
|
507
|
+
`#!/bin/sh\necho TAR-SHIM-EXEC > "${marker}"\ncat > /dev/null\necho shim-planted > "${shimDir}/../planted.txt"\nexit 0\n`,
|
|
508
|
+
);
|
|
509
|
+
chmodSync(path.join(shimDir, "tar"), 0o755);
|
|
510
|
+
|
|
511
|
+
const out = path.join(root, "..", `cx9-out-${Date.now()}`);
|
|
512
|
+
const prevPath = process.env["PATH"];
|
|
513
|
+
process.env["PATH"] = `${shimDir}${path.delimiter}${prevPath}`;
|
|
514
|
+
let res;
|
|
515
|
+
try {
|
|
516
|
+
res = await manifestExport(root, out);
|
|
517
|
+
} finally {
|
|
518
|
+
process.env["PATH"] = prevPath;
|
|
519
|
+
}
|
|
520
|
+
expect(
|
|
521
|
+
!existsSync(marker),
|
|
522
|
+
`ambient-PATH tar shim executed inside the export (status=${res?.status})`,
|
|
523
|
+
).toBe(true);
|
|
524
|
+
},
|
|
525
|
+
);
|
|
526
|
+
|
|
527
|
+
it(
|
|
528
|
+
"CX-117: committed `.gitattributes` export-ignore/export-subst silently reshape the exported candidate — a tracked file vanishes from the 'export of <sha>' the clean-context verifier reviews, and export-subst bytes differ from committed bytes",
|
|
529
|
+
{ timeout: 90_000 },
|
|
530
|
+
async () => {
|
|
531
|
+
const root = repo("cx9-attrs-");
|
|
532
|
+
writeFileSync(path.join(root, "secret.ts"), "export const secret = 1;\n");
|
|
533
|
+
writeFileSync(path.join(root, "x.ts"), "// $Format:%H$\n");
|
|
534
|
+
writeFileSync(
|
|
535
|
+
path.join(root, ".gitattributes"),
|
|
536
|
+
"secret.ts export-ignore\nx.ts export-subst\n",
|
|
537
|
+
);
|
|
538
|
+
gitIn(root, ["add", "-A"]);
|
|
539
|
+
gitIn(root, ["commit", "-qm", "attrs"]);
|
|
540
|
+
|
|
541
|
+
const out = path.join(root, "..", `cx9-out-${Date.now()}`);
|
|
542
|
+
const res = await manifestExport(root, out);
|
|
543
|
+
expect(res.status).toBe("pass");
|
|
544
|
+
const committedSecret = gitIn(root, ["show", "HEAD:secret.ts"]);
|
|
545
|
+
const exportedX = existsSync(path.join(out, "x.ts"))
|
|
546
|
+
? readFileSync(path.join(out, "x.ts"), "utf8")
|
|
547
|
+
: "";
|
|
548
|
+
const committedX = gitIn(root, ["show", "HEAD:x.ts"]);
|
|
549
|
+
expect(
|
|
550
|
+
existsSync(path.join(out, "secret.ts")) && exportedX === committedX,
|
|
551
|
+
`export diverged from committed bytes: secret.ts exported=${existsSync(path.join(out, "secret.ts"))} (committed=${JSON.stringify(committedSecret.slice(0, 30))}), x.ts=${JSON.stringify(exportedX.slice(0, 60))} vs committed ${JSON.stringify(committedX.slice(0, 60))}`,
|
|
552
|
+
).toBe(true);
|
|
553
|
+
},
|
|
554
|
+
);
|
|
555
|
+
});
|
|
556
|
+
|
|
557
|
+
// ===========================================================================
|
|
558
|
+
// CX-118 — `.git/objects/info/alternates` is honored on the raw channels:
|
|
559
|
+
// the shape-file refusal never reaches execGit/gitEnvForCwd consumers, so a
|
|
560
|
+
// foreign object store injects fabricated committed bytes (probed dead end:
|
|
561
|
+
// core.quotepath=false cannot split --name-only lines — git C-quotes control
|
|
562
|
+
// bytes unconditionally, so the newline-name phantom path is closed)
|
|
563
|
+
// ===========================================================================
|
|
564
|
+
|
|
565
|
+
describe("RFC-1616 r9 — alternates on unpreflighted channels", () => {
|
|
566
|
+
it(
|
|
567
|
+
"CX-118: `.git/objects/info/alternates` (a refused shape violation on every gated channel) is honored on the raw execGit/gitEnvForCwd channels — `git update-index --cacheinfo` stages a tree entry whose blob sha lives only in a session foreign store, and `readAcceptanceReports` parses the forged committed bytes as acceptance evidence",
|
|
568
|
+
{ timeout: 90_000 },
|
|
569
|
+
async () => {
|
|
570
|
+
const root = repo("cx9-alt-");
|
|
571
|
+
writeFileSync(path.join(root, "a.txt"), "x\n");
|
|
572
|
+
gitIn(root, ["add", "-A"]);
|
|
573
|
+
gitIn(root, ["commit", "-qm", "seed"]);
|
|
574
|
+
|
|
575
|
+
// Foreign objects dir carrying a fabricated blob under a chosen sha.
|
|
576
|
+
const BF = `deadbee${"2".repeat(33)}`;
|
|
577
|
+
const foreign = mkdtempSync(path.join(os.tmpdir(), "cx9-foreign-objs-"));
|
|
578
|
+
dirs.push(foreign);
|
|
579
|
+
const report = "---\nverdict: pass\nsentinel: ALTERNATES-FORGED-REPORT\n---\n\nbody\n";
|
|
580
|
+
mkdirSync(path.join(foreign, BF.slice(0, 2)), { recursive: true });
|
|
581
|
+
writeFileSync(
|
|
582
|
+
path.join(foreign, BF.slice(0, 2), BF.slice(2)),
|
|
583
|
+
deflateSync(Buffer.concat([Buffer.from(`blob ${report.length}\0`), Buffer.from(report)])),
|
|
584
|
+
);
|
|
585
|
+
// The shape violation the gated channel refuses on.
|
|
586
|
+
mkdirSync(path.join(root, ".git/objects/info"), { recursive: true });
|
|
587
|
+
writeFileSync(path.join(root, ".git/objects/info/alternates"), `${foreign}\n`);
|
|
588
|
+
// Stage a report path whose committed blob is BF — cacheinfo trusts
|
|
589
|
+
// the sha without existence checks.
|
|
590
|
+
const rel = "docs/reviews/acceptance/rfc-9001/fake.md";
|
|
591
|
+
gitIn(root, ["update-index", "--add", "--cacheinfo", `100644,${BF},${rel}`]);
|
|
592
|
+
gitIn(root, ["commit", "-qm", "report"]);
|
|
593
|
+
// Premise: raw git resolves BF through the alternates injection.
|
|
594
|
+
expect(gitIn(root, ["show", `HEAD:${rel}`])).toBe(report);
|
|
595
|
+
|
|
596
|
+
// The gated channel refuses the shape violation.
|
|
597
|
+
const gated = await verifierGit(root, ["show", `HEAD:${rel}`]);
|
|
598
|
+
expect(
|
|
599
|
+
gated.exitCode !== 0 && gated.stderr.startsWith("EVIDENCE-REFUSED"),
|
|
600
|
+
"control: the evidence channel must refuse alternates",
|
|
601
|
+
).toBe(true);
|
|
602
|
+
|
|
603
|
+
// The raw stamp channel serves the forged committed bytes anyway.
|
|
604
|
+
const reports = await readAcceptanceReports(root, "RFC-9001");
|
|
605
|
+
const forged = reports.find((r) => r.frontmatter["sentinel"] === "ALTERNATES-FORGED-REPORT");
|
|
606
|
+
expect(
|
|
607
|
+
forged === undefined,
|
|
608
|
+
`alternates injected a fabricated committed report (got ${JSON.stringify(reports)})`,
|
|
609
|
+
).toBe(true);
|
|
610
|
+
},
|
|
611
|
+
);
|
|
612
|
+
});
|
|
613
|
+
|
|
614
|
+
// ===========================================================================
|
|
615
|
+
// CX-119 — a quoted `<<` false-arms the heredoc judge, hiding a real opener
|
|
616
|
+
// ===========================================================================
|
|
617
|
+
|
|
618
|
+
describe("RFC-1616 r9 — heredoc quote-armed false opener", () => {
|
|
619
|
+
it(
|
|
620
|
+
"CX-119: `echo '<<A x'` arms a heredoc bash never opens (the `<<` sits inside quotes); `cat <<B` then hides inside that fake body — a line `A` ends the fake arm and the gate commands inside B's REAL heredoc body are counted as invocations — dead CI is adopted",
|
|
621
|
+
{ timeout: 60_000 },
|
|
622
|
+
async () => {
|
|
623
|
+
const run = [
|
|
624
|
+
`echo '<<A x'`,
|
|
625
|
+
`cat <<B`,
|
|
626
|
+
`A`,
|
|
627
|
+
`forge correctness.gate --base HEAD~1`,
|
|
628
|
+
`forge policy.digest --verify`,
|
|
629
|
+
`forge pinned.validate`,
|
|
630
|
+
`B`,
|
|
631
|
+
].join("\n");
|
|
632
|
+
// Ground truth: run the block under real bash with a forge shim —
|
|
633
|
+
// every forge line is stdin to cat, never executed.
|
|
634
|
+
const scratch = mkdtempSync(path.join(os.tmpdir(), "cx9-bash-"));
|
|
635
|
+
dirs.push(scratch);
|
|
636
|
+
const marker = path.join(scratch, "forge-ran");
|
|
637
|
+
const binDir = path.join(scratch, "bin");
|
|
638
|
+
mkdirSync(binDir, { recursive: true });
|
|
639
|
+
writeFileSync(
|
|
640
|
+
path.join(binDir, "forge"),
|
|
641
|
+
`#!/bin/sh\necho FORGE-RAN > "${marker}"\nexit 0\n`,
|
|
642
|
+
);
|
|
643
|
+
chmodSync(path.join(binDir, "forge"), 0o755);
|
|
644
|
+
writeFileSync(path.join(scratch, "run.sh"), `${run}\n`);
|
|
645
|
+
const bashOut = execFileSync("bash", [path.join(scratch, "run.sh")], {
|
|
646
|
+
encoding: "utf8",
|
|
647
|
+
env: { ...process.env, PATH: `${binDir}${path.delimiter}${process.env["PATH"] ?? ""}` },
|
|
648
|
+
});
|
|
649
|
+
expect(
|
|
650
|
+
!existsSync(marker),
|
|
651
|
+
`control: bash must prove the forge lines never execute (stdout=${JSON.stringify(bashOut.slice(0, 120))})`,
|
|
652
|
+
).toBe(true);
|
|
653
|
+
|
|
654
|
+
// The judge counts them anyway — the workflow is adopted.
|
|
655
|
+
expect(
|
|
656
|
+
!adoptedWorkflow(workflowWithRun(run)),
|
|
657
|
+
"a quoted `<<` armed a fake heredoc that hid the real opener — dead CI adopted",
|
|
658
|
+
).toBe(true);
|
|
659
|
+
},
|
|
660
|
+
);
|
|
661
|
+
});
|
|
662
|
+
|
|
663
|
+
// ===========================================================================
|
|
664
|
+
// CX-120 — readCommittedEnvelope's raw `git show` serves the same pack
|
|
665
|
+
// forgery into the evidence-reuse judge → verification skipped on forged bytes
|
|
666
|
+
// ===========================================================================
|
|
667
|
+
|
|
668
|
+
describe("RFC-1616 r9 — committed-envelope reuse on forged bytes", () => {
|
|
669
|
+
it(
|
|
670
|
+
"CX-120: readCommittedEnvelope spawns `git show HEAD:<rel>` on a channel with no preflight, no pins and no re-hash — a pack-carried blob behind the committed envelope path feeds evaluateEvidenceReuse a fabricated `pass` envelope and the reuse verdict skips re-verification",
|
|
671
|
+
{ timeout: 90_000 },
|
|
672
|
+
async () => {
|
|
673
|
+
const root = repo("cx9-env-");
|
|
674
|
+
writeFileSync(path.join(root, "a.txt"), "x\n");
|
|
675
|
+
gitIn(root, ["add", "-A"]);
|
|
676
|
+
gitIn(root, ["commit", "-qm", "seed"]);
|
|
677
|
+
|
|
678
|
+
const BF = `deadbee${"1".repeat(33)}`;
|
|
679
|
+
const envelope = [
|
|
680
|
+
`rfcId: RFC-9001`,
|
|
681
|
+
`emittedAt: "${new Date().toISOString()}"`,
|
|
682
|
+
`acceptanceHash: "aaaa${"0".repeat(60)}"`,
|
|
683
|
+
`overall: pass`,
|
|
684
|
+
`resultsFrom: "${new Date().toISOString()}"`,
|
|
685
|
+
`probes:`,
|
|
686
|
+
` - probe: file-exists`,
|
|
687
|
+
` ok: true`,
|
|
688
|
+
`sentinel: PACK-FORGED-ENVELOPE`,
|
|
689
|
+
``,
|
|
690
|
+
].join("\n");
|
|
691
|
+
// Committed path docs/rfcs/verification/env.generated.yaml → BF.
|
|
692
|
+
const vt = mkTree(root, `100644 blob ${BF}\tenv.generated.yaml\n`);
|
|
693
|
+
const rt = mkTree(root, `040000 tree ${vt}\tverification\n`);
|
|
694
|
+
const dt = mkTree(root, `040000 tree ${rt}\trfcs\n`);
|
|
695
|
+
const tt = mkTree(
|
|
696
|
+
root,
|
|
697
|
+
`040000 tree ${dt}\tdocs\n100644 blob ${gitIn(root, ["rev-parse", "HEAD:a.txt"]).trim()}\ta.txt\n`,
|
|
698
|
+
);
|
|
699
|
+
const c = gitIn(root, ["commit-tree", tt, "-m", "envelope"]).trim();
|
|
700
|
+
gitIn(root, ["update-ref", "refs/heads/master", c]);
|
|
701
|
+
forgePack(root, [{ sha: BF, type: 3, content: Buffer.from(envelope) }]);
|
|
702
|
+
// Premise: git serves the forged envelope bytes.
|
|
703
|
+
expect(gitIn(root, ["show", "HEAD:docs/rfcs/verification/env.generated.yaml"])).toBe(
|
|
704
|
+
envelope,
|
|
705
|
+
);
|
|
706
|
+
|
|
707
|
+
const { envelope: env } = await readCommittedEnvelope(
|
|
708
|
+
root,
|
|
709
|
+
"docs/rfcs/verification/env.generated.yaml",
|
|
710
|
+
);
|
|
711
|
+
const verdict = evaluateEvidenceReuse({
|
|
712
|
+
committed: env ?? null,
|
|
713
|
+
acceptanceHashHex: `aaaa${"0".repeat(60)}`,
|
|
714
|
+
disabled: false,
|
|
715
|
+
});
|
|
716
|
+
expect(
|
|
717
|
+
!(env && verdict.reusable),
|
|
718
|
+
`a pack-forged envelope passed the reuse judge (verdict=${JSON.stringify(verdict)}, sentinel=${JSON.stringify((env as unknown as Record<string, unknown>)?.["sentinel"])})`,
|
|
719
|
+
).toBe(true);
|
|
720
|
+
},
|
|
721
|
+
);
|
|
722
|
+
});
|
|
723
|
+
|
|
724
|
+
// ===========================================================================
|
|
725
|
+
// CX-121 — `.git/index` stat-forgery: clean status on dirty bytes
|
|
726
|
+
// ===========================================================================
|
|
727
|
+
|
|
728
|
+
describe("RFC-1616 r9 — index stat cache is a fabrication store", () => {
|
|
729
|
+
it(
|
|
730
|
+
"CX-121: a hand-written `.git/index` entry carrying the worktree file's live stat tuple but HEAD's blob sha makes `status --porcelain` answer clean on modified content — the gate's CORR-GATE-01 dirtiness read and isRfcFileClean's RFC-clean check are fabricated",
|
|
731
|
+
{ timeout: 60_000 },
|
|
732
|
+
async () => {
|
|
733
|
+
const root = repo("cx9-idx-");
|
|
734
|
+
writeFileSync(path.join(root, "a.txt"), "good\n");
|
|
735
|
+
gitIn(root, ["add", "-A"]);
|
|
736
|
+
gitIn(root, ["commit", "-qm", "seed"]);
|
|
737
|
+
// Same-size dirty edit so every stat field still matches.
|
|
738
|
+
writeFileSync(path.join(root, "a.txt"), "evil\n");
|
|
739
|
+
// Racy-clean defeat: the file's mtime must be strictly OLDER than the
|
|
740
|
+
// .git/index write that follows, else git re-hashes and sees the dirt.
|
|
741
|
+
const past = new Date(Date.now() - 60_000);
|
|
742
|
+
utimesSync(path.join(root, "a.txt"), past, past);
|
|
743
|
+
|
|
744
|
+
const st = statSync(path.join(root, "a.txt"), { bigint: true });
|
|
745
|
+
const headBlob = gitIn(root, ["rev-parse", "HEAD:a.txt"]).trim();
|
|
746
|
+
const name = Buffer.from("a.txt");
|
|
747
|
+
const entry = Buffer.alloc(40);
|
|
748
|
+
const wr = (v: bigint | number, o: number) =>
|
|
749
|
+
entry.writeUInt32BE(Number(BigInt(v) & 0xffffffffn), o);
|
|
750
|
+
wr(st.ctimeNs / 1_000_000_000n, 0);
|
|
751
|
+
wr(st.ctimeNs % 1_000_000_000n, 4);
|
|
752
|
+
wr(st.mtimeNs / 1_000_000_000n, 8);
|
|
753
|
+
wr(st.mtimeNs % 1_000_000_000n, 12);
|
|
754
|
+
wr(st.dev, 16);
|
|
755
|
+
wr(st.ino, 20);
|
|
756
|
+
wr(0o100644, 24);
|
|
757
|
+
wr(st.uid, 28);
|
|
758
|
+
wr(st.gid, 32);
|
|
759
|
+
wr(st.size, 36);
|
|
760
|
+
const full = Buffer.concat([
|
|
761
|
+
entry,
|
|
762
|
+
Buffer.from(headBlob, "hex"),
|
|
763
|
+
Buffer.from([0, name.length]),
|
|
764
|
+
name,
|
|
765
|
+
]);
|
|
766
|
+
const pad = Buffer.alloc((8 - (full.length % 8)) % 8);
|
|
767
|
+
const idxBody = Buffer.concat([
|
|
768
|
+
Buffer.from("DIRC"),
|
|
769
|
+
Buffer.from([0, 0, 0, 2, 0, 0, 0, 1]),
|
|
770
|
+
full,
|
|
771
|
+
pad,
|
|
772
|
+
]);
|
|
773
|
+
const idx = Buffer.concat([idxBody, createHash("sha1").update(idxBody).digest()]);
|
|
774
|
+
writeFileSync(path.join(root, ".git/index"), idx);
|
|
775
|
+
// mtime ordering: index newer than the file entry → not racily clean.
|
|
776
|
+
utimesSync(path.join(root, ".git/index"), new Date(), new Date());
|
|
777
|
+
|
|
778
|
+
// Premise: raw git reports clean while the worktree byte differs.
|
|
779
|
+
expect(gitIn(root, ["status", "--porcelain"])).toBe("");
|
|
780
|
+
expect(gitIn(root, ["show", "HEAD:a.txt"])).not.toBe(
|
|
781
|
+
readFileSync(path.join(root, "a.txt"), "utf8"),
|
|
782
|
+
);
|
|
783
|
+
// The trusted channels answer the same fabricated clean.
|
|
784
|
+
const og = await createOriginGit(root).run(["status", "--porcelain", "--untracked-files=no"]);
|
|
785
|
+
const ev = await gitEvidence(root, ["status", "--porcelain"]);
|
|
786
|
+
expect(
|
|
787
|
+
!(og === "" && ev.exitCode === 0 && ev.stdout === ""),
|
|
788
|
+
`a forged index answered clean on both channels (origin=${JSON.stringify(og)}, evidence=${JSON.stringify(ev.stdout)})`,
|
|
789
|
+
).toBe(true);
|
|
790
|
+
},
|
|
791
|
+
);
|
|
792
|
+
});
|
|
793
|
+
|
|
794
|
+
// ===========================================================================
|
|
795
|
+
// CX-122 — ambient-env git reads: listWorkspaceFiles spawns with process.env
|
|
796
|
+
// ===========================================================================
|
|
797
|
+
|
|
798
|
+
describe("RFC-1616 r9 — ambient environment on workspace listing", () => {
|
|
799
|
+
it(
|
|
800
|
+
"CX-122: `listWorkspaceFiles` execFile's `git ls-files` with NO env option — `GIT_INDEX_FILE`/`GIT_DIR` from the ambient session env redirect the --cached set, so a foreign index injects files the real repo ignores into 'every workspace file' and hides tracked ones",
|
|
801
|
+
{ timeout: 60_000 },
|
|
802
|
+
async () => {
|
|
803
|
+
const root = repo("cx9-amb-");
|
|
804
|
+
writeFileSync(path.join(root, "a.txt"), "a\n");
|
|
805
|
+
writeFileSync(path.join(root, ".gitignore"), "hidden.md\n");
|
|
806
|
+
gitIn(root, ["add", "-A"]);
|
|
807
|
+
gitIn(root, ["commit", "-qm", "seed"]);
|
|
808
|
+
writeFileSync(path.join(root, "hidden.md"), "secret\n");
|
|
809
|
+
// Foreign index that tracks hidden.md (and not a.txt).
|
|
810
|
+
const foreign = repo("cx9-foreign-");
|
|
811
|
+
writeFileSync(path.join(foreign, "hidden.md"), "secret\n");
|
|
812
|
+
gitIn(foreign, ["add", "hidden.md"]);
|
|
813
|
+
|
|
814
|
+
const baseline = await listWorkspaceFiles(root);
|
|
815
|
+
// CX-142: ignore rules never hide files from the trusted
|
|
816
|
+
// enumeration — `hidden.md` is a worktree file, so it lists.
|
|
817
|
+
expect(baseline.includes("hidden.md")).toBe(true);
|
|
818
|
+
const prevIdx = process.env["GIT_INDEX_FILE"];
|
|
819
|
+
const prevDir = process.env["GIT_DIR"];
|
|
820
|
+
process.env["GIT_INDEX_FILE"] = path.join(foreign, ".git", "index");
|
|
821
|
+
process.env["GIT_DIR"] = path.join(foreign, ".git");
|
|
822
|
+
try {
|
|
823
|
+
const listed = await listWorkspaceFiles(root);
|
|
824
|
+
// The ambient env must not move the answer at all: a leaked
|
|
825
|
+
// GIT_DIR would walk the foreign worktree (losing `a.txt`), a
|
|
826
|
+
// leaked GIT_INDEX_FILE would answer foreign index claims.
|
|
827
|
+
expect(
|
|
828
|
+
listed.sort(),
|
|
829
|
+
`ambient GIT_* redirected the workspace listing (got ${JSON.stringify(listed)})`,
|
|
830
|
+
).toEqual(baseline.sort());
|
|
831
|
+
} finally {
|
|
832
|
+
if (prevIdx === undefined) delete process.env["GIT_INDEX_FILE"];
|
|
833
|
+
else process.env["GIT_INDEX_FILE"] = prevIdx;
|
|
834
|
+
if (prevDir === undefined) delete process.env["GIT_DIR"];
|
|
835
|
+
else process.env["GIT_DIR"] = prevDir;
|
|
836
|
+
}
|
|
837
|
+
},
|
|
838
|
+
);
|
|
839
|
+
});
|
|
840
|
+
|
|
841
|
+
// ===========================================================================
|
|
842
|
+
// R9 controls — round-8 remediations re-verified live
|
|
843
|
+
// ===========================================================================
|
|
844
|
+
|
|
845
|
+
describe("RFC-1616 r9 — prior-round controls re-verified", () => {
|
|
846
|
+
it(
|
|
847
|
+
"R9-R1/R9-R8: `remote.o.r.uploadpack` (dotted remote, exec lever) and `reflog`/`stash`/`-c`/`--git-dir` argv stay refused on the verifier channel (CX-110/108/109)",
|
|
848
|
+
{ timeout: 60_000 },
|
|
849
|
+
async () => {
|
|
850
|
+
const root = repo("cx9-ctrl-");
|
|
851
|
+
writeFileSync(path.join(root, "a"), "x\n");
|
|
852
|
+
gitIn(root, ["add", "-A"]);
|
|
853
|
+
gitIn(root, ["commit", "-qm", "seed"]);
|
|
854
|
+
const marker = path.join(root, ".up-marker");
|
|
855
|
+
const hook = path.join(root, "up.sh");
|
|
856
|
+
writeFileSync(hook, `#!/bin/sh\necho UP > "${marker}"\nexit 0\n`);
|
|
857
|
+
chmodSync(hook, 0o755);
|
|
858
|
+
gitIn(root, ["config", "remote.o.r.uploadpack", hook]);
|
|
859
|
+
gitIn(root, ["config", "remote.o.r.url", root]);
|
|
860
|
+
|
|
861
|
+
// CX-132: fetch is refused at the argv layer — the uploadpack lever
|
|
862
|
+
// is unreachable regardless of remote-name shape.
|
|
863
|
+
const fetch = await gitEvidence(root, ["fetch", "o.r"]);
|
|
864
|
+
expect(fetch.exitCode !== 0).toBe(true);
|
|
865
|
+
expect(existsSync(marker)).toBe(false);
|
|
866
|
+
|
|
867
|
+
for (const argv of [
|
|
868
|
+
["reflog"],
|
|
869
|
+
["stash", "list"],
|
|
870
|
+
["-c", "x=y", "status"],
|
|
871
|
+
["--git-dir", root, "status"],
|
|
872
|
+
["config", "core.evil", "x"],
|
|
873
|
+
["update-ref", "refs/heads/master", "HEAD"],
|
|
874
|
+
]) {
|
|
875
|
+
const r = await verifierGit(root, argv);
|
|
876
|
+
expect(
|
|
877
|
+
r.exitCode !== 0 && r.stderr.includes("EVIDENCE-REFUSED"),
|
|
878
|
+
`${JSON.stringify(argv)} slipped the argv table (exit=${r.exitCode})`,
|
|
879
|
+
).toBe(true);
|
|
880
|
+
}
|
|
881
|
+
},
|
|
882
|
+
);
|
|
883
|
+
|
|
884
|
+
it(
|
|
885
|
+
"R9-R2: `policy.digest --verify --base` still refuses dynamic revspecs (HEAD, master, :/msg) — the CX-103 fix",
|
|
886
|
+
{ timeout: 60_000 },
|
|
887
|
+
async () => {
|
|
888
|
+
const root = policyRepo();
|
|
889
|
+
for (const rev of ["HEAD", "master", ":/seed"]) {
|
|
890
|
+
const r = await runPolicyDigest(digestInp({ verify: true, base: rev }), digestCtx(root));
|
|
891
|
+
expect(r.exitCode !== 0, `--base ${rev} was accepted (status=${r.data?.status})`).toBe(
|
|
892
|
+
true,
|
|
893
|
+
);
|
|
894
|
+
}
|
|
895
|
+
},
|
|
896
|
+
);
|
|
897
|
+
|
|
898
|
+
it(
|
|
899
|
+
"R9-R3: heredoc r8 trio stays bash-faithful — `<<~EOF` (literal ~EOF), `<<'E'OF` (quote removal), `<<$EOF` (unarmable) never let dead CI count as adopted",
|
|
900
|
+
{ timeout: 60_000 },
|
|
901
|
+
() => {
|
|
902
|
+
// `<<~EOF`: bash's delimiter is the literal word `~EOF`; a later line
|
|
903
|
+
// `EOF` must NOT terminate the body — the forge line inside stays dead.
|
|
904
|
+
const t1 = workflowWithRun(
|
|
905
|
+
["cat <<~EOF", `forge correctness.gate`, "EOF", "~EOF"].join("\n"),
|
|
906
|
+
);
|
|
907
|
+
// `<<'E'OF`: quote removal arms EOF; the forge line inside the body
|
|
908
|
+
// must not count.
|
|
909
|
+
const t2 = workflowWithRun(["cat <<'E'OF", `forge correctness.gate`, "EOF"].join("\n"));
|
|
910
|
+
// `<<$EOF`: expansion-bearing delimiter arms a never-matching
|
|
911
|
+
// sentinel — body lines are stdin, never invocations.
|
|
912
|
+
const t3 = workflowWithRun(["cat <<$EOF", `forge correctness.gate`, "EOF"].join("\n"));
|
|
913
|
+
for (const [name, body] of [
|
|
914
|
+
["<<~EOF", t1],
|
|
915
|
+
["<<'E'OF", t2],
|
|
916
|
+
["<<$EOF", t3],
|
|
917
|
+
] as const) {
|
|
918
|
+
expect(!adoptedWorkflow(body), `${name} let dead CI count as adopted`).toBe(true);
|
|
919
|
+
}
|
|
920
|
+
// Positive control: a real invocation still counts.
|
|
921
|
+
const real = workflowWithRun(
|
|
922
|
+
[
|
|
923
|
+
"forge correctness.gate --base HEAD~1",
|
|
924
|
+
"forge policy.digest --verify",
|
|
925
|
+
"forge pinned.validate",
|
|
926
|
+
].join("\n"),
|
|
927
|
+
);
|
|
928
|
+
expect(adoptedWorkflow(real), "a real invocation must still count").toBe(true);
|
|
929
|
+
},
|
|
930
|
+
);
|
|
931
|
+
|
|
932
|
+
it(
|
|
933
|
+
"R9-R4: a forged LOOSE object still refuses the evidence channel (CX-104a remediation holds)",
|
|
934
|
+
{ timeout: 60_000 },
|
|
935
|
+
async () => {
|
|
936
|
+
const root = repo("cx9-loose-");
|
|
937
|
+
writeFileSync(path.join(root, "a"), "x\n");
|
|
938
|
+
gitIn(root, ["add", "-A"]);
|
|
939
|
+
gitIn(root, ["commit", "-qm", "seed"]);
|
|
940
|
+
const sha = gitIn(
|
|
941
|
+
root,
|
|
942
|
+
["hash-object", "-w", "--stdin", "-t", "blob"],
|
|
943
|
+
"real-bytes\n",
|
|
944
|
+
).trim();
|
|
945
|
+
const obj = path.join(root, ".git/objects", sha.slice(0, 2), sha.slice(2));
|
|
946
|
+
chmodSync(obj, 0o644);
|
|
947
|
+
writeFileSync(obj, deflateSync(Buffer.from("blob 6\0forged")));
|
|
948
|
+
const r = await gitEvidence(root, ["cat-file", "-p", sha]);
|
|
949
|
+
expect(
|
|
950
|
+
r.exitCode !== 0 && r.stderr.startsWith("EVIDENCE-REFUSED"),
|
|
951
|
+
`forged loose object not refused (exit=${r.exitCode}, out=${JSON.stringify(r.stdout.slice(0, 30))})`,
|
|
952
|
+
).toBe(true);
|
|
953
|
+
},
|
|
954
|
+
);
|
|
955
|
+
|
|
956
|
+
it(
|
|
957
|
+
"R9-R5: `cat-file --batch` batch reads re-hash served bytes — a forged loose blob answers null, never fabricated content",
|
|
958
|
+
{ timeout: 60_000 },
|
|
959
|
+
async () => {
|
|
960
|
+
const root = repo("cx9-batch-");
|
|
961
|
+
writeFileSync(path.join(root, "a"), "x\n");
|
|
962
|
+
gitIn(root, ["add", "-A"]);
|
|
963
|
+
gitIn(root, ["commit", "-qm", "seed"]);
|
|
964
|
+
const sha = gitIn(
|
|
965
|
+
root,
|
|
966
|
+
["hash-object", "-w", "--stdin", "-t", "blob"],
|
|
967
|
+
"real-bytes\n",
|
|
968
|
+
).trim();
|
|
969
|
+
const obj = path.join(root, ".git/objects", sha.slice(0, 2), sha.slice(2));
|
|
970
|
+
chmodSync(obj, 0o644);
|
|
971
|
+
writeFileSync(obj, deflateSync(Buffer.from("blob 6\0forged")));
|
|
972
|
+
const out = await createOriginGit(root).showMany?.([sha]);
|
|
973
|
+
// The whole surface refuses once the loose scan sees the forgery —
|
|
974
|
+
// showMany resolves null; if it ever answers entries, entry i must be
|
|
975
|
+
// null (re-hash mismatch), never the forged bytes.
|
|
976
|
+
expect(
|
|
977
|
+
out == null || out[0] !== "forged",
|
|
978
|
+
`batch served forged bytes: ${JSON.stringify(out)}`,
|
|
979
|
+
).toBe(true);
|
|
980
|
+
},
|
|
981
|
+
);
|
|
982
|
+
|
|
983
|
+
it(
|
|
984
|
+
"R9-R6: `<<-EOF` still refuses a space-indented terminator — the CX-100 strict match holds",
|
|
985
|
+
{ timeout: 30_000 },
|
|
986
|
+
() => {
|
|
987
|
+
const body = workflowWithRun(["cat <<-EOF", `forge correctness.gate`, " EOF"].join("\n"));
|
|
988
|
+
// Space-indented terminator does not end `<<-`: the gate line stays
|
|
989
|
+
// inside the body → nothing invoked → not adopted (fail closed).
|
|
990
|
+
expect(!adoptedWorkflow(body)).toBe(true);
|
|
991
|
+
},
|
|
992
|
+
);
|
|
993
|
+
});
|