Skip to content

Allow OUs - #198

Merged
tock-ibm merged 3 commits into
hyperledger:mainfrom
MayRosenbaum:allow_OUs
Oct 1, 2026
Merged

tock-ibm merged 3 commits into
hyperledger:mainfrom
MayRosenbaum:allow_OUs

Conversation

@MayRosenbaum

@MayRosenbaum MayRosenbaum commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Type of change

  • New feature
  • Test update

Description

  • channelconfig floors the MSP version of every channel org to MSPv3_0, so an MSP that declares NodeOUs enforces them (admins are identified by the admin OU) even when the channel declares no capabilities. MSPs without NodeOUs keep using admincerts.
  • The floor is MSPv3_0 on purpose, rather than the MSPv1_4_3 that NodeOU admin classification strictly needs: Fabric-X is never going back to an MSP version below v3, and we have no installed base, so we do not care about upgrades.
  • cryptogen.ConfigBlockParameters and testcrypto.ConfigBlock gain an EnableNodeOUs option (default false) that generates every org with a NodeOUs-enabled config.yaml and an empty admincerts folder.

Related issues

#196

@MayRosenbaum MayRosenbaum changed the title Allow o us Allow OUs Sep 27, 2026
@coveralls

coveralls commented Sep 27, 2026 •

Copy link
Copy Markdown

Coverage Status

coverage: 82.044% (+0.02%) from 82.029% — MayRosenbaum:allow_OUs into hyperledger:main

@tock-ibm tock-ibm left a comment

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.

Automated /code-review (max effort) — 4 comment-only findings, most severe first. The key claim was checked empirically (branch built; new test run with and without the channel.go change; channelconfig/capabilities/msp/genesis/configtx/cryptogen suites green).

Headline: the new test passes identically with or without the channel.go floor, so the PR's central production change currently has no regression protection.

},
},
})
readBundle(t, block) // fails unless the generated config loads into a valid bundle.

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.

The new test does not guard the channel.go floor change — the docstring's central guarantee is false.

The docstring (lines 563-564) claims a valid bundle "proves channelconfig enforces OUs regardless of capabilities, since an OU-only MSP … would otherwise be left with no admins." But SampleFabricX declares empty channel capabilities (MSPVersion = MSPv1_0), and at MSPv1_0 setupAdminsPreV142 permits zero admins and NewBundleFromEnvelope loads fine — so readBundle succeeds with or without the floor.

Verified: checking out common/channelconfig/channel.go from main and re-running leaves both subtests green. The test only asserts the bundle loads and inspects the on-disk crypto layout; it never evaluates the org Admins policy against an OU-classified admin identity (as requireSign does at line 267). So the channel.go change is effectively untested here and the claimed proof is vacuous.

Suggest asserting something that actually depends on OU enforcement (e.g. that an OU-classified admin identity satisfies the org Admins policy), so reverting the floor would fail the test.

