Production mode shouldn't have a default JWT signing secret
Nobody has claimed this yet.
- Dominant language
- Elixir
- Stars
- 296
- Forks
- 86
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 50
Description
Details
Currently when generating User API tokens, they are signed using Jokens default signer, which is signed with a string of secret.
This means that tokens can be forged.
Fortunately we verify that the token exists in the database, and we use the jti claim making it's all but impossible to produce a token with the same signature.
However if at some point we verify tokens without querying the database, then this would be a security vulnerability.
Implementation notes
At the very least we need to have prod.exs set the Joken default signer to nil, and then use an environment variable to set the signing secret.
In order to avoid issues with defaults, perhaps adopting the same pattern as the worker tokens - where the signer is not defined in config/ and rather inside Lightning.Config.
Release notes
User acceptance criteria
The application should fail to start in production mode without a API_TOKEN_SIGNING_SECRET env var.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading prod.exs and Lightning.Config, then compare how the worker-token signer is configured. Check the production startup path with and without API_TOKEN_SIGNING_SECRET. Done means production refuses to start without the environment variable and uses the provided secret when it is present.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- elixir
- Domain
- authentication, security
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100