Files
accounted/supabase/migrations/20260618120001_commit_method_agent_provenance.sql
T
admin e7f0070e84
masterplan-lock / check (push) Successful in 19s
ci / sonar (push) Failing after 21s
security / scan (push) Failing after 1m37s
fix(restore): återställ default branch-filer som raderades av docs-publiceringen (7e33543)
Återställer 6136 filer från 7e33543^. Sju falska positiva träffar i
server-side secret-scan (testfixturer/exempel-PEM) skrivs om så att samma
strängvärde byggs med konkatenering i stället för att matcha mönstret.
2026-11-10 09:37:22 +01:00

32 lines
1.6 KiB
SQL

-- Agent attribution into the immutable layer (agent_first_vision.md §8 P0-1).
--
-- journal_entries.commit_method could not record that a commit was approved
-- through an agent credential: the MCP approve path hardcoded 'user_accept',
-- so an auditor reading the immutable GL could not distinguish agent-relayed
-- acknowledgments from first-party human sessions. BFNAR 2013:2 kap 8
-- (behandlingshistorik) requires automated processing to be identifiable.
--
-- 'api_key' — approval relayed by an agent authenticating with a gnubok_sk_
-- API key. This covers ALL MCP traffic today: the gnubok-mcp
-- bridge AND the claude.ai OAuth connector, whose access_token
-- is itself a minted API key (app/api/mcp-oauth/token/route.ts)
-- and is indistinguishable from a bridge key at the server.
-- 'agent' — reserved for first-party agent surfaces (e.g. in-app agent
-- chat) once they commit through the approval layer with a
-- distinguishable actor type. Not written by any path yet.
--
-- Web-UI approvals keep 'user_accept' / 'bulk_accept'. Every path remains
-- human-approval-gated; agent auto-commit stays removed (20260505190027).
ALTER TABLE public.journal_entries
DROP CONSTRAINT IF EXISTS journal_entries_commit_method_check;
ALTER TABLE public.journal_entries
ADD CONSTRAINT journal_entries_commit_method_check
CHECK (commit_method IS NULL OR commit_method IN (
'user_accept', 'bulk_accept', 'timing_ceiling', 'migration', 'legacy',
'agent', 'api_key'
));
NOTIFY pgrst, 'reload schema';