Skip to content

Suggestion: require AUTH_TOKEN instead of a default - #55

Open
JAG-UK wants to merge 1 commit into
mainfrom
suggestion/require-auth-token
Open

JAG-UK wants to merge 1 commit into
mainfrom
suggestion/require-auth-token

Conversation

@JAG-UK

@JAG-UK JAG-UK commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

This is a suggestion from a security read-through of the repo, not a required fix. Merge, change or close as you see fit.

What

If AUTH_TOKEN is not set, the service falls back to a default token that is written in this public repo (DEFAULT_AUTH_TOKEN in src/config.rs). Anyone could then call the deal write endpoints (PUT /deals/{id}, POST /deals/{id}/runs) with it.

Production sets AUTH_TOKEN from a secret, so this is not exploitable today. The change makes the service refuse to start when the variable is missing, so a deployment that loses it fails loudly instead of quietly accepting a known token.

Changes

  • src/config.rs: remove the default; panic at startup with AUTH_TOKEN must be set.
  • docker-compose.yml: pass AUTH_TOKEN (default dev-token, matching .env.example) so local docker compose up still starts.

Worth knowing before merging

  • Any environment without AUTH_TOKEN will stop starting. Check staging and anyone's local setup.
  • If the default token was ever used by a real deployment, treat it as leaked.
  • Not included: the comparison in src/auth.rs is a plain string compare, not constant-time. Low priority; happy to add it if wanted.

Testing

cargo fmt --check, cargo clippy --workspace and the config unit tests pass locally. The integration tests were not run locally (CI runs them).

🤖 Generated with Claude Code

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@JAG-UK
JAG-UK deployed to production-fidl November 26, 2026 13:31 — with GitHub Actions Active

This branch was successfully deployed

1 active deployment
production-fidl — c0734c16 Deployed Nov 26, 2026 by JAG-UK via build-and-publish / build_and_push #203
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.

1 participant