Skip to content

introduce ProtocolV2 with secure marshal to message to sign#1563

Merged
adecaro merged 2 commits intomainfrom
1205-double-check-marshaltomessagetosign-and-the-way-the-message-is-formed
Apr 21, 2026
Merged

introduce ProtocolV2 with secure marshal to message to sign#1563
adecaro merged 2 commits intomainfrom
1205-double-check-marshaltomessagetosign-and-the-way-the-message-is-formed

Conversation

@adecaro
Copy link
Copy Markdown
Contributor

@adecaro adecaro commented Apr 17, 2026

This PR introduces ProtocolV2 to address security vulnerabilities in MarshalToMessageToSign while maintaining backward compatibility with ProtocolV1 and ensuring all regression tests pass.

Security Issues Addressed

  1. HIGH: Hash collision vulnerability in signature message construction
  2. MEDIUM: Missing input validation for anchor parameter
  3. MEDIUM: Sensitive data exposure in error messages
  4. MEDIUM: Missing security documentation

Design Decisions

Protocol Version Strategy

  • ProtocolV1: Remains unchanged to maintain backward compatibility
  • ProtocolV2: Implements secure ASN.1 structured format for signature messages
  • Validator Configuration: Support minimum protocol version

@adecaro adecaro added this to the Q2/26 milestone Apr 17, 2026
@adecaro adecaro requested a review from AkramBitar April 17, 2026 12:09
@adecaro adecaro self-assigned this Apr 17, 2026
@adecaro adecaro linked an issue Apr 17, 2026 that may be closed by this pull request
@adecaro adecaro force-pushed the 1205-double-check-marshaltomessagetosign-and-the-way-the-message-is-formed branch from 6dc41e0 to 487aee3 Compare April 17, 2026 12:48
adecaro added 2 commits April 20, 2026 09:05
- faster marshaller
- regression

Signed-off-by: Angelo De Caro <[email protected]>
@adecaro adecaro force-pushed the 1205-double-check-marshaltomessagetosign-and-the-way-the-message-is-formed branch from 487aee3 to 71ee2f3 Compare April 20, 2026 07:05

2. **Signature Message Construction**:
- **V1 (Legacy)**: `SignatureMessage = ASN.1(TokenRequest) || Anchor`
- **V2 (Recommended)**: Uses structured ASN.1 with separate Request and Anchor fields
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is there a scenario that we will have both of them?
What happens during upgrade/crash recovery?

Why we need to support both of them?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hi @AkramBitar , here are the answers:

  • In a scenario where you have already a running network, you still need a way to replay old transactions if necessary.
  • The system will treat each component following the version specification
  • For legacy reasons. Actually, it is first time that we do this. It also shows that the system can be upgraded and the regression tests show that token-sdk can still validate requests generated with an old version of the protoocol.

@adecaro adecaro merged commit 059a34c into main Apr 21, 2026
96 checks passed
@adecaro adecaro deleted the 1205-double-check-marshaltomessagetosign-and-the-way-the-message-is-formed branch April 21, 2026 08:26
sid200727 pushed a commit to sid200727/fabric-token-sdk that referenced this pull request Apr 24, 2026
sid200727 pushed a commit to sid200727/fabric-token-sdk that referenced this pull request Apr 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Double check MarshalToMessageToSign and the way the message is formed

2 participants