Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change default for V1_3 compatibility to false #435

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions lib/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -330,14 +330,13 @@ func (s *Server) initConfig() (err error) {
// Make file names absolute
s.makeFileNamesAbsolute()

compModeStr := os.Getenv("FABRIC_CA_SERVER_COMPATIBILITY_MODE_V1_3")
if compModeStr == "" {
compModeStr = "true" // TODO: Change default to false once all clients have been updated to use the new authorization header
}

s.Config.CompMode1_3, err = strconv.ParseBool(compModeStr)
if err != nil {
return errors.WithMessage(err, "Invalid value for boolean environment variable 'FABRIC_CA_SERVER_COMPATIBILITY_MODE_V1_3'")
if compModeStr := os.Getenv("FABRIC_CA_SERVER_COMPATIBILITY_MODE_V1_3"); compModeStr == "" {
s.Config.CompMode1_3 = false
} else {
s.Config.CompMode1_3, err = strconv.ParseBool(compModeStr)
if err != nil {
return errors.WithMessage(err, "Invalid value for boolean environment variable 'FABRIC_CA_SERVER_COMPATIBILITY_MODE_V1_3'")
}
}

return nil
Expand Down
3 changes: 1 addition & 2 deletions util/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ func TestECCreateToken(t *testing.T) {
tok, err := CreateToken(bccsp, cert, privKey, "GET", "/enroll", body)
assert.NoError(t, err, "CreateToken failed")

os.Setenv("FABRIC_CA_SERVER_COMPATIBILITY_MODE_V1_3", "false") // Test new token
_, err = VerifyToken(bccsp, tok, "GET", "/enroll", body, false)
assert.NoError(t, err, "VerifyToken failed")

Expand Down Expand Up @@ -87,7 +86,7 @@ func TestECCreateToken(t *testing.T) {
_, err = VerifyToken(bccsp, oldToken, "GET", "/enroll", body, false)
assert.Error(t, err)

// Test that by default with no environment variable set, the old token is considered valid
// With comptability mode enabled, the old token is considered valid
os.Unsetenv("FABRIC_CA_SERVER_COMPATIBILITY_MODE_V1_3")
_, err = VerifyToken(bccsp, oldToken, "GET", "/enroll", body, true)
assert.NoError(t, err, "Failed to verify token using old token type")
Expand Down