From 22983d23554071013fb9caaa3a018ff2b649718b Mon Sep 17 00:00:00 2001 From: aur-build Date: Tue, 17 Nov 2026 22:09:13 +0000 Subject: =?UTF-8?q?cli:=20operator=20command=20line=20with=20the=20approva?= =?UTF-8?q?l=20path=20(=C2=A77.2)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- src/db/migrations.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/db/migrations.rs') 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). -- cgit v1.2.3