Woodpecker repo secrets sit in the database in plaintext, and cannot be encrypted in v3.18.0 #1345

Open
opened 2026-10-27 13:40:01 +00:00 by sam · 0 comments
Owner

Found 2026-09-21 while diagnosing a CI failure that had a different cause (see archie-core-cyoq). Retitled after going to source: the original framing assumed a missing key was a misconfiguration, and it is not.

FACT

  • The Woodpecker server on carina runs with no WOODPECKER_ENCRYPTION_KEY (not in the container env; no ENCRYPT line in /opt/woodpecker/.env). server_configs holds only signature-private-key and jwt-secret.
  • Secret values are stored in PLAINTEXT in the sqlite DB. Stored lengths match the plaintext lengths exactly: registry_user 3, registry_token 40, ssh_key 431, public_pocketbase_url 24.

WHY THE KEY CANNOT SIMPLY BE SET (corrected from source, v3.18.0 tag, identical in HEAD)

  • server/services/setup.go setupSecretService() returns secret.NewDB(store) directly; the encrypted-store wrapper is COMMENTED OUT with "// TODO(1544): fix encrypted store".
  • Repo-wide there are NO live call sites of encryption.Encryption(...), NewSecretStore, EnableEncryption or MigrateEncryption.
  • Therefore WOODPECKER_ENCRYPTION_KEY (and the Tink keyset var) are NO-OPS in v3.18.0. Secrets are plaintext and read as-is. The absent key is expected, not the cause of any empty-secret symptom (that was the braced-expression mistake, fixed).

WHY IT STILL MATTERS

  • The DB also holds repo configuration for every repo on the server. Anyone who can read the DB file gets working registry credentials and a deploy private key in the clear, and that key is authorised for root@nebula.

REAL OPTIONS (ranked by the infra lane)
(c) Compensate in-version: the sqlite lives in a root-owned docker volume on carina, so restrict host and volume access and treat it as a secret in backup policy. Cheapest, no migration.
(a) Upgrade to a release where the encrypted store is wired, then set the key. Existing rows go through the enable/migrate path - a ONE-WAY DB transformation across every repo including repo 1's ssh_key. The key must be backed up, and it must be rehearsed on a copy first.
(b) Keep secrets out of the DB in-version via WOODPECKER_SECRET_EXTENSION_ENDPOINT (external HTTP secret service; extension values take priority over DB values), if an external secret store is wanted for other reasons.

NOT A BLOCKER for anything currently in flight.


Imported from beads archie-core-gsr4 · GitHub #1111 · type chore · priority P2 · created 2026-09-21

Found 2026-09-21 while diagnosing a CI failure that had a different cause (see archie-core-cyoq). Retitled after going to source: the original framing assumed a missing key was a misconfiguration, and it is not. FACT - The Woodpecker server on carina runs with no WOODPECKER_ENCRYPTION_KEY (not in the container env; no ENCRYPT line in /opt/woodpecker/.env). server_configs holds only signature-private-key and jwt-secret. - Secret values are stored in PLAINTEXT in the sqlite DB. Stored lengths match the plaintext lengths exactly: registry_user 3, registry_token 40, ssh_key 431, public_pocketbase_url 24. WHY THE KEY CANNOT SIMPLY BE SET (corrected from source, v3.18.0 tag, identical in HEAD) - server/services/setup.go setupSecretService() returns secret.NewDB(store) directly; the encrypted-store wrapper is COMMENTED OUT with "// TODO(1544): fix encrypted store". - Repo-wide there are NO live call sites of encryption.Encryption(...), NewSecretStore, EnableEncryption or MigrateEncryption. - Therefore WOODPECKER_ENCRYPTION_KEY (and the Tink keyset var) are NO-OPS in v3.18.0. Secrets are plaintext and read as-is. The absent key is expected, not the cause of any empty-secret symptom (that was the braced-expression mistake, fixed). WHY IT STILL MATTERS - The DB also holds repo configuration for every repo on the server. Anyone who can read the DB file gets working registry credentials and a deploy private key in the clear, and that key is authorised for root@nebula. REAL OPTIONS (ranked by the infra lane) (c) Compensate in-version: the sqlite lives in a root-owned docker volume on carina, so restrict host and volume access and treat it as a secret in backup policy. Cheapest, no migration. (a) Upgrade to a release where the encrypted store is wired, then set the key. Existing rows go through the enable/migrate path - a ONE-WAY DB transformation across every repo including repo 1's ssh_key. The key must be backed up, and it must be rehearsed on a copy first. (b) Keep secrets out of the DB in-version via WOODPECKER_SECRET_EXTENSION_ENDPOINT (external HTTP secret service; extension values take priority over DB values), if an external secret store is wanted for other reasons. NOT A BLOCKER for anything currently in flight. --- _Imported from beads `archie-core-gsr4` · GitHub #1111 · type chore · priority P2 · created 2026-09-21_
sam added the mediumchore labels 2026-10-27 13:40:01 +00:00
sam self-assigned this 2026-10-27 13:40:01 +00:00
sam added the deferred label 2026-11-15 17:26:19 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sam/archie#1345