Skip to content

fix: refuse the example secrets everywhere and correct the README claims - #176

Merged
Bccorb merged 2 commits into
mainfrom
docs/readme-secret-and-svelte-ssr
Dec 4, 2026
Merged

Bccorb merged 2 commits into
mainfrom
docs/readme-secret-and-svelte-ssr

Conversation

@Bccorb

@Bccorb Bccorb commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

Closes #161

Example secrets

The .env.example values (dev-only-cookie-signing-key-replace-me, 38 characters, and GRAB_FROM_SEAMLESS_AUTH_PORTAL_DEV, 34 characters) pass the 32 character minimum, but every Seamless adapter refuses them as published placeholders unless it runs in insecure local mode (cookieSecure: false, InsecureCookies, insecure_cookies). No starter enables that mode, so a hand-copied .env.example never boots. Sources: KNOWN_PLACEHOLDER_SECRETS and assertSecretStrength in seamless-auth-server/packages/core/src/validateSecrets.ts (in every pinned adapter version: express 0.25, fastify 0.16, nextjs 0.11), and the equivalent lists in seamless-auth-go 0.6, seamless-auth-rust 0.6 and seamless-auth-python 0.6.

  • Express, Fastify, Gin, Axum and FastAPI READMEs: after cp .env.example .env, a note that both secrets are placeholders the adapter refuses, with openssl rand -base64 48 for COOKIE_SIGNING_KEY and the rule for SEAMLESS_SERVICE_TOKEN (portal value, or the local auth server's API_SERVICE_TOKEN). Each later cp .env.example .env block carries a comment pointing at it.
  • Fastify: removed "long enough to boot and nothing more". Express and Fastify: the "Local path" paragraph no longer says cp .env.example .env is enough.
  • Next.js README: the same note under "Run it". The adapter fails on /auth requests rather than at boot, since its configuration is read per request, and the note says that.
  • All six .env.example files: the comments no longer say the cookie key is accepted in development or that the service token "only gets the API to boot". The values are unchanged, because the adapters and each template's own boot check recognise exactly these strings and name the fix.

Svelte session

This repo's SvelteKit README never prescribed a singleton; the module-level example the issue describes is the @seamless-auth/svelte package README in seamless-auth-js, which already pairs it with ssr = false and a "Server rendering" section. The template README now has a "Where the session lives" section: the module-level session in src/lib/auth.ts is safe only because src/routes/+layout.ts sets ssr = false, and under server rendering the session must be created per request with initialSession from the adapter, linking the package README's section.

Startup checks

The template startup checks (src/lib/env.ts in Express and Fastify, src/lib/config.ts in Next.js, config.go, config.rs, config.py) let a placeholder through outside production (the API starters logged "That is fine for local development"; Next.js skipped the check), and the adapter then refused it. They now report both placeholders as problems in every environment, next to any other problem, with the openssl rand -base64 48 fix. The tests that asserted the development allowance now assert the refusal.

Checks

Each starter's full gate passes: npm run check in Express, Fastify and Next.js; gofmt, go vet and go test in Gin; cargo fmt --check, clippy -D warnings and cargo test in Axum; ruff, mypy and pytest in FastAPI. npm run validate and npm run format:check at the root (pre-commit hook), Svelte format:check, the Express and Fastify env.test.ts, the Next.js config.test.ts and the Axum config tests, which read .env.example: all pass. Patch changeset included, since these files ship in scaffolded projects.

…lte session

Every Seamless adapter refuses the .env.example COOKIE_SIGNING_KEY and
SEAMLESS_SERVICE_TOKEN as published placeholders unless it runs in insecure
local mode, which no starter enables. The READMEs and .env.example comments
now say to replace both before the first start. The SvelteKit README explains
that its module-level session is safe only with ssr = false.
The starters' startup checks logged that the .env.example secrets were fine
for local development, and the adapter then refused them. They now report
both placeholders as problems in every environment, with the fix.
@Bccorb Bccorb changed the title docs: say the example secrets are refused and how SSR changes the Svelte session fix: refuse the example secrets everywhere and correct the README claims Dec 4, 2026
@Bccorb
Bccorb merged commit ef6ccd1 into main Dec 4, 2026
5 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.

docs: correct README claims about example secrets and the Svelte auth singleton

1 participant