Skip to content

chore: replace short JWT_SECRET examples with ≥32-char value - #13

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

chore: replace short JWT_SECRET examples with ≥32-char value#13
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/DocumentServer#238 (see below). Both PRs must be merged together — the DocumentServer PR bumps the submodule pointer to the commit introduced here.

The EuroOffice connector v11+ (OCA\Eurooffice\Crypt) enforces a minimum JWT secret length of 32 characters. All example defaults in this repo ("secret", "your-256-bit-secret") were under this limit and cause an immediate runtime error: "JWT secret key is too short (minimum 32 characters required)".

What changes

All example compose files, entrypoints, .env.example, and README snippets — replaced with euro-office-dev-jwt-secret-key-2026 (35 chars). Updated the Readme.md security note to no longer reference the old literal.

Affected files: docker-compose.yml, Readme.md, web/documentserver-example/{go,nodejs,php,php-laravel,python,ruby}

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

@MonaAghili MonaAghili left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Checked out the chore/jwt-secret-min-length branch directly (not just the diff) to verify the "all example compose files, entrypoints, .env.example, and README snippets" claim.

Correctness: euro-office-dev-jwt-secret-key-2026 is 35 chars, so every file this PR actually touches does fix the crash.

The sweep is incomplete. git diff main chore/jwt-secret-min-length --name-only shows exactly 9 files changed, but the following still have secrets under 32 chars and will still reproduce the original "JWT secret key is too short" 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. running the nodejs example locally with npm start, outside Docker) — the entrypoint script fix doesn't cover this path.
  • web/documentserver-example/csharp/README.md:47 and csharp-mvc/README.md:46value="secret", untouched.
  • web/documentserver-example/nodejs/README.md:55,176 — inline JSON examples still show "secret": "secret".
  • The documented-default tables in php/README.md:76, php-laravel/README.md:116, python/README.md:77, ruby/README.md:75 still list your-256-bit-secret as the default, even though the corresponding compose/.env.example files in this same PR were bumped — so the docs and the actual runtime default now disagree.

Recommend either finishing the sweep across csharp/csharp-mvc/nodejs's default.json and the four stale README tables, or centralizing on one referenced placeholder value so this doesn't drift again.

Separately (tracked more on the DocumentServer#238 side, but relevant here since it's the same default value): making the fallback long enough to pass validation means a deployment that forgets to set JWT_SECRET now starts successfully instead of failing loudly, since DocumentServer's production entrypoint enables JWT by default. Worth considering whether these example configs should keep a placeholder value at all versus requiring the user to supply one.

chrip and others added 2 commits August 6, 2026 17:25
The EuroOffice connector v11+ enforces a minimum JWT secret length of
32 characters. All example defaults ("secret", "your-256-bit-secret")
were under this limit and would fail immediately at runtime.

Replace with "euro-office-dev-jwt-secret-key-2026" (35 chars) in all
compose files, entrypoints, .env.example, and READMEs. Update the
Readme security note to no longer reference the old short literal.

Assisted-by: ClaudeCode:claude-sonnet-4-6
Signed-off-by: Christoph Schaefer <christoph.schaefer@nextcloud.com>
…ecret

Follow-up to review feedback on PR #13.

Replace the remaining sub-32-character secrets so the repository no longer
ships a value that trips the connector's 32-character minimum:

- nodejs/config/default.json: this is what node-config actually loads when
  NODE_CONFIG is unset (running the example with `npm start`, outside
  Docker), so the entrypoint fix alone did not cover it.
- README snippets users copy verbatim: nodejs, csharp, csharp-mvc, java and
  java-spring.
- The "Example" column for JWT_SECRET in the php, php-laravel, python and
  ruby READMEs. These document an example rather than a default (the
  default in all four is an empty string, meaning JWT off), but the value
  shown was 19 characters and fails as soon as it is copied.
- The env round-trip test fixtures, so that grepping for the old literals
  now returns nothing and the sweep stays verifiable.

php-laravel's SettingsManager defaulted DOCUMENT_SERVER_JWT_SECRET to
"secret", and it derives jwt.enabled from that value being truthy. That
turned JWT on by default with a 6-character secret. Default it to an empty
string instead, matching the php, python and ruby examples, so JWT stays
off unless a secret is supplied rather than on with a public placeholder.

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 41183fb to cd05dc9 Compare August 6, 2026 15:26
@chrip
chrip requested a review from MonaAghili August 6, 2026 15:30
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