Skip to content

fix(fabric): verify idemix recipients through the channel MSP and bound the verifier cache - #2476

Merged
mbrandenburger merged 3 commits into
hyperledger-labs:mainfrom
mbrandenburger:fix/2440-harden-recipient-verification
Nov 4, 2026
Merged

mbrandenburger merged 3 commits into
hyperledger-labs:mainfrom
mbrandenburger:fix/2440-harden-recipient-verification

Conversation

@mbrandenburger

@mbrandenburger mbrandenburger commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

Closes #2440.

The recipient exchange views in platform/fabric/services/state/recipients.go verified a recipient identity X with the network's signer service. A node could therefore verify an idemix recipient only if it held a credential from the same issuer, and every verifier the signer service deserialized stayed in an unbounded cache, before the proof was checked.

What changes

  • An x509 X (a SerializedIdentity whose IdBytes are PEM), or bytes that are not a SerializedIdentity, go through the new sig.Service.LookupVerifier and never touch the channel. LookupVerifier reuses a registered or cached verifier and otherwise deserializes without caching. The views reach it through fabric.SignerService.LookupVerifier, which type-asserts the inner service and falls back to GetVerifier, so driver.SigService and its mocks are unchanged.
  • Any other SerializedIdentity needs the channel to tell whether its MSP is idemix. If it is an idemix MSP of the channel, X must pass MSPManager().IsValid(x), and its proof is verified with the channel MSP's verifier, so idemix recipients from any issuer in the channel now verify. Otherwise X goes to LookupVerifier.
  • The channel comes from the receiver's own options: a new Channel field on ExchangeRecipientIdentitiesView and RespondExchangeRecipientIdentitiesView, set from state.WithChannel, otherwise the default channel. RequestRecipientIdentity uses the default channel. The responder ignores ExchangeRecipientRequest.Channel.
  • If X needs the channel and it is unknown (e.g. no default channel and no WithChannel) or has no configuration in force (driver.ErrNotInitialized), X is refused without being counted as a recipient_proof rejection, since the cause is local. The responder tells the initiator only that the channel is not ready.
  • The local idemix deserializer (core/generic/msp/idemix) now refuses an identity whose SerializedIdentity.Mspid differs from the provider's MSP ID. It used to discard the MSP ID, so a pseudonym with a valid local credential verified under any MSP ID, for example that of an x509 org. A deserializer built from an issuer key alone has no MSP ID and is unchanged.
  • New fabric.MSPManager.IsIdemixMSP, plus Godoc on GetVerifier saying it does not check validity.

Differences from the issue

  • Step 1 of the issue used the channel verifier alone. ChannelMembership.GetVerifier only deserializes the identity, on both Fabric and Fabric-x, and never checks the idemix credential. A pseudonym derived from a random secret key with no credential verifies through it. TestRespondExchange_IdemixWithoutCredential and TestService_IdemixIsValidRequiresCredential (Fabric-x) cover this, so the views call IsValid first.
  • The issue asked to fail every exchange when the channel is unknown or not loaded. x509 identities don't depend on the channel, so they skip it: otherwise x509 exchanges would break on any network without a default channel, and RequestRecipientIdentity, which takes no options, could never succeed there.
  • An idemix identity whose MSP is not an idemix MSP of the channel takes the signer-service path. With the MSP-ID check above, it verifies only under the MSP ID of a local idemix MSP from the same issuer.

Fabric-x

Fabric-x uses the same generic driver, sig service and recipient views, and its channel membership has IsIdemixMSP, IsValid and GetVerifier, so the same rules apply without platform code changes. A test over the real Fabric-x membership.Service checks that IsValid refuses a credential-less pseudonym while GetVerifier accepts it.

Compatibility

  • No API removals; additions only.
  • Behavior on top of fix(fabric)!: require proof of ownership in the recipient exchange #2452 (unreleased): an idemix recipient whose MSP is in the channel needs that channel's configuration loaded before it can be verified. The v0.27 to v0.28 upgrade guide covers it, along with the MSP-ID check in the idemix provider.
  • Panurus is not affected: it pins FSC v0.24.0, has its own recipient views in ttx and its own idemix package, and imports services/state only for VaultService.

Testing

  • Unit tests in platform/fabric/services/state verify real idemix identities against channel MSPs built from issuer material only: a recipient from a second issuer in the channel verifies; one with the wrong issuer, or one relabelled with another MSP ID on the local idemix path, is refused; a credential-less pseudonym is refused. Other tests cover the channel choice (the responder ignores the initiator's Channel, WithChannel reaches the views), the unavailable-channel cases, and that x509 recipients verify with no channel.
  • These tests use a fake channel membership over real msp.MSPManager instances. The real Fabric-x membership.Service is covered separately, as above. Removing the IsValid call, the channel path or the MSP-ID check makes the matching tests fail.
  • sig.Service.LookupVerifier tests check that the cache does not grow and that cached verifiers are returned.
  • make checks, make unit-tests-root and make integration-tests-fabric-atsa pass locally.
  • No cross-issuer integration test: it would need a second idemix organization in the topology.

@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Hey @mbrandenburger 👋 thanks for the PR!
I'm your friendly PR Helper Bot 🤖 and I'll be riding shotgun on this one, keeping track of your PR's status to help you get it approved and merged.

This comment updates automatically as you push changes -- think of it as your PR's live scoreboard!
Here's the latest:


PR Checks

✅ DCO Sign-off -- All commits have valid sign-offs. Nice work!


❌ GPG Signature -- Heads up! The following commits don't have a verified GPG signature:

  • 4bfe768 fix(fabric): verify idemix recipients through the channel MSP and bound the verifier cache
  • 899301f amend! fix(fabric): verify idemix recipients through the channel MSP and bound the verifier cache
  • 973e2a9 fixup! fix(fabric): verify idemix recipients through the channel MSP and bound the verifier cache

You'll need to sign your commits with GPG (e.g. git commit -S). See the Signing Guide for a step-by-step walkthrough.


✅ Merge Conflicts -- No merge conflicts detected. Smooth sailing!


✅ Issue Link -- Linked to #2440 (assigned to you).


⏳ All checks must pass before this PR can be reviewed. You've got this!

@github-actions github-actions Bot added the status: needs revision The pull request requires changes from the author before it can be reviewed or merged label Nov 3, 2026
@mbrandenburger mbrandenburger added this to the 26Q4 milestone Nov 3, 2026
@mergify

mergify Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again.

@mbrandenburger
mbrandenburger enabled auto-merge (squash) November 4, 2026 08:03
…nd the verifier cache

The recipient exchange views verified a recipient identity X with the
network's signer service. That service resolves X through the node's
local MSPs, so a node could verify an idemix recipient only if it held a
credential from the same issuer. It also cached every verifier it
deserialized, before the proof was checked, so a peer could grow the
node's memory by sending well-formed identities with bogus proofs.

If X is a SerializedIdentity of an idemix MSP of the receiver's channel,
the views now check that X is valid on the channel and verify its proof
with the channel MSP's verifier. The validity check is required: the
channel verifier alone deserializes X without checking its credential and
accepts a pseudonym with no credential behind it. Every other identity,
x509 included, is verified through sig.Service.LookupVerifier, which
reuses a registered or cached verifier and otherwise deserializes without
caching. fabric.SignerService.LookupVerifier reaches it and falls back to
GetVerifier for signer services that lack it.

The channel comes from the receiver's own configuration: the new Channel
field of ExchangeRecipientIdentitiesView and its responder, set from
state.WithChannel, or the network's default channel.
RequestRecipientIdentity always uses the default channel. The responder
ignores ExchangeRecipientRequest.Channel, since the party being verified
would otherwise pick the MSPs that verify it. An unknown channel, or one
with no configuration in force, fails the exchange before anything is
sent or verified, for x509 recipients too. The responder sends that error
to the initiator, and it is not counted as a recipient_proof rejection.

Fabric-x shares the generic driver, the sig service and these views, and
its channel membership has the same methods, so the same rules apply
there.

Adds fabric.MSPManager.IsIdemixMSP, unit tests that verify real idemix
identities from two issuers against channel MSPs, a test on the Fabric-x
membership service showing IsValid refuses a credential-less pseudonym,
and documentation in the security model, the metrics catalog and the
v0.27 to v0.28 upgrade guide.

Closes hyperledger-labs#2440

Signed-off-by: Marcus Brandenburger <bur@zurich.ibm.com>
…and bound the verifier cache

fix(fabric): verify idemix recipients through the channel MSP and bound the verifier cache

The recipient exchange views verified a recipient identity X with the
network's signer service. That service resolves X through the node's
local MSPs, so a node could verify an idemix recipient only if it held a
credential from the same issuer. It also cached every verifier it
deserialized, before the proof was checked, so a peer could grow the
node's memory by sending well-formed identities with bogus proofs.

An x509 identity (a SerializedIdentity whose IdBytes are PEM), or bytes
that are not a SerializedIdentity, are verified through
sig.Service.LookupVerifier, which reuses a registered or cached verifier
and otherwise deserializes without caching, and never need a channel.
fabric.SignerService.LookupVerifier reaches it and falls back to
GetVerifier for signer services that lack it. If X is any other
SerializedIdentity and its MSP is an idemix MSP of the receiver's channel,
X must be valid on the channel and its proof is verified with the channel
MSP's verifier. The validity check is required: the channel verifier alone
deserializes X without checking its credential and accepts a pseudonym
with no credential behind it. Otherwise X goes to LookupVerifier.

The channel comes from the receiver's own configuration: the new Channel
field of ExchangeRecipientIdentitiesView and its responder, set from
state.WithChannel, or the network's default channel.
RequestRecipientIdentity uses the default channel. The responder ignores
ExchangeRecipientRequest.Channel, since the party being verified would
otherwise pick the MSPs that verify it. If X needs the channel and it is
unknown or has no configuration in force, X is refused without counting a
recipient_proof rejection, and the responder tells the initiator only that
the channel is not ready.

The local idemix deserializer discarded the SerializedIdentity's MSP ID,
so a pseudonym with a valid local credential verified under any MSP ID,
for example that of an x509 org. It now refuses an identity whose MSP ID
differs from the provider's. A deserializer built from an issuer key
alone has no MSP ID and accepts any.

Fabric-x shares the generic driver, the sig service and these views, and
its channel membership has the same methods, so the same rules apply
there.

Adds fabric.MSPManager.IsIdemixMSP, unit tests that verify real idemix
identities from two issuers against channel MSPs and refuse relabelled
and credential-less pseudonyms, a test on the Fabric-x membership service
showing IsValid refuses a credential-less pseudonym,
and documentation in the security model, the metrics catalog and the
v0.27 to v0.28 upgrade guide.

Closes hyperledger-labs#2440

Signed-off-by: Marcus Brandenburger <bur@zurich.ibm.com>
…and bound the verifier cache

Test that the recipient views do not cache verifiers and that GetVerifier
keeps caching; note in the metrics catalog that a channel-not-ready refusal
is not counted.

Signed-off-by: Marcus Brandenburger <bur@zurich.ibm.com>
@mbrandenburger
mbrandenburger force-pushed the fix/2440-harden-recipient-verification branch from 21a8b9a to 973e2a9 Compare November 4, 2026 08:03
@mbrandenburger
mbrandenburger merged commit 7c5cee3 into hyperledger-labs:main Nov 4, 2026
@mbrandenburger
mbrandenburger deleted the fix/2440-harden-recipient-verification branch November 4, 2026 08:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix status: needs revision The pull request requires changes from the author before it can be reviewed or merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Harden recipient identity verification

2 participants