Skip to content

Add payload hash to signer JWT claims #356

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 137 commits into
base: sigp-audit-fixes
Choose a base branch
from

Conversation

jclapis
Copy link
Collaborator

@jclapis jclapis commented Aug 12, 2025

⚠️ Do not merge unntil #354 and #353 are in!

This is part 2 of the update on CBST2-01, following #354 and #353. This solves one of the issues found within the audit by making all of the routes with a request body (e.g., the POST routes) encode the Keccak256 hash of the payload body into the JWT claims for the request's auth header. Doing so means JWTs can't be intercepted and reused for unrelated requests, such as for signing different things other than what the original request was for. This affects all routes, including the new /revoke_jwt and /reload ones.

ltitanb and others added 30 commits May 13, 2025 17:17
@jclapis jclapis self-assigned this Aug 12, 2025
@jclapis jclapis added the core Core part of the repo (signer, modules interface) label Aug 12, 2025
})?;

// Make sure the request contains a hash of the payload in its claims
if !body.is_empty() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't this always be true?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, the body is empty for GET requests like /signer/v1/get_pubkeys - since they're still JWT-authenticated, this has to be there to handle them.

@@ -593,6 +633,185 @@ paths:
schema:
type: string
example: "OK"
/reload:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We discussed some time ago if we should include non Signer API endpoints here or not. We can discuss it again though, if you have another point of view

Ref: #231 (comment)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah thank you for the link - I hadn't seen that. I added it since /status was in the docs and that's technically a non-signer route, but I've removed all of the non-signer routes now. We should probably make another doc to cover "root" routes like this. If you want to treat them separately from /status then we should change them to something like /admin/reload instead and have a third doc for them (admin-api.yml maybe?).

@jclapis jclapis mentioned this pull request Aug 13, 2025
The token **must include** the following claims:
- `exp` (integer): Expiration timestamp
- `module` (string): The ID of the module making the request, which must match a module ID in the Commit-Boost configuration file.
- `payload_hash` (string): The Keccak-256 hash of the JSON-encoded request body, with optional `0x` prefix. This is required to prevent JWT replay attacks.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Json is not an ideal serialization format to hash, let's use ssz with the nonce and object root. As an optimization, we could re use that root directly when providing the signature

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, but note that this isn't exclusive to signing requests - any request made to the server with a body (e.g., any request that uses POST) needs to do this, which means we need to define SSZ types for every request and have the user conform to those.

Base automatically changed from augment-sign-requests to sigp-audit-fixes August 19, 2025 19:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Core part of the repo (signer, modules interface)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants