diff options
| author | aur-build <aur-build@localhost> | 2026-11-17 22:09:13 +0000 |
|---|---|---|
| committer | aur-build <aur-build@localhost> | 2026-11-17 22:09:13 +0000 |
| commit | 22983d23554071013fb9caaa3a018ff2b649718b (patch) | |
| tree | f3d8e51c1555762b81244f88f3ad0cdd1239a253 /src/db/migrations.rs | |
| parent | 4ac1d19ca5dc540db0478943a0cd70a5353307da (diff) | |
| download | aur-build-22983d23554071013fb9caaa3a018ff2b649718b.tar.gz aur-build-22983d23554071013fb9caaa3a018ff2b649718b.zip | |
cli: operator command line with the approval path (§7.2)
aur-build init/subscribe/detect/reviews/show/approve/reject/build/run/
builds/status/packages/audit. approve renders the review and then
approves with the hashes it just rendered, so the CLI cannot approve a
diff it did not show you; --identity/--diff reproduce the stale case
explicitly and a refusal exits 2 (the web equivalent is 409).
Approvals are now immutable at the schema level: migration 0006 rejects
UPDATE and DELETE on the approval table, because that row is the only
proof the system has of what a human actually looked at (§7.2, I10).
Publishing also refuses when no approval is reachable, including the
manual-rebuild path that inherits one.
10 tests, including two that drive the compiled binary end to end
against a file:// AUR fixture.
Diffstat (limited to 'src/db/migrations.rs')
| -rw-r--r-- | src/db/migrations.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/db/migrations.rs b/src/db/migrations.rs index dddb301..8ba925c 100644 --- a/src/db/migrations.rs +++ b/src/db/migrations.rs @@ -282,12 +282,30 @@ ALTER TABLE artifact ADD COLUMN build_id TEXT; CREATE INDEX artifact_by_build ON artifact (build_id); "#; +/// §7.2: the approval record is immutable. It is the only proof the system has +/// of *what a human actually looked at*, so editing it would let a later +/// attacker retarget a published artifact onto a clean review. +const M_0006_APPROVAL_IMMUTABLE: &str = r#" +CREATE TRIGGER approval_no_update +BEFORE UPDATE ON approval +BEGIN + SELECT RAISE(ABORT, 'approval records are immutable'); +END; + +CREATE TRIGGER approval_no_delete +BEFORE DELETE ON approval +BEGIN + SELECT RAISE(ABORT, 'approval records are immutable'); +END; +"#; + pub static MIGRATIONS: &[Migration] = &[ Migration { version: 1, name: "core", sql: M_0001_CORE }, Migration { version: 2, name: "build", sql: M_0002_BUILD }, Migration { version: 3, name: "notices", sql: M_0003_NOTICES }, Migration { version: 4, name: "audit-triggers", sql: M_0004_TRIGGERS }, Migration { version: 5, name: "artifact-build", sql: M_0005_ARTIFACT_BUILD }, + Migration { version: 6, name: "approval-immutable", sql: M_0006_APPROVAL_IMMUTABLE }, ]; /// Default settings seeded into `settings` (DESIGN.md §11). |
