Repository navigation
fix!: verify the challenge signature over a prefixed payload - #34
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
`/authenticate` now verifies the signature over `hc-auth-challenge-v1:` followed by the decoded `/now` payload, so the signature is valid for this purpose only. A signature over the bare payload is refused, so clients must sign the prefixed form.
11a2c78 to
dd2944f
Compare
Because otherwise you can get the client to sign anything with their agent-key. This make what they are signing match only the purpose of this challenge. E.g. a compromised auth-server could get an agent to sign what ever it wanted (e.g. an action). This is a "security-in-depth" addition, low likelyhood. |
|
Got it, so the client inserts the prefix itself before signing. I would like to avoid having the prefix magic string manually defined in multiple projects that need to include an auth client. But also we don't want them to need to import this whole crate. Could we split out a 'client' or 'types' crate that includes the magic string and functions to sign a payload with it? Then the runtime-tauri can import it. |
A client can now depend on hc-auth-types, which has no dependencies, and does not need its own copy of the prefix. challenge_signing_bytes takes a 32 byte array, so the type refuses a challenge of any other length.
|
✔️ dd2944f...5e2204c - Conventional commits check succeeded. |
The prefix and the challenge length now come from the hc-auth-types crate in holochain/hc-auth-server, so this repo has no copy of them. The crate is not on crates.io. The git rev is the head of holochain/hc-auth-server#34 and must move to the merge commit.
The prefix and the challenge length now come from the hc-auth-types crate in holochain/hc-auth-server, so this repo has no copy of them. The crate is not on crates.io. The git rev is the head of holochain/hc-auth-server#34 and must move to the merge commit.
The prefix and the challenge length now come from the hc-auth-types crate in holochain/hc-auth-server, so this repo has no copy of them. The crate is not on crates.io. The git rev is the head of holochain/hc-auth-server#34 and must move to the merge commit.
/authenticatenow verifies the signature overhc-auth-challenge-v1:followed by the decoded/nowpayload, and refuses a signature over the bare payload.Why
A client signs the nonce
/nowpayload with its Holochain agent key. Signing any payload is broader scope than needed for the authentication handshake. The prefix makes the signature useless for anything except this handshake.Breaking
A client that signs the bare payload now gets
401. There is no transition path that accepts both forms. Matching client change is in holochain/runtime-tauri (branchfix/hc-auth-domain-separated-challenge).Changes
routes_client.rs:CHALLENGE_SIGNING_PREFIX,challenge_signing_bytes, and the verify call. Unit tests for the prefixed form, the bare form, a wrong length, and a wrong key.examples/client.rs: signs the prefixed form.README.md: states what the signature must cover.AI disclosure
The code, tests, commit message were written by an LLM and reviewd by me. This PR was drafted by an LLM and hand edited for brevity and clarity.