Skip to content

feat(breg): enforce Evidence and linked-record guards at request Apply - #1051

Draft
jeremi wants to merge 6 commits into
mainfrom
feat/seed-v2-integrity
Draft

feat(breg): enforce Evidence and linked-record guards at request Apply#1051
jeremi wants to merge 6 commits into
mainfrom
feat/seed-v2-integrity

Conversation

@jeremi

@jeremi jeremi commented Sep 13, 2026

Copy link
Copy Markdown
Member

Problem and behavior

A reviewed request can outlive the facts that justified its proposal. Add configured application preconditions so BREG checks authoritative linked records and fresh signed Evidence when the request is applied. Missing, stale, changed, ineligible or unavailable Evidence refuses application without partial effects. Historical retained evidence does not grant current authority.

The change extends the compiled request contract, generated PostgreSQL privileges and apply path. Read-only guard targets receive the permissions needed for guarded reads and row locking. Provider activation includes request preconditions even when no immediate action consumes Evidence. Approval and application remain separate. Original proposal task authority is checked before Evidence disclosure and again at the transaction boundary; attachment-only request-self permissions remain independent of application targets.

Security review notes

The protected boundary is applying a previously reviewed mutation after its source facts or task authority changed. Enforcement is in the BREG application preflight and transactional apply checks. External Evidence never substitutes for the caller's profile, row or grant authority. Focused PostgreSQL tests cover original-task revocation before disclosure and before commit, wrong nonce, expired or negative Evidence, unavailable providers, idempotent replay, attachment visibility and immutable linked targets. No acceptance-only runtime switches are included.

Validation

  • Locked compiler tests: 36 passed.
  • Real PostgreSQL change-request tests: 28 passed; 3 optional external issuer/S3 cases ignored.
  • Real PostgreSQL task-grant tests: 3 passed; immediate-action requirements: 4; migrations: 7.
  • Generated DDL/artifacts: all nine maintained fixture trees match.
  • Product validator tests: 38 passed; focused precondition unit tests: 2.
  • Provider activation tests: 2 passed, including request-only Evidence guards.
  • Locked runtime/tooling check, focused Clippy, formatting and diff checks passed.

Broader protected CI and maintainer review remain pending. Refreshing provider credentials and the wider client/composition integrations are separate changes.

Signed-off-by: Jeremi Joslin <jeremi@joslin.fr>
Signed-off-by: Jeremi Joslin <jeremi@joslin.fr>
Signed-off-by: Jeremi Joslin <jeremi@joslin.fr>
…ards

Signed-off-by: Jeremi Joslin <jeremi@joslin.fr>
Signed-off-by: Jeremi Joslin <jeremi@joslin.fr>
Signed-off-by: Jeremi Joslin <jeremi@joslin.fr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant