Skip to content

fix(extensions-library): require PAPERLESS_SECRET_KEY instead of defaulting to 'change-me'#526

Merged
Lightheartdevs merged 1 commit intoLight-Heart-Labs:resources/devfrom
yasinBursali:ext/paperless-secret-key
Mar 23, 2026
Merged

fix(extensions-library): require PAPERLESS_SECRET_KEY instead of defaulting to 'change-me'#526
Lightheartdevs merged 1 commit intoLight-Heart-Labs:resources/devfrom
yasinBursali:ext/paperless-secret-key

Conversation

@yasinBursali
Copy link
Copy Markdown
Contributor

@yasinBursali yasinBursali commented Mar 21, 2026

What

Replace the default change-me value for PAPERLESS_SECRET_KEY with a :? guard that forces explicit configuration.

Why

The SECRET_KEY was defaulting to the well-known string change-me via ${:-change-me}, allowing session/CSRF token forgery. Django uses this key for cryptographic signing of sessions, CSRF tokens, and password reset tokens.

How

Switch from ${PAPERLESS_SECRET_KEY:-change-me} to ${PAPERLESS_SECRET_KEY:?...} so Compose fails fast when the variable is unset. The error message includes a generation command. The entire env var line is quoted to prevent YAML parsing issues with the colon in the error message.

Scope

All changes are within resources/dev/extensions-library/.

  • services/paperless-ngx/compose.yaml — 1 line changed

Testing

  • YAML validation: python3 -c "import yaml; yaml.safe_load(...)" passed
  • Critique Guardian: REJECTED initial version (colon broke YAML), fixed with quoting, re-verified

Review

Critique Guardian verdict: APPROVED (after fix)

Merge Order

…ulting to 'change-me'

The SECRET_KEY was defaulting to the well-known string 'change-me' via
${:-change-me}, allowing session/CSRF token forgery. Switch to ${:?...}
so compose fails fast when the variable is unset, forcing the deployer
to generate a proper secret.

Closes Light-Heart-Labs#78

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@Lightheartdevs Lightheartdevs merged commit 1731e5d into Light-Heart-Labs:resources/dev Mar 23, 2026
12 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants