task: evidence for live Managed DB verification (#64)

Throwaway branch, never merged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
BobbyandClaude Opus 5.5 committed 2026-11-24 08:33:45 -05:00
1 parent 2aea5ebaef
commit cada14bb94
5 files changed
+597

No files matched your search

+121
View File
@@ -0,0 +1,121 @@
== 0. DNS + TLS
tls=true TLSv1.3
by-IP (expect cert mismatch): 1
-- server cert names
subject=ST=service, O=a6555122-1463-44bd-bdcc-b8dd91653408, CN=a568915-1
X509v3 Subject Alternative Name:
IP Address:10.64.0.32, DNS:10.64.0.32, DNS:2600:3c05::2000:adff:fe30:f6eb, DNS:private-a568915-akamai-prod-1130531-default.g2a.akamaidb.net, IP Address:172.234.33.213, DNS:*.g2a.akamaidb.net, DNS:public-n-a568915-1.g2a.akamaidb.net, DNS:public-replica-a568915-akamai-prod-1130531-default.g2a.akamaidb.net, DNS:172.234.33.213, DNS:fda7:a938:5bfe:5fa6:0:5f7:bc5a:cb01, DNS:private-replica-a568915-akamai-prod-1130531-default.g2a.akamaidb.net, DNS:a568915-akamai-prod-1130531-default.g2a.akamaidb.net, IP Address:2600:3C05:0:0:2000:ADFF:FE30:F6EB, DNS:replica-a568915-akamai-prod-1130531-default.g2a.akamaidb.net, DNS:n-a568915-1.g2a.akamaidb.net, IP Address:FDA7:A938:5BFE:5FA6:0:5F7:BC5A:CB01, DNS:public-a568915-akamai-prod-1130531-default.g2a.akamaidb.net
== 1. platform settings / akmadmin attributes
PostgreSQL 18.7 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 15.3.1 20260722 (Red Hat 15.3.1-1), 64-bit
scram-sha-256
50
3
0
akmadmin|f|t|t|t
inherit,set
== 2. bootstrap as akmadmin
CREATE ROLE
CREATE ROLE
ERROR: permission denied for table pg_authid
CREATE DATABASE
-- retry create database after granting SET on hapi_migrator to akmadmin
GRANT ROLE
ERROR: database "hapi" already exists
-- db-level grants as owner hapi_migrator
REVOKE
GRANT
REVOKE
-- audit: per-role log_statement
ERROR: permission denied to set parameter "log_statement"
ERROR: permission denied to set parameter "log_min_duration_statement"
-- can akmadmin grant BYPASSRLS?
CREATE ROLE
DROP ROLE
== 3. schema + RLS as hapi_migrator
CREATE SCHEMA
GRANT
ALTER DEFAULT PRIVILEGES
CREATE TABLE
ALTER TABLE
ALTER TABLE
CREATE POLICY
-- owner under FORCE, no principal set: insert (expect RLS violation)
ERROR: new row violates row-level security policy for table "note"
-- owner seeds via per-row principal
BEGIN
set_config
--------------------------------------
00000000-0000-0000-0000-00000000000a
(1 row)
INSERT 0 2
COMMIT
BEGIN
set_config
--------------------------------------
00000000-0000-0000-0000-00000000000b
(1 row)
INSERT 0 1
COMMIT
-- owner, no principal: count (FORCE => 0)
0
-- owner temporarily NO FORCE (data-repair path)
BEGIN
ALTER TABLE
3
ROLLBACK
== 4. hapi_app
-- DDL attempts (expect permission denied x2)
ERROR: permission denied for schema finance
LINE 1: create table finance.evil(x int)
^
ERROR: permission denied for schema public
LINE 1: create table public.evil(x int)
^
-- no principal set: count (expect 0)
0
-- SET LOCAL A in txn, then after commit on same connection (expect 2 then 0)
BEGIN
SET
2
COMMIT
0
[]
-- set_config(..., true) as A (expect 2)
BEGIN
00000000-0000-0000-0000-00000000000a
2
COMMIT
-- WITH CHECK: as A insert B-owned row (expect RLS violation)
BEGIN
SET
ERROR: new row violates row-level security policy for table "note"
ROLLBACK
-- as A update B rows (expect UPDATE 0)
BEGIN
SET
UPDATE 0
ROLLBACK
-- escalation attempts (expect all denied)
ERROR: permission denied to set role "hapi_migrator"
ERROR: must be owner of table note
ERROR: must be owner of table note
ERROR: must be owner of relation note
-- spoof: leaked hapi_app creds can set any principal (expect 1 = B's row visible)
SET
1
-- connections in use
autovacuum launcher||1
background writer||1
checkpointer||1
client backend|akmadmin|1
client backend|postgres|1
io worker||3
logical replication launcher|postgres|1
pg_cron launcher|postgres|1
pg_failover_slots worker|postgres|1
TimescaleDB Background Worker Launcher|postgres|1
walsender|_aiven|1
walwriter||1
DONE