Audit effective runtime privileges and bound lease policy arithmetic
Review P1: the v2 attribute-only runtime role check accepted a login that inherits pg_write_all_data, which can UPDATE lease rows directly and bypass fencing. apply.sql now audits, on every migrate run, the runtime group and all transitive members: privileged attributes, any membership outside the group (inherited or SET-able), table privileges in evolution (including PUBLIC), CREATE rights and EXECUTE beyond the five fenced functions. 0002 and its checksum are unchanged. CI reproduces the bypass and proves each configuration is rejected and rolled back. Review P2: valid(LeasePolicy) bounds every term by the duration before arithmetic; LeaseAuthority validates durations before deadline math and renewal_unknown ignores impossible (>60s) and fences non-positive requests. Extreme min/max tests reproduce the old UBSan overflow and now pass. Validated: Windows CTest 55/55; WSL Release, clang-tidy and ASan/UBSan private-PostgreSQL suites. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -2081,3 +2081,25 @@ Only clean-to-v1 and exact-v1 restart are supported migration paths at this gate
|
||||
kill, real network partition (a lock wait plus client deadline stands in for
|
||||
it), VM freeze and TSan. The contention threads each own a separate
|
||||
connection; libpq is uninstrumented.
|
||||
|
||||
### M7.3 review fixes - 2026-09-28
|
||||
|
||||
- P1: an attribute-only runtime role check let a login inheriting
|
||||
`pg_write_all_data` update `evolution.region_leases` directly. The CI script
|
||||
reproduces that UPDATE first. `apply.sql` now audits effective privileges on
|
||||
every run (the v2 migration file and its checksum are unchanged). Rejected, each
|
||||
with a rollback:
|
||||
- a runtime group inheriting `pg_write_all_data` on a fresh database (no
|
||||
schema left);
|
||||
- that grant on the login, and on the group WITH INHERIT FALSE;
|
||||
- a PUBLIC table grant, EXECUTE on the internal check function, and a
|
||||
CREATEDB login.
|
||||
The restored configuration passes again.
|
||||
- P2: `valid(LeasePolicy)` now bounds each term by the duration before any
|
||||
arithmetic. `acquired` validates the duration before computing a deadline.
|
||||
`renewal_unknown` ignores durations above 60 s and fences on non-positive ones.
|
||||
New tests use `milliseconds::max()` and `min()` for every field. Built against
|
||||
the previous source under clang19 UBSan, they reproduce the reported signed
|
||||
overflow (`9223372036854775807 + 2000`).
|
||||
- Reran Windows CTest 55/55, the repository format check, and GCC14 Release,
|
||||
clang-tidy analysis and ASan/UBSan private-PostgreSQL suites: all passed.
|
||||
|
||||
Reference in New Issue
Block a user