Skip to content

Commit

Permalink
[FAB-6651] introduce new capability
Browse files Browse the repository at this point in the history
FAB-6651 requires the introduction of new security checks at VSCC to filter
upgrade requests that could be malicious. These new checks however break
compatibility with the old behaviour of the validator and so a new capability
should be introduced.

Change-Id: I8bf9b80249832bf17728b2f6e04437feebfba344
Signed-off-by: Alessandro Sorniotti <[email protected]>
  • Loading branch information
ale-linux committed Dec 22, 2017
1 parent 6af9661 commit f7f9a2f
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 0 deletions.
6 changes: 6 additions & 0 deletions common/capabilities/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,9 @@ func (ap *ApplicationProvider) ForbidDuplicateTXIdInBlock() bool {
func (ap *ApplicationProvider) PrivateChannelData() bool {
return ap.v11PvtDataExperimental
}

// V1_1Validation returns true is this channel is configured to perform stricter validation
// of transactions (as introduced in v1.1).
func (ap *ApplicationProvider) V1_1Validation() bool {
return ap.v11
}
2 changes: 2 additions & 0 deletions common/capabilities/application_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ func TestApplicationV11(t *testing.T) {
})
assert.NoError(t, op.Supported())
assert.True(t, op.LifecycleViaConfig())
assert.True(t, op.ForbidDuplicateTXIdInBlock())
assert.True(t, op.V1_1Validation())
}

func TestApplicationPvtDataExperimental(t *testing.T) {
Expand Down
4 changes: 4 additions & 0 deletions common/channelconfig/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ type ApplicationCapabilities interface {

// PrivateChannelData returns true if support for private channel data (a.k.a. collections) is enabled.
PrivateChannelData() bool

// V1_1Validation returns true is this channel is configured to perform stricter validation
// of transactions (as introduced in v1.1).
V1_1Validation() bool
}

// OrdererCapabilities defines the capabilities for the orderer portion of a channel
Expand Down
5 changes: 5 additions & 0 deletions common/mocks/config/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ type MockApplicationCapabilities struct {
ForbidDuplicateTXIdInBlockRv bool
LifecycleViaConfigRv bool
PrivateChannelDataRv bool
V1_1ValidationRv bool
}

func (mac *MockApplicationCapabilities) Supported() error {
Expand All @@ -42,3 +43,7 @@ func (mac *MockApplicationCapabilities) LifecycleViaConfig() bool {
func (mac *MockApplicationCapabilities) PrivateChannelData() bool {
return mac.PrivateChannelDataRv
}

func (mac *MockApplicationCapabilities) V1_1Validation() bool {
return mac.V1_1ValidationRv
}

0 comments on commit f7f9a2f

Please sign in to comment.