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

Evidence CLI - evidence does not support basic auth #26

Merged
merged 3 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
5 changes: 5 additions & 0 deletions evidence/cli/command_cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() != "" {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be even just serverDetails.GetUser() != "", without a check for a password?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@denys-jfrog if you try with web-login you get user with token not password.
we still need both validation.

return nil, errors.New("evidence service does not support basic authentication")
}

return serverDetails, nil
}

Expand Down
13 changes: 13 additions & 0 deletions evidence/cli/command_cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down