Comment thread common/channelconfig/channel.go Outdated
// declares no capabilities, while MSPs without NodeOUs keep using admincerts.
mspVersion := channelCapabilities.MSPVersion()
if mspVersion < msp.MSPv3_0 {
mspVersion = msp.MSPv3_0

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.

Flooring the MSP version to MSPv3_0 over-reaches the stated "honor OUs" goal.

NodeOU admin classification requires only MSPv1_4_3 (setupV142 / setupNodeOUsV142 / setupAdminsV142). MSPv3_0 additionally runs setupV3, which sets supportedPublicKeyAlgorithms[x509.Ed25519] = true (mspimplsetup.go:693).

By flooring to MSPv3_0, a channel that declared no capabilities (or V1_1/V1_3/V1_4_3/V2_0) now accepts Ed25519 member certificates it previously rejected — and any node still on an older library version derives MSPv1_0 for the same config block, so the two interpret identity acceptance differently. That is a determinism/fork risk during a rolling upgrade of a consumer (committer/orderer).

The minimal, on-goal change is to floor to msp.MSPv1_4_3 instead of msp.MSPv3_0.

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.

Put it the issue description the fact that we are never going back to ver < v3 and that we do not have an installed base, thus don't care about upgrades.

Comment thread common/channelconfig/channel.go Outdated
// local MSP version) — an MSP that declares NodeOUs then enforces them even when the channel
// declares no capabilities, while MSPs without NodeOUs keep using admincerts.
mspVersion := channelCapabilities.MSPVersion()
if mspVersion < msp.MSPv3_0 {

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.

Bundle-load regression for a sub-V1_4_3 channel whose org MSP has both admincerts and a NodeOUs-enabled config.yaml.

Consider an existing channel with no channel capabilities (previously MSPv1_0) whose org verifying MSP supplies admincerts and a config.yaml with NodeOUs.Enable = true whose admin certificate carries neither the client nor the admin OU.

  • Before: MSPv1_0 ignores NodeOUs (setupV1, ouEnforcement = false) and the admincert authorizes admins → bundle loads.
  • After: MSPv3_0 sets ouEnforcement = true, and postSetupV142 (mspimplsetup.go:737-743) runs hasOURole(admin, CLIENT/ADMIN) on each admincert identity and returns "admin i is invalid" → NewBundleFromEnvelope now fails to load a config block that loaded before the upgrade.

Flooring to MSPv1_4_3 (see the comment on the next line) does not remove this exposure on its own, since V1_4_3 also enforces OUs; worth calling out the upgrade-compatibility implication in the PR description.

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.

Put it the issue description the fact that we are never going back to ver < v3 and that we do not have an installed base, thus don't care about upgrades.

Comment thread common/channelconfig/channel.go Outdated
// local MSP version) — an MSP that declares NodeOUs then enforces them even when the channel
// declares no capabilities, while MSPs without NodeOUs keep using admincerts.
mspVersion := channelCapabilities.MSPVersion()
if mspVersion < msp.MSPv3_0 {

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.

Minor (cleanup): the manual floor can use the Go builtin max() (repo is Go 1.27).

mspVersion := max(channelCapabilities.MSPVersion(), msp.MSPv3_0)

is equivalent to the three-line if and compiles with the named MSPVersion int type plus the untyped constant. Readability/maintenance only. (If you take the MSPv1_4_3 suggestion above, this becomes max(…, msp.MSPv1_4_3).)

@tock-ibm tock-ibm left a comment

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.

Eventually we want these capabilities gone in fabric-x

// EnableNodeOUs turns on node-OU based identity classification for every generated
// organization: each MSP gets a NodeOUs-enabled config.yaml and admin authority is
// conveyed by the admin OU instead of by admincerts. Defaults to false.
EnableNodeOUs bool

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.

If we are flooring to v3 that the default should be true; or alternatively, set it to true regardless? since we are never going back to ver < v3

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.

If we are flooring to v3, we should enable both "admincerts" and "OUs"

Comment thread common/channelconfig/channel.go Outdated
// local MSP version) — an MSP that declares NodeOUs then enforces them even when the channel
// declares no capabilities, while MSPs without NodeOUs keep using admincerts.
mspVersion := channelCapabilities.MSPVersion()
if mspVersion < msp.MSPv3_0 {

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.

Put it the issue description the fact that we are never going back to ver < v3 and that we do not have an installed base, thus don't care about upgrades.

Comment thread common/channelconfig/channel.go Outdated
// declares no capabilities, while MSPs without NodeOUs keep using admincerts.
mspVersion := channelCapabilities.MSPVersion()
if mspVersion < msp.MSPv3_0 {
mspVersion = msp.MSPv3_0

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.

Put it the issue description the fact that we are never going back to ver < v3 and that we do not have an installed base, thus don't care about upgrades.

Signed-off-by: May.Buzaglo <May.Buzaglo@ibm.com>
Signed-off-by: May.Buzaglo <May.Buzaglo@ibm.com>
Signed-off-by: May.Buzaglo <May.Buzaglo@ibm.com>
@tock-ibm
tock-ibm merged commit 6c69522 into hyperledger:main Oct 1, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants