diff --git a/evidence/cli/command_cli.go b/evidence/cli/command_cli.go index b7e9343..26f97e1 100644 --- a/evidence/cli/command_cli.go +++ b/evidence/cli/command_cli.go @@ -105,6 +105,11 @@ func evidenceDetailsByFlags(ctx *components.Context) (*coreConfig.ServerDetails, return nil, errors.New("platform URL is mandatory for evidence commands") } platformToEvidenceUrls(serverDetails) + + if serverDetails.GetUser() != "" && serverDetails.GetPassword() != "" { + return nil, errors.New("evidence service does not support basic authentication") + } + return serverDetails, nil } diff --git a/evidence/cli/command_cli_test.go b/evidence/cli/command_cli_test.go index fe4d83e..cd93ee0 100644 --- a/evidence/cli/command_cli_test.go +++ b/evidence/cli/command_cli_test.go @@ -130,6 +130,19 @@ func TestCreateEvidence_Context(t *testing.T) { }, expectErr: true, }, + { + name: "InvalidContext - Unsupported Basic Auth", + flags: []components.Flag{ + setDefaultValue(predicate, predicate), + setDefaultValue(predicateType, "InToto"), + setDefaultValue(key, "PGP"), + setDefaultValue(releaseBundle, releaseBundle), + setDefaultValue("url", "url"), + setDefaultValue("user", "testUser"), + setDefaultValue("password", "testPassword"), + }, + expectErr: true, + }, } for _, tt := range tests { diff --git a/evidence/cli/flags.go b/evidence/cli/flags.go index 6e30ccb..7281f4f 100644 --- a/evidence/cli/flags.go +++ b/evidence/cli/flags.go @@ -15,7 +15,6 @@ const ( ServerId = "server-id" url = "url" user = "user" - password = "password" accessToken = "access-token" project = "project" @@ -43,7 +42,6 @@ var flagsMap = map[string]components.Flag{ ServerId: components.NewStringFlag(ServerId, "Server ID configured using the config command.", func(f *components.StringFlag) { f.Mandatory = false }), url: components.NewStringFlag(url, "JFrog Platform URL.", func(f *components.StringFlag) { f.Mandatory = false }), user: components.NewStringFlag(user, "JFrog username.", func(f *components.StringFlag) { f.Mandatory = false }), - password: components.NewStringFlag(password, "JFrog password.", func(f *components.StringFlag) { f.Mandatory = false }), accessToken: components.NewStringFlag(accessToken, "JFrog access token.", func(f *components.StringFlag) { f.Mandatory = false }), project: components.NewStringFlag(project, "Project key associated with the created evidence.", func(f *components.StringFlag) { f.Mandatory = false }), @@ -67,7 +65,6 @@ var commandFlags = map[string][]string{ CreateEvidence: { url, user, - password, accessToken, ServerId, project,