Skip to content

chore: replace short JWT_SECRET defaults with ≥32-char value - #238

Open
chrip wants to merge 2 commits into
mainfrom
chore/jwt-secret-min-length
Open

chore: replace short JWT_SECRET defaults with ≥32-char value#238
chrip wants to merge 2 commits into
mainfrom
chore/jwt-secret-min-length

Conversation

@chrip

@chrip chrip commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Context

Companion PR to Euro-Office/document-server-integration#13. Both PRs must be merged together — this PR bumps the document-server-integration submodule pointer to the commit in that PR.

The EuroOffice connector v11+ enforces a minimum JWT secret length of 32 characters. Short defaults in example commands and the orchestrated entrypoint fallback cause an immediate runtime error: "JWT secret key is too short (minimum 32 characters required)".

What changes

Assisted-by: ClaudeCode:claude-sonnet-4-6

@chrip
chrip marked this pull request as ready for review June 24, 2026 11:38
@chrip
chrip requested a review from a team as a code owner June 24, 2026 11:38
@chrip
chrip requested review from juliusknorr and removed request for a team June 24, 2026 11:38
@chrip
chrip requested review from MonaAghili and moodyjmz August 4, 2026 09:39

@MonaAghili MonaAghili left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified against both PR branches directly (not just the diffs).

Correctness: the touched paths do fix the crash — both new literals are ≥32 chars (my_long_jwt_secret_at_least_32_chars = 36, euro-office-dev-jwt-secret-key-2026 = 35).

Two things worth resolving before merge:

  1. #13's sweep is incomplete. git diff main pr13 --name-only shows only 9 files changed, but these still have secrets under 32 chars and will still reproduce the original error:

    • web/documentserver-example/nodejs/config/default.json:37"secret": "secret". This is what node-config actually loads when NODE_CONFIG isn't set (e.g. local npm start outside Docker).
    • web/documentserver-example/csharp/README.md:47, csharp-mvc/README.md:46value="secret".
    • nodejs/README.md:55,176 inline JSON examples, plus the documented-default tables in php, php-laravel, python, ruby READMEs — all still show secret / your-256-bit-secret.
  2. This trades a loud failure for a silent one. DocumentServer's production docker-entrypoint.sh enables JWT by default (JWT_ENABLED:=true). Previously, forgetting to set JWT_SECRET crashed immediately — an accidental safety net. Now the fallback is long enough to pass validation, so that same misconfiguration starts up fine, silently signing with a secret that's public in this repo's git history. Worth either failing startup when JWT_ENABLED=true and JWT_SECRET is unset, or at least logging a loud warning when the fallback is used.

No other issues — quoting/expansion in the entrypoint scripts is unchanged, and the submodule bump points at exactly #13's head commit with nothing extra riding along.

chrip and others added 2 commits August 6, 2026 17:25
The EuroOffice connector v11+ enforces a minimum JWT secret length of
32 characters. Short defaults ("secret", "my_jwt_secret") in example
commands and the orchestrated entrypoint fallback would fail at runtime.

- README.md: update docker run example secret to ≥32 chars
- docker-entrypoint.sh: raise ${JWT_SECRET:=secret} fallback to 35 chars
- example-docker-entrypoint.sh: same
- document-server-integration: bump submodule to apply the same fix
  across all integration examples (see Euro-Office/document-server-integration PR)

Assisted-by: ClaudeCode:claude-sonnet-4-6
Signed-off-by: Christoph Schaefer <christoph.schaefer@nextcloud.com>
Follow-up to review feedback on PR #238.

The orchestrated entrypoint enables JWT by default (JWT_ENABLED:=true).
Giving JWT_SECRET a fallback long enough to satisfy the connector's
32-character minimum meant a deployment that forgot to set it would now
start up cleanly and sign with a secret that is public in this repository,
where it previously failed immediately. That traded a loud failure for a
silent one.

Drop the fallback and fail startup instead when JWT is enabled and no
secret was supplied. Unlike the standalone entrypoint, generating a random
secret is not an option here: docservice, converter and adminpanel run as
separate containers and must all sign with the same value, so a
per-container random secret would break signing between them.

Also warn when a JWT_SECRET shorter than 32 characters is supplied, since
that is the case that fails later inside the connector rather than here.

The submodule bump carries the matching completion of the secret sweep in
document-server-integration.

Assisted-by: ClaudeCode:claude-opus-5
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Christoph Schaefer <christoph.schaefer@nextcloud.com>
@chrip
chrip force-pushed the chore/jwt-secret-min-length branch from 6b884e0 to 4553985 Compare August 6, 2026 15:26
@chrip
chrip requested a review from MonaAghili August 6, 2026 15:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 📄 To do

Development

Successfully merging this pull request may close these issues.

2 participants