feat(api): give status page servers sealed key-value storage
Certificates and ACME keys are stored encrypted in the database, namespaced per owner so an organization's servers cannot read platform or other organizations' keys. Locks live in Redis and expire. Refs #22 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
This commit is contained in:
1 parent
f52ae33cf0
commit
46f1f82481
11 files changed
+611
-1
No files matched your search
@@ -0,0 +1,21 @@
|
||||
-- +goose Up
|
||||
-- Key-value storage for status page servers, which have no database of
|
||||
-- their own: TLS certificates and ACME account keys. Values are sealed by
|
||||
-- the application. Owner separates platform servers from each
|
||||
-- organization's servers so none can read another's private keys.
|
||||
CREATE TABLE agent_storage (
|
||||
owner text NOT NULL,
|
||||
key text NOT NULL CHECK (length(key) BETWEEN 1 AND 1000),
|
||||
value bytea NOT NULL,
|
||||
modified timestamptz NOT NULL DEFAULT now(),
|
||||
PRIMARY KEY (owner, key)
|
||||
);
|
||||
|
||||
-- Only reached through agent handlers in the system scope.
|
||||
ALTER TABLE agent_storage ENABLE ROW LEVEL SECURITY;
|
||||
ALTER TABLE agent_storage FORCE ROW LEVEL SECURITY;
|
||||
CREATE POLICY agent_storage_system ON agent_storage FOR ALL
|
||||
USING (app_scope_system()) WITH CHECK (app_scope_system());
|
||||
|
||||
-- +goose Down
|
||||
DROP TABLE agent_storage;
|
||||
Reference in new issue
Block a user