Repository navigation
fix(security): treat known dev JWT secrets as placeholders - #895
Merged
Merged
Conversation
ensureJWTSecret only refused the exact 'change-me-in-production' default, and any non-empty SP_AUTH_JWT_SECRET short-circuited it. The repository's dev docker-compose.yml ships 'dev-secret-change-in-production' — a publicly-known constant that passed both guards, so copying the dev compose into production yielded a world-readable JWT signing key (session forgery). Add config.IsPlaceholderJWTSecret (empty + both known public constants) and use it in ensureJWTSecret (env included: a placeholder env value now falls through to the stored/generated secret with a warning) and in the OVH SMS DLR token derivation. Label the dev compose file as development-only. Refs #892 (finding 4)
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #895 +/- ##
==========================================
- Coverage 90.74% 90.71% -0.04%
==========================================
Files 1370 1370
Lines 140857 140915 +58
==========================================
+ Hits 127821 127825 +4
- Misses 13027 13081 +54
Partials 9 9
🚀 New features to boost your workflow:
|
fclairamb
enabled auto-merge (squash)
November 16, 2026 00:15
This was referenced Nov 16, 2026
Merged
fclairamb
added a commit
that referenced
this pull request
Nov 16, 2026
🤖 I have created a release *beep* *boop* --- ## [0.51.0](v0.50.2...v0.51.0) (2026-11-16) ### Features * Pingdom check importer, insights period selector, job retry log levels ([#904](#904)) ([7914164](7914164)) ### Bug Fixes * **security:** bound status page historyDays, mask config tokens in replay, JS websocket redirect policy, docs JWT placeholders ([#903](#903)) ([6b432e0](6b432e0)) * **security:** cap the pre-auth body buffer in ServiceSignature ([#894](#894)) ([c4da4c5](c4da4c5)), closes [#892](#892) * **security:** cross-check SAML NameID namespace (GO-2026-6909) ([#896](#896)) ([df0d7b6](df0d7b6)) * **security:** treat known dev JWT secrets as placeholders ([#895](#895)) ([1cad98a](1cad98a)), closes [#892](#892) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --------- Co-authored-by: Claude Sonnet 5.5 <[email protected]>
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.
What
Fixes finding 4 of the security review #892 (known dev JWT secret passes the placeholder check).
ensureJWTSecretauto-generated a secret only when the configured value was empty or exactlychange-me-in-production, and any non-emptySP_AUTH_JWT_SECRETshort-circuited it. The repo's devdocker-compose.ymlsetsSP_AUTH_JWT_SECRET=dev-secret-change-in-production— a publicly-known constant that passed both guards. An operator copying the dev compose into production would run with a world-readable JWT signing key → session forgery for any account. (The published docs' production compose example omits the variable, so auto-generation covers that path — this closes the copy-the-dev-file path.)Fix
config.IsPlaceholderJWTSecret(secret): true for"",DefaultJWTSecretand the newDevJWTSecretconstant. One predicate shared by every guard, so a future known-unsafe constant is refused everywhere at once.ensureJWTSecret: a placeholder env value no longer short-circuits — it logs a warning and falls through to the stored secret, or generates and persists a real one. A real env secret still wins over everything (unchanged). The startup overlay always runsensureJWTSecretright after applying env/DB, so the placeholder cannot survive boot.ovhsmscb.ResolveTokenuses the same predicate (never derive the DLR path token from a public constant).docker-compose.ymlgets a DEVELOPMENT ONLY header and an inline comment on the secret line.Tests
config:TestIsPlaceholderJWTSecret(placeholders vs real secrets).systemconfig:TestEnsureJWTSecretKnownPlaceholders— dev constant in config reloads from DB; placeholder env (both constants) does not short-circuit; with no stored secret a real one is generated. ExistingTestEnsureJWTSecret(real env short-circuit) stays green.ovhsmscb:TestResolveTokenloop extended to the dev constant (trimmed variants included).go test ./internal/config/ ./internal/systemconfig/ ./internal/handlers/ovhsmscb/green,golangci-lint0 issues on the touched packages,go build ./...OK, compose YAML validated.Refs #892