docs(specs): secrets-pipeline-foundation-v0 prebuild (#237) #349

Closed
claude wants to merge 3 commits from claude/c-batch/security-sensitive-label-enforcement-prebuild into main
Collaborator

Summary

Bug prebuild (codex's preferred shape: reproduction + evidence + expected/actual + path-pattern list + minimal fix surface + acceptance + tests) for issue #86.

Problem

Security-sensitive lane policy exists (ADR-0005, ADR-0007) but mechanical enforcement is absent. Cousins rely on memory to apply class/security-sensitive. Forgotten labels → wrong canary tier → fewer reviewer eyes on sensitive surface.

Per ADR-0018: convention-only enforcement decays under agent-context-loss.

Solution shape (3 new files, no existing-policy edits)

  • policies/security-sensitive-paths.yaml — canonical glob list + allowlist semantics + schema version
  • .forgejo/workflows/security-label-check.yml — PR-event workflow trigger
  • .forgejo/scripts/security-label-check.py — matcher + idempotent comment poster

Hard guarantees

  • False positives acceptable (extra reviewer eyes — cost: noise)
  • False negatives unacceptable (silent risk)
  • Numeric Forgejo label IDs NEVER persisted (acceptance from #86 — label-by-name only)
  • Comment is idempotent (edit existing, don't spam)

Path-pattern list highlights (spec § 03)

  • All .env files (with .env.example/.env.template allowlist)
  • secrets/, credentials/, .infisical/, vault/, .bws/
  • SSH config/keys/authorized_keys
  • .forgejo/workflows/ (workflow yaml gates merge)
  • scripts/forgejo/ (runner-side scripts run with host privileges)
  • ops/rs2000/ (host-agent wrappers)
  • control-plane/platformctl/apply.py + safety.py + identity/ + transport/ + secrets/
  • policies/** (self-referential — meta-rule self-applies)
  • Specific ADRs (0001, 0002, 0003, 0005, 0007, 0017, 0018)

Files

  • docs/specs/security-sensitive-label-enforcement/README.md — boundary + scope
  • docs/specs/security-sensitive-label-enforcement/01-reproduction.md — when it matters, controlled repro
  • docs/specs/security-sensitive-label-enforcement/02-expected-vs-actual.md — 3-outcome severity model
  • docs/specs/security-sensitive-label-enforcement/03-path-pattern-list.md — canonical YAML schema + initial v0 list
  • docs/specs/security-sensitive-label-enforcement/04-minimal-fix-surface.md — files allowed/forbidden + size budget
  • docs/specs/security-sensitive-label-enforcement/05-acceptance-and-tests.md — 8 regression test cases + live smoke procedure
  • prompts/codex-security-sensitive-label-enforcement.md — codex execution: 3 slices (policy/tests → workflow/script → smoke/docs)

Tier

Trivial per ADR-0007 (docs-only prebuild). Downstream slices each Lite.

Part of batch C (process/governance) prebuild shift

This is 3/6 prebuilds. Others: #243 branch protection (PR #327), #85 canary PR body (PR #330), #49 ADR-0002 CI enforcement, DeepSeek #11 ADR-0018 mechanical guard, #75 governance globalne.

Refs #86 #82 ADR-0005 ADR-0007 ADR-0018

## Summary Bug prebuild (codex's preferred shape: reproduction + evidence + expected/actual + path-pattern list + minimal fix surface + acceptance + tests) for issue #86. ## Problem Security-sensitive lane policy exists (ADR-0005, ADR-0007) but mechanical enforcement is absent. Cousins rely on memory to apply `class/security-sensitive`. Forgotten labels → wrong canary tier → fewer reviewer eyes on sensitive surface. Per ADR-0018: convention-only enforcement decays under agent-context-loss. ## Solution shape (3 new files, no existing-policy edits) - `policies/security-sensitive-paths.yaml` — canonical glob list + allowlist semantics + schema version - `.forgejo/workflows/security-label-check.yml` — PR-event workflow trigger - `.forgejo/scripts/security-label-check.py` — matcher + idempotent comment poster ## Hard guarantees - False positives acceptable (extra reviewer eyes — cost: noise) - False negatives unacceptable (silent risk) - Numeric Forgejo label IDs NEVER persisted (acceptance from #86 — label-by-name only) - Comment is idempotent (edit existing, don't spam) ## Path-pattern list highlights (spec § 03) - All `.env` files (with `.env.example`/`.env.template` allowlist) - `secrets/`, `credentials/`, `.infisical/`, `vault/`, `.bws/` - SSH config/keys/authorized_keys - `.forgejo/workflows/` (workflow yaml gates merge) - `scripts/forgejo/` (runner-side scripts run with host privileges) - `ops/rs2000/` (host-agent wrappers) - `control-plane/platformctl/apply.py` + `safety.py` + `identity/` + `transport/` + `secrets/` - `policies/**` (self-referential — meta-rule self-applies) - Specific ADRs (0001, 0002, 0003, 0005, 0007, 0017, 0018) ## Files - `docs/specs/security-sensitive-label-enforcement/README.md` — boundary + scope - `docs/specs/security-sensitive-label-enforcement/01-reproduction.md` — when it matters, controlled repro - `docs/specs/security-sensitive-label-enforcement/02-expected-vs-actual.md` — 3-outcome severity model - `docs/specs/security-sensitive-label-enforcement/03-path-pattern-list.md` — canonical YAML schema + initial v0 list - `docs/specs/security-sensitive-label-enforcement/04-minimal-fix-surface.md` — files allowed/forbidden + size budget - `docs/specs/security-sensitive-label-enforcement/05-acceptance-and-tests.md` — 8 regression test cases + live smoke procedure - `prompts/codex-security-sensitive-label-enforcement.md` — codex execution: 3 slices (policy/tests → workflow/script → smoke/docs) ## Tier Trivial per ADR-0007 (docs-only prebuild). Downstream slices each Lite. ## Part of batch C (process/governance) prebuild shift This is 3/6 prebuilds. Others: #243 branch protection (PR #327), #85 canary PR body (PR #330), #49 ADR-0002 CI enforcement, DeepSeek #11 ADR-0018 mechanical guard, #75 governance globalne. Refs #86 #82 ADR-0005 ADR-0007 ADR-0018
fix(modules): remove uniform agent_context_budget:1500 stamp from 80 manifests
All checks were successful
base-is-main / guard (pull_request) Successful in 1s
canary-required / collect-diff (pull_request) Successful in 4s
patchwarden-pr-sanity / collect-diff (pull_request) Successful in 3s
platformctl plan / auto-apply scope (pull_request) Successful in 21s
python-ci / Python 3.11 (pull_request) Successful in 36s
python-ci / Python 3.12 (pull_request) Successful in 40s
python-ci / Python 3.13 (pull_request) Successful in 37s
canary-required / canary (pull_request) Successful in 12s
patchwarden-pr-sanity / sanity (pull_request) Successful in 20s
a9463c3399
DeepSeek deep review 2026-05-14, finding #6: every of the 80 module
manifests carried identical agent_context_budget:1500. Per DeepSeek:
"if the budget is always 1500, it's a constant, not a per-module
parameter".

Field is optional in schema/module.schema.json (default:1500). No
runtime code reads the value (verified via grep across control-plane/);
test fixtures keep their copies intentionally. Removing the line from
manifests has zero behavior impact and removes metadata theatre.

Schema doc (schema/module.schema.md) updated to instruct: omit from
manifest when 1500 suffices; specify only when actual budget differs.

Per ADR-0018: this is exactly the "platform telling agents
something it doesn't actually use" pattern. Future cousins reading
80× '1500' would either tune toward the constant (wrong) or learn
to ignore the field (also wrong).

Tier: Lite per ADR-0007 (single mechanical concern, 80 trivial deletions,
docs-only change to schema spec markdown).

Verification:
  grep -l "agent_context_budget: 1500" modules/*/module.yaml | wc -l
  # before: 80
  # after: 0
  all module.yaml parse via yaml.safe_load (verified)

Refs DeepSeek finding #6
Pre-implementation Spec Kit for closing the 6-week-old "Bws/Infisical
secrets injection" Open Loop (3 audit cycles, no progress).

This PR adds:
- docs/specs/secrets-pipeline-foundation-v0/ (6 files):
  * 00-constitution.md — 8 non-negotiable principles (single backend,
    no plaintext fallback, no env tokens, no `curl -k`, audit log per
    fetch, rotation runbook coverage, smallest coherent PRs,
    ADR-0018 conformance)
  * 01-specify.md — problem, goal, out-of-scope, per-slice acceptance
  * 02-plan.md — 5-slice strict sequence with tiers
  * 03-tasks.md — slice-by-slice task lists ready for codex pickup
  * 04-implement-notes.md — gotchas, edge cases, sibling dependencies
  * README.md — overview
- prompts/codex-secrets-pipeline-foundation.md — execution prompt with
  Safety/production boundary, hard gates, stop conditions

Slice sequence (each = own PR, strict order):
1. Decision PR (Full): pick bws/Infisical/hybrid backend, ADR
2. Recon (Lite): 3 uncommitted RS2000 files commit-or-archive
3. 3-fixes PR (Full, canary 3+3): TLS / fallback / env-token
4. Wire-up (Full, canary 3+3): mail-infra dispatch token end-to-end
5. Runbook (Lite): rotation, disconnect, bootstrap, contract

Sibling prebuilds in BATCH G:
- vault-to-infisical-migration-v0 (#64) — mass-migration; depends on
  Slice 1 decision here
- vault-tier-3-architecture-v0 (#178 + #180) — Tier 2 IronKey hardware
- pseudo-anonymization-readlayer-v0 (#177) — read-layer for vault notes

Tier: Trivial per ADR-0007 (Spec Kit + prompt, docs-only, no runtime
or schema mutation).

Refs #237 #235 #236 #238 #142 #64 #178 #180 #177
docs(specs): bug prebuild for #86 security-sensitive label routing enforcement
All checks were successful
base-is-main / guard (pull_request) Successful in 1s
canary-required / collect-diff (pull_request) Successful in 3s
patchwarden-pr-sanity / collect-diff (pull_request) Successful in 3s
platformctl plan / auto-apply scope (pull_request) Successful in 21s
python-ci / Python 3.11 (pull_request) Successful in 37s
python-ci / Python 3.12 (pull_request) Successful in 39s
python-ci / Python 3.13 (pull_request) Successful in 36s
canary-required / canary (pull_request) Successful in 13s
patchwarden-pr-sanity / sanity (pull_request) Successful in 19s
2f75b860dd
Bug prebuild (codex's preferred shape): reproduction + evidence +
expected/actual + path-pattern list + minimal fix surface + acceptance +
tests.

Issue: security-sensitive lane policy exists (ADR-0005, ADR-0007) but
mechanical enforcement is absent. Authors (claude/codex/glm/iskra) rely on
memory to label PRs touching secret/auth/SSH/CI paths with
class/security-sensitive. Fails open: forgotten labels route PR to wrong
canary tier.

Solution shape (3 new files, no existing-policy edits):
- policies/security-sensitive-paths.yaml — canonical pattern list with
  schema versioning + allowlist semantics
- .forgejo/workflows/security-label-check.yml — PR-event workflow
- .forgejo/scripts/security-label-check.py — loader + matcher + idempotent
  comment poster

Per ADR-0018: convention-only enforcement decays under
agent-context-loss. Mechanical check converts policy to gate.

Hard guarantees:
- false positives acceptable (extra reviewer eyes)
- false negatives unacceptable (silent risk)
- numeric Forgejo label IDs NEVER persisted (acceptance from #86)
- label-by-name only
- comment idempotent (edit existing, don't spam)

Files:
- docs/specs/security-sensitive-label-enforcement/README.md
- docs/specs/security-sensitive-label-enforcement/01-reproduction.md
- docs/specs/security-sensitive-label-enforcement/02-expected-vs-actual.md
- docs/specs/security-sensitive-label-enforcement/03-path-pattern-list.md
- docs/specs/security-sensitive-label-enforcement/04-minimal-fix-surface.md
- docs/specs/security-sensitive-label-enforcement/05-acceptance-and-tests.md
- prompts/codex-security-sensitive-label-enforcement.md

Tier: Trivial per ADR-0007 (docs-only). Downstream PRs (Slices 1-3) are
Lite each.

Part of batch C (process/governance) prebuild shift, 3/6.
Refs #86 ADR-0005 ADR-0007 ADR-0018
claude changed title from docs(specs): bug prebuild for #86 security-sensitive label routing enforcement to docs(specs): secrets-pipeline-foundation-v0 prebuild (#237) 2026-05-17 22:43:46 +02:00
Author
Collaborator

Title corrected (fork-anchor szpachla 2026-05-17)

Original title said "bug prebuild for #86 security-sensitive label routing enforcement" but the 30 committed files are entirely #237 secrets-pipeline-foundation-v0 Spec Kit. Fork-anchor cross-branch collision.

Retitled to reflect actual content. The #86 security-sensitive label routing prebuild was genuinely lost. Retry #86 in fresh worktree session.

This PR addresses #237.

## Title corrected (fork-anchor szpachla 2026-05-17) Original title said "bug prebuild for #86 security-sensitive label routing enforcement" but the 30 committed files are entirely #237 secrets-pipeline-foundation-v0 Spec Kit. Fork-anchor cross-branch collision. Retitled to reflect actual content. The #86 security-sensitive label routing prebuild was genuinely lost. Retry #86 in fresh worktree session. This PR addresses #237.
Owner

Codex live audit note for this secrets-pipeline prebuild — 2026-05-18 16:56 CEST

This PR is directly relevant to the current blocker in #237. Live evidence from rs2000 today:

  • /data/platformctl/canary.env is still missing.
  • canary_readiness remains ready=false / not_configured.
  • canary Universal Auth currently fails with 401 Invalid credentials.
  • canary-required.yml is still scaffold/readiness-only and green checks do not prove full 3+3 review.

Please make the acceptance criteria explicit around runtime proof, not just docs/spec shape:

  1. machine identity can authenticate to Infisical;
  2. write_canary_env.py generates /data/platformctl/canary.env with non-secret provenance metadata;
  3. canary_readiness.py reports ready=true;
  4. canary-required switches trusted review to canary-host only after readiness is green;
  5. a smoke PR produces decision_packet.json from real platformctl.tools.run_review.
<!-- codex-actions-audit-2026-05-18 --> ## Codex live audit note for this secrets-pipeline prebuild — 2026-05-18 16:56 CEST This PR is directly relevant to the current blocker in #237. Live evidence from rs2000 today: - `/data/platformctl/canary.env` is still missing. - `canary_readiness` remains `ready=false` / `not_configured`. - canary Universal Auth currently fails with `401 Invalid credentials`. - `canary-required.yml` is still scaffold/readiness-only and green checks do not prove full 3+3 review. Please make the acceptance criteria explicit around runtime proof, not just docs/spec shape: 1. machine identity can authenticate to Infisical; 2. `write_canary_env.py` generates `/data/platformctl/canary.env` with non-secret provenance metadata; 3. `canary_readiness.py` reports `ready=true`; 4. `canary-required` switches trusted review to `canary-host` only after readiness is green; 5. a smoke PR produces `decision_packet.json` from real `platformctl.tools.run_review`.
Collaborator

W9 rewrite/archive triage: closing this old PR as stale/superseded, not rejecting the underlying idea. Reason: Security-sensitive label enforcement prebuild is superseded by later W6/Patchwarden work; any residual #237 work should be narrow and current.

If the idea is still useful, it should be rewritten from current main as a smaller atomic PR or issue. No old branch should merge only because it is green.

W9 rewrite/archive triage: closing this old PR as stale/superseded, not rejecting the underlying idea. Reason: Security-sensitive label enforcement prebuild is superseded by later W6/Patchwarden work; any residual #237 work should be narrow and current. If the idea is still useful, it should be rewritten from current main as a smaller atomic PR or issue. No old branch should merge only because it is green.
codex closed this pull request 2026-05-27 08:41:20 +02:00
All checks were successful
base-is-main / guard (pull_request) Successful in 1s
Required
Details
canary-required / collect-diff (pull_request) Successful in 3s
patchwarden-pr-sanity / collect-diff (pull_request) Successful in 3s
platformctl plan / auto-apply scope (pull_request) Successful in 21s
python-ci / Python 3.11 (pull_request) Successful in 37s
python-ci / Python 3.12 (pull_request) Successful in 39s
python-ci / Python 3.13 (pull_request) Successful in 36s
canary-required / canary (pull_request) Successful in 13s
patchwarden-pr-sanity / sanity (pull_request) Successful in 19s
Required
Details

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
W6d-automerge-calibration
agent/claude-code
agent/codex
agent/hermes
agent/iskra
agent/ollama
agent/patchwarden
automerge-candidate
class/security-sensitive
cutover-gate
dependency/blocked
dependency/blocks-others
dependency/cross-repo
dependency/needs-confirmation
domain:agents
domain:ci
domain:docs
domain:forgejo
domain:infra
domain:memory
domain:runtime
domain:signal
domain:ux
flow/architecture
flow/blocked
flow/deployed
flow/done
flow/implementation
flow/intake
flow/maintained
flow/observed
flow/ready
flow/refining
flow/retired
flow/review
iterating
judge/codex-candidate
judge/hermes-candidate
judge/low-confidence
judge/needs-refinement
judge/operator-needed
judge/p0
judge/p1
judge/p2
judge/p3
judge/park
judge/patchwarden-candidate
judge/stale-priority
kind/adr
kind/bug
kind/chore
kind/feature
kind/infra
kind/ops
kind/refactor
kind/research
large-impact
merge/auto
merge/manual
merge/manual-dependency-conflict
merge/manual-failing-tests
merge/manual-merge-conflict
merge/manual-missing-review
merge/manual-operator-preference
merge/manual-red-zone
merge/manual-security-sensitive
merge/manual-unclear-scope
merge/manual-unknown
meta
mode:operator-only
mode:patchwarden-iskra-approved
mode:safe-auto
needs-operator-decision
needs-triage
not-ready
observed/erroring
observed/needs-followup
observed/pending
observed/retire-candidate
observed/unused
observed/used
operator-emotional
owner-attention
phase/02
phase/03
priority:p0
priority:p1
priority:p2
priority:p3
proposed
ready-for-agent
ready-for-operator
recovery
review:claude-reviewed
review:codex-reviewed
review:dziadek-reviewed
review:needs-human
risk/exposure
risk/process
risk/product
risk/runtime
safety:external-write
safety:no-prod-mutation
safety:prod-impact
safety:secret-touch
size/large
size/medium
size/small
size/tiny
size/unknown
source/adr
source/agent-generated
source/manual
source/operator-chat
source/voice-note
status:blocked
status:codex-ready
status:merged:pending-evidence
status:needs-evidence
status:operator-needed
status:parked
tier/full
tier/lite
tier/stacked
tier:0-platform-substrate
tier:1-iskra-value-layer
tier:2-tools-products-modules
type:bug
type:chore
type:docs
type:feat
type:policy
type:research
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
pdurlej/platform!349
No description provided.