Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ private val INSECURE_JWT_DEFAULTS = setOf(
)

private val INSECURE_ENCRYPTION_DEFAULTS = setOf(
"0123456789abcdef"
"0123456789abcdef",
"change-this-16-char-key-for-prod"
)

@Component
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,13 @@ class StartupSecurityValidatorTest {
)
assertThrows<IllegalStateException> { validator.validate() }
}

@Test
fun `validate throws when ENCRYPTION_KEY is the docker-compose fallback default`() {
val validator = createValidator(
jwtSecret = "secure-jwt-secret",
encryptionKey = "change-this-16-char-key-for-prod"
)
assertThrows<IllegalStateException> { validator.validate() }
}
}
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ services:
DATABASE_URL: jdbc:postgresql://postgres:5432/opendatamask
DATABASE_USERNAME: opendatamask
DATABASE_PASSWORD: opendatamask
JWT_SECRET: ${JWT_SECRET:-change-this-secret-in-production-must-be-at-least-256-bits-long}
ENCRYPTION_KEY: ${ENCRYPTION_KEY:-change-this-16-char-key-for-prod}
JWT_SECRET: ${JWT_SECRET:?JWT_SECRET must be set (generate with: openssl rand -base64 32)}
ENCRYPTION_KEY: ${ENCRYPTION_KEY:?ENCRYPTION_KEY must be set (generate with: openssl rand -base64 32)}
SERVER_PORT: 8080
depends_on:
postgres:
Expand Down
Loading