validate required fields before hashing relay request params#2032
validate required fields before hashing relay request params#2032
Conversation
|
👋 nadahalli, thanks for creating this pull request! To help reviewers, please consider creating future PRs as drafts first. This allows you to self-review and make any final changes before notifying the team. Once you're ready, you can mark it as "Ready for review" to request feedback. Thanks! |
|
There was a problem hiding this comment.
Pull request overview
This PR hardens confidential relay request/response hashing by validating that all required request fields are non-zero before producing a canonical hash, preventing signatures from being generated over under-binding (replayable) contexts.
Changes:
- Add
Validate()methods forSecretsRequestParamsandCapabilityRequestParamsand makeHash()reject invalid params. - Change
SecretsResponseResult.Hash/CapabilityResponseResult.Hashto return([32]byte, error)and callValidate()internally. - Remove
omitemptyfromCapabilityRequestParams.Owner,.ExecutionID, and.ReferenceIDto ensure replay-protection fields always serialize.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| pkg/capabilities/v2/actions/confidentialrelay/types.go | Adds params validation and makes response hashing return an error when required binding fields are empty; updates JSON tags for capability params. |
| pkg/capabilities/v2/actions/confidentialrelay/types_test.go | Refactors hash tests to handle the new error return and adds unit tests for validation + invalid-hash rejection. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
approving, but minor comments. also I agree with bot suggestions. pls amend |
What changed
SecretsRequestParams.Validate()andCapabilityRequestParams.Validate()reject zero-valued required fields (workflow_id, owner, execution_id, enclave_public_key, plus the type-specific binders).Hash()onSecretsResponseResultandCapabilityResponseResultnow callsValidate()first and returns([32]byte, error)so a caller cannot accidentally produce a signature over an unbinding payload.omitemptyfromCapabilityRequestParams.Owner,.ExecutionID,.ReferenceID. These are the per-request fields that establish replay protection; they should always serialize.Why
mchain0 flagged on smartcontractkit/chainlink#22302 that
execution_idandreference_idwere optional, so a relay-DON signature could be bound to a less-unique context than the caller believed and replayed across distinct logical requests that differed only in those fields. This PR closes that hole structurally:Hash()returns an error if any field the canonical hash depends on is empty, so signing an unbinding payload becomes impossible by construction.Validation
go test ./pkg/capabilities/v2/actions/confidentialrelay/Downstream
Caller updates land separately:
errorreturn fromHash().