Repository navigation
feat(security): policy-distributed hardware mandate (require_hardware_identity) - #236
Merged
Merged
Conversation
…_identity) Wires the fleet-wide hardware mandate the previous PR documented as not-yet-wired: an org can now set `require_hardware_identity = true` in `.kit-policy.toml` to mandate a hardware/externally-held signing identity across every repo that commits the policy — no per-machine env var needed. - Schema: PolicyDoc.require_hardware_identity (validated boolean). - Effective mandate: hardwareRequired(root) = hardwareRequiredByEnv() || policy value. TIGHTENING-ONLY by construction (an OR): a false/absent policy value can never relax an environment mandate; a repo-local policy can only ADD the requirement (fail-closed, the safe direction). - Enforcement sites now honor the effective mandate: policy sign, audit-chain signing, shared-memory signing, keystore-routed revocation, and `kit identity init/rotate` (refuse to mint a file key under a policy mandate too). `kit identity keystore` surfaces whether the mandate comes from env or policy. - signWithIdentity stays the env-only backstop (identity.ts must remain import-cycle-free); the routed sites enforce the policy mandate before any file signing can occur. Regression tests: policy-only mandate forces audit keyless (no env), tightening-only semantics, schema validation. Full suite green (2266 tests). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DbF4MFePXWNCd4dxBQvqH2
|
✅ Docker image built successfully
|
Pre-empting the verify pass on the two gaps I flagged in the new policy mandate: - cwd-vs-root: policyRequiresHardware now walks UP to the nearest ancestor holding .kit-policy.toml (cheap fs walk, no git exec — safe on the audit hot path). A root-level require_hardware_identity now applies when kit is invoked from any subdirectory, instead of being silently skipped (which would have let audit signing emit a file-key signature despite the org policy). - Attestation: loadOrCreateEd25519Key is now guarded by hardwareRequired(cwd) (env OR policy), not env-only — so under a policy-only mandate the attestation receipt no longer mints/uses the same-UID Ed25519 file key either. Regression tests: subdir upward-walk, attestation under a policy-only mandate. Full suite green. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DbF4MFePXWNCd4dxBQvqH2
|
✅ Docker image built successfully
|
…tgun (verify round 2) The verify pass confirmed the cwd-vs-root gap and attestation gap were already closed (subdir upward-walk + policy-aware attestation guard, with tests). Two residuals remained: - Finding 2 (HIGH): `kit panic` calls rotateIdentity() directly, whose guard is env-only, so a POLICY-only mandate let panic re-mint the same-UID file key the mandate forbids (cwd-independent). Added the effective-mandate guard (env OR policy, via getCurrentProjectRoot) before panic rotates — fail closed. - Finding 7 (footgun): a present-but-non-boolean require_hardware_identity (`= 1`, `= "true"`) is a validate error but was silently treated as "not mandated". policyRequiresHardware now fail-closes ON for any present non-false value; only a strict false/absent means not-mandated. Verify also confirmed SOLID (no change): the OR truly prevents policy-relax of an env mandate; no standalone signWithIdentity bypass; no import cycle. Regression tests: panic refuses under a policy-only mandate (identity unrotated, no revocation); non-boolean mandate value → ON. Full suite green (2270 tests). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DbF4MFePXWNCd4dxBQvqH2
|
✅ Docker image built successfully
|
This was referenced Nov 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Wires the fleet-wide hardware mandate that Pillar 1 (#235) documented as not-yet-wired. An org can now set
require_hardware_identity = truein.kit-policy.tomlto mandate a hardware/externally-held signing identity across every repo that commits the policy — no per-machine env var required.Type of Change
Changes Made
PolicyDoc.require_hardware_identity(validated boolean).hardwareRequired(root) = hardwareRequiredByEnv() || policyRequiresHardware(root). Tightening-only by construction (an OR): afalse/absent policy value can never relax an environment mandate; a repo-local policy can only add the requirement — the fail-closed, safe direction (worst case is a DoS on a box lacking hardware, never a silent downgrade).kit policy sign, audit-chain signing, shared-memory signing, keystore-routed revocation, andkit identity init/rotate(refuse to mint a file key under a policy mandate too).kit identity keystoreshows whether the mandate is from env or policy.signWithIdentitystays the env-only backstop (identity.ts must remain import-cycle-free); the routed sites enforce the policy mandate before any file signing can occur.Testing
Test Coverage
npm test)New regression tests: a policy-only mandate (no env) forces audit entries keyless; tightening-only semantics (
hardwareRequiredon a dir without the policy is false); schema validation of the new field. Full suite green: 2266 tests.Breaking Changes
None / N/A — default behavior is unchanged (no policy field, no env var → signs with the file key exactly as before). The mandate only ever adds strictness.
🤖 Generated with Claude Code
https://claude.ai/code/session_01DbF4MFePXWNCd4dxBQvqH2
Generated by Claude Code