nats-server icon indicating copy to clipboard operation
nats-server copied to clipboard

ADR-0005 JWT Authentication Extensibility

Open philpennock opened this issue 5 years ago • 5 comments

Constrain our server auth nonce selection with a no-op change for the current server code-base, in a way which we guarantee and expect clients to check for, to buy us future proofing.

Noop code-change for the server codebase in this repo.

Changes proposed in this pull request:

  • A protocol constraint which other code can enforce
  • No changes in behavior for the current nats-server code

/cc @nats-io/core

philpennock avatar Jul 01 '20 16:07 philpennock

Hrm, might need text to explain why using a different field in the CONNECT message is not sufficient? The MitM can construct the nonce, get the client to do current-gen nonce signing, then move the response to a different field in talking to the server. Is it worth adding this?

philpennock avatar Jul 01 '20 16:07 philpennock

I decided that the extra text would help so went ahead and added it.

philpennock avatar Jul 01 '20 16:07 philpennock

The current JWT authentication method means that the private key inside a JWT will sign anything at all. This is the source of a whole class of security attacks, basically making the key absolutely unusable for anything else. At present, we're not using it to sign anything else so we're squeaking by. With any desire to do anything else with JWTs, the current signing method will become a CVE-worthy vulnerability to be addressed.

Either we dead-end JWTs to only ever be used exactly as they are now, or we allow for some kind of structured scope which special-cases the current usage. I think that two CPU instructions on connection to not dead-end a technology which we're justly quite proud of is a small price to pay.

philpennock avatar Jul 01 '20 17:07 philpennock

First the private key is never part of the JWT in NATS, they are always public claims. And I agree with signing, but we already have a pattern that utilizes ephemeral signing keys for things beyond basic authentication by signing the nonce.

derekcollison avatar Jul 01 '20 18:07 derekcollison

@philpennock Is this still relevant?

bruth avatar Apr 23 '23 19:04 bruth