chore(security): rotate brain_app postgres password + migrate BRAIN_PG_DSN from SOPS to 1Password via ESO #30
Closed
opened 2026-05-27 10:53:54 +00:00 by mathias
·
1 comment
No Branch/Tag Specified
main
fix/pipeline-writes-158
fix/edit-path-io-192
fix/create-regular-188
fix/guard-special-179
fix/linkcheck-keeps-write-178
fix/write-dir-redirect-173
fix/tunnel-detect-174
fix/pipeline-root-157
w3/154-mcp-auth-wiring
fix/tunnel-traversal
test/in-brain-targets-171
fix/brain-scan-root-157
fix/graph-wiki-root-157
fix/vectorstore-root-157
fix/notes-root-157
fix/search-root-157
fix/brainwide-root-157
fix/raw-symlinks-153
feat/symlink-tripwire-157
fix/rest-auth-149
fix/123-brain-edit-envelope-check
feat/106-page-aware-extraction
fix/105-source-drift-on-main
fix/104-surface-merge-conflicts-on-main
agent/b1-compile-on-ingest
agent/104-surface-merge-conflicts
agent/105-source-drift
agent/107-loud-unconfigured-alerting
feat/brain-read-edit
fix/capture-i1-refusal-names-target
renovate/configure
feat/consolidate-single-harness
icebox/cmd-routing
feat/brain-pending-promote
fix/close-session-classification-refresh
fix/capture-summarywriter
v0.24.0
v0.23.1
v0.23.0
v0.22.0
v0.21.1
v0.21.0
v0.20.1
v0.20.0
v0.19.1
v0.19.0
v0.18.4
v0.18.3
v0.18.2
v0.18.1
v0.18.0
v0.17.0
v0.16.1
v0.16.0
v0.15.0
v0.14.0
v0.13.2
v0.13.1
v0.13.0
v0.12.1
v0.12.0
v0.11.2
icebox/cmd-routing-2026-07-01
v0.11.1
v0.11.0
v0.10.0
v0.9.0
v0.8.0
v0.7.0
v0.6.0
v0.5.0
v0.4.1
v0.4.0
v0.3.0
v0.2.0
v0.1.0
Labels
Clear labels
agent/ready
blocked/client
blocked/supplier
blocked/upstream
risk/high
risk/low
risk/medium
size/l
size/m
size/s
size/xs
status:dispatch
status:dispatched
status:review
status:reviewing
type/chore
type/decision
type/docs
type/feat
type/fix
type/ops
type/research
type/test
Meets the agent-ready contract; authorizes unattended execution
Waiting on the client
Waiting on a supplier
Waiting on an upstream project or vendor
Irreversible, security-relevant, or control plane
Reversible, local, test-covered
Touches shared state, deploys or data
Too big - split it
Under two days
Under half a day
Under an hour
Maintenance, no behaviour change
Human decision required; never agent/ready
Documentation only
New capability
Corrects broken behaviour
Infrastructure, deploy, runtime
Investigate; output is a finding, not code
Test coverage only
No labels
Milestone
No items
No Milestone
Projects
Clear projects
No projects
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: mathias/hyperguild#30
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Context
Supersedes #20. The original
cmd/server/main.goredaction forBRAIN_PG_DSNwas wrong — it sliced up to@, which is after the password in a Postgres URL, so the password landed in the structured log line of the ingestion pod under image7a13c756...on 2026-05-18 → 2026-05-19. Fixed in4af10364viaurl.URL.Redacted(). Old log lines remain inkubectl logs --previoushistory and any sink container logs ship to until retention rolls off (typically 7–14 days; longer if shipped to a SIEM).Since #20 was filed, External Secrets Operator + 1Password Connect went live (
ClusterSecretStore/onepassword, HomeLab vault).BRAIN_PG_DSNis still on the old SOPS path (k3s/apps/supervisor/secrets.enc.yaml) and referenced assecretKeyRef: supervisor-secretsiningestion-deployment.yaml. Rotate + migrate in the same change so future rotations are 1P-only with no git commit needed.Action
ALTER ROLE)::'password'does its own quoting.)HomeLab, itemBRAIN_PG_DSN, fieldpassword:k3s/apps/supervisor/brain-pg-dsn-externalsecret.yamlmirroringbrain-mcp-token-externalsecret.yaml:ingestion-deployment.yamlBRAIN_PG_DSN env block:secretKeyRef.name: supervisor-secrets→brain-pg-dsn.BRAIN_PG_DSNfromk3s/apps/supervisor/secrets.enc.yaml(re-sops without the key;CLAUDE_INGEST_CLIENT_BLOCKstays — separate migration).k3s/apps/supervisor/kustomization.yaml.secrets-revisionannotation oningestion-deployment.yamlto roll the pod.flux get kustomization apps --watch).rm /tmp/brain_app_pg.pwd.Acceptance criteria
brain_apppassword generated, full DSN stored only in 1Password HomeLab vaultBRAIN_PG_DSNremoved fromsecrets.enc.yamlkubectl get externalsecret -n supervisor brain-pg-dsnshowsSecretSynced=Truebrain hybrid retrieval enabledlog line, no auth errors)/tmp/brain_app_pg.pwddeletedkubectl delete podafter retention concern eases to flush leaked log lines soonerFollow-up (out of scope)
CLAUDE_INGEST_CLIENT_BLOCKto 1Password, retiresecrets.enc.yamlentirely.Severity
Low — the leak was internal-only (kubectl logs require cluster admin), and the affected DB sits behind Tailscale. Worth doing as hygiene, not urgent. Migration win is the real value: future rotations become a 1P field edit, no commit.
Done — commit
b048594on infra/main.ALTER ROLE brain_appinpostgres18-0, verified withpsql -U brain_app -d brain(1 row)BRAIN_PG_DSN, fieldpasswordbrain-pg-dsnExternalSecret reconciledSecretSynced=TrueBRAIN_PG_DSNremoved fromsecrets.enc.yaml,CLAUDE_INGEST_CLIENT_BLOCKretainedbrain hybrid retrieval enabledwith redacted DSN (xxxxx)embed sync added=14 deleted=0 errors=0— DB writes workingappsKustomizationReady=Trueat revisionb0485949/tmp/brain_app_pg.pwdshreddedAcceptance criteria met. Closing.
Follow-up: migrate
CLAUDE_INGEST_CLIENT_BLOCKto 1P and retiresecrets.enc.yaml(separate issue).