Repository navigation
feat(dashboard-api): move Slack secrets to Secrets Manager - #446
Merged
Merged
Conversation
…ack)
The Slack client_secret + signing_secret were PLAINTEXT Lambda environment
variables — readable by anyone with lambda:GetFunctionConfiguration and
surfaced in the console/CLI. Move them into a single Secrets Manager secret
(ARN via SLACK_SECRETS_ARN), fetched once per cold start and cached; the exec
role gets secretsmanager:GetSecretValue on just that ARN.
- slack_secrets.go: loadSlackSecrets() (sync.Once cache) reads the secret JSON
{"client_secret","signing_secret"} and layers it over the legacy env vars;
slackClientSecret()/slackSigningSecret() accessors.
- mergeSlackSecrets(): pure parse+precedence helper, unit-tested (secret wins
when non-empty; env fallback for absent/empty fields; malformed JSON → error
+ fallback untouched).
- Swapped all 5 functional callsites (OAuth callback, token rotate, workspace
store, HMAC state signer, token refresh) from os.Getenv to the accessors.
Backward-compatible by design: with SLACK_SECRETS_ARN unset it falls back to
the existing env vars, so this code deploys BEFORE the secret is wired and the
plaintext env vars are removed only AFTER — no flag-day, no Slack downtime.
scttfrdmn
added a commit
that referenced
this pull request
Jul 28, 2026
Backfills Unreleased entries for #443 (spawn onboard), #444, #445 and #446, which merged without changelog entries, and commits the generated reference for spawn onboard — check-docs only diffs tracked files, so docs-gen/onboard.md was never added when the command landed. Sections reordered to Keep-a-Changelog order (Added first), matching prior releases.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The Slack
client_secret+signing_secretwere plaintext Lambda environment variables — readable by anyone withlambda:GetFunctionConfigurationand surfaced in the console/CLI. (Found while surveying dashboard-api for the portal Slack surface.) This moves them into a single Secrets Manager secret; the exec role getssecretsmanager:GetSecretValueon just that ARN.What
slack_secrets.go—loadSlackSecrets()(async.Oncecache) reads the secret named bySLACK_SECRETS_ARN(JSON{"client_secret","signing_secret"}), fetched once per cold start (these are app-level, effectively static creds — no per-request call). AccessorsslackClientSecret()/slackSigningSecret().mergeSlackSecrets()— pure parse + precedence helper, unit-tested: a non-empty field in the secret wins; an absent/empty field keeps the env fallback; malformed JSON returns the fallback untouched with an error.os.Getenvto the accessors.Backward-compatible by design
With
SLACK_SECRETS_ARNunset, it falls back to the existing env vars. So this code deploys before the secret is wired, and the plaintext env vars are removed only after — no flag-day, no Slack downtime. Deploy sequence: create secret → grant role → deploy this code → setSLACK_SECRETS_ARN→ remove the two plaintext env vars.Tests
slack_secrets_test.gocovers the merge precedence (both/partial/empty-field/empty-object/malformed).go build ./...+go test ./...green.