FORGE-179: agent syncSecrets withholds the DB-routing keys (agent 0.1.110) #1259
No reviewers
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
gmackie/ForgeGraph!1259
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "FORGE-179-agent-secret-denylist"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Issue: FORGE-179, https://tasks.gmac.io/gmacko/issue/FORGE-179
Problem
When a Cloudflare Worker target has
syncSecrets: true, the node agent uploaded every stage secret that itssyncSecretsInclude/syncSecretsExcludeallowed,DATABASE_URLincluded (agent/cmd/agent/worker_secret_filter.gofilterWorkerSecrets, called fromcloudflare_worker.go). A Worker resolves its database fromDATABASE_URLbefore itsHYPERDRIVEbinding, so a synced direct URL points the Worker at a Tailscale host the edge can't reach. That is the 2026-08-30 outage (PR #541): forgegraf.com's DB-backed routes went from 200 to 500.forge secret syncalready skipped these keys (PR #1245,3 skipped), but the agent path did not. EnablingsyncSecretson the one-box target would have repeated the outage.Inventory taken on 2026-11-22 (names only): 7
syncSecretstargets upload aDATABASE_URL*on every deploy today. They are driftport, festigram, test-dojo, controlsfoundry (production and beta), creator and habit-app production. No target'ssyncSecretsIncludenames a withheld key.Change
agent/internal/workersecretswith an embeddedkeys.json. It covers the keys no Worker may receive (DATABASE_URL,DATABASE_URL_LOCAL,DATABASE_OWNER_PASSWORD), the production-only keys, and the sharedWithheldReason(key, stage).forge secret sync,forge secret importand the agent'sfilterWorkerSecretsall read it, and their private copies are removed. A test fails if another Go file spells out the list again.syncSecretsIncludecan't opt back in. A withheld key that the include list names stays withheld, and the agent log and deploy journal get aWARNINGthat names the key and the outage. Keys already on a Worker are left alone, because sync never deletes.workerSecretFilterErrorrefuses a target config whosesyncSecretsIncludenames a forbidden key. This covers config apply, target add and target update. A vitest keepsWORKER_FORBIDDEN_SECRET_KEYSequal tokeys.json.syncSecretsis not enabled on any target.Acceptance criteria
syncSecretstarget without an allowlist no longer receivesDATABASE_URL*on deploy, and the journal names those keys as withheld. Tests:TestSyncSecretsOnOneBoxNeverDeliversDatabaseURLandTestSyncSecretsWithholdsProductionOnlyKeysOffOtherStages.TestAgentAndCLIAgreeOnEveryKey,TestSecretSyncUsesTheSharedWithholdList,TestNoSecondCopyOfTheList, and the TS parity test.TestSyncSecretsIncludeCannotOptInToAWithheldKey, plus the TS "refuses a target config…" test.Synced N secretswith the same 3 skipped.Checks run locally
go vet ./...andgo test ./...inagent/pass.tsc --noEmitpasses for packages/api, and so doestraffic-canary-secrets.test.ts(37 tests).TestRunReportedDeploymentCancelsAnAbortedDeploysRunningStepis timing-flaky on a loaded Mac and fails on unmodified main too.🤖 Generated with Claude Code
bc9da5087e67c05c539b