From 87dad4c89b09f4d9af055674e296e08b263036db Mon Sep 17 00:00:00 2001 From: unkin-agent Date: Sun, 29 Nov 2026 17:45:07 +1100 Subject: [PATCH] Encrypt artifactapi GitHub App keys with Vault transit (#616) artifactapi stores GitHub App private keys in Postgres in plaintext. It can now encrypt them with a Vault transit key, logging in via Kubernetes auth. - enable transit encryption of GitHub App keys on the api Deployment - point it at Vault (`k8s/au/syd1` role `artifactapi`, transit key `artifactapi-github-app-keys`) using the combined CA bundle - mount a projected SA token with audience `vault` for the login Requires IUCLabs/terraform-vault#15 applied and an artifactapi release containing IUCLabs/artifactapi#22. Reviewed-on: https://git.unkin.net/unkin/argocd-apps/pulls/616 Co-authored-by: unkin-agent Co-committed-by: unkin-agent --- apps/base/artifactapi/api-deployment.yaml | 28 +++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/apps/base/artifactapi/api-deployment.yaml b/apps/base/artifactapi/api-deployment.yaml index 2a492fb..6f99d26 100644 --- a/apps/base/artifactapi/api-deployment.yaml +++ b/apps/base/artifactapi/api-deployment.yaml @@ -42,6 +42,23 @@ spec: - containerPort: 8000 name: http protocol: TCP + env: + - name: GITHUB_APP_KEY_ENCRYPTION + value: transit + - name: VAULT_ADDR + value: https://vault.service.consul:8200 + - name: VAULT_CACERT + value: /etc/ssl/combined/ca-certificates.crt + - name: VAULT_K8S_MOUNT + value: k8s/au/syd1 + - name: VAULT_K8S_ROLE + value: artifactapi + - name: VAULT_K8S_TOKEN_PATH + value: /var/run/secrets/vault/token + - name: VAULT_TRANSIT_MOUNT + value: transit + - name: VAULT_TRANSIT_KEY + value: artifactapi-github-app-keys envFrom: - configMapRef: name: api-env @@ -53,6 +70,9 @@ spec: - name: combined-certs mountPath: /etc/ssl/combined readOnly: true + - name: vault-token + mountPath: /var/run/secrets/vault + readOnly: true livenessProbe: failureThreshold: 3 httpGet: @@ -89,4 +109,12 @@ spec: path: ca.crt - name: combined-certs emptyDir: {} + # The default kubernetes.io token has the wrong audience for Vault login. + - name: vault-token + projected: + sources: + - serviceAccountToken: + path: token + audience: vault + expirationSeconds: 600 restartPolicy: Always