mirror of
https://github.com/anchore/syft.git
synced 2026-10-30 14:02:26 +01:00
Add registry certificate verification support (#1734)
* add registry certificate verification support * replace stereoscope version * modify go.mod * pull in stereoscope update Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * rename registry cert options, add docs, and add test Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * update to account for changes in anchore/stereoscope#195 Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * fix cli tests Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> --------- Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> Co-authored-by: lishituo <24578666@qq.com> Co-authored-by: Alex Goodman <wagoodman@users.noreply.github.com>
This commit is contained in:
co-authored by
lishituo
Alex Goodman
parent
cedfa05e93
commit
b03e9c6868
@@ -258,7 +258,7 @@ func TestPackagesCmdFlags(t *testing.T) {
|
||||
func TestRegistryAuth(t *testing.T) {
|
||||
host := "localhost:17"
|
||||
image := fmt.Sprintf("%s/something:latest", host)
|
||||
args := []string{"packages", "-vv", fmt.Sprintf("registry:%s", image)}
|
||||
args := []string{"packages", "-vvv", fmt.Sprintf("registry:%s", image)}
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
@@ -272,7 +272,7 @@ func TestRegistryAuth(t *testing.T) {
|
||||
assertions: []traitAssertion{
|
||||
assertInOutput("source=OciRegistry"),
|
||||
assertInOutput(image),
|
||||
assertInOutput("no registry credentials configured, using the default keychain"),
|
||||
assertInOutput(fmt.Sprintf("no registry credentials configured for %q, using the default keychain", host)),
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -311,7 +311,7 @@ func TestRegistryAuth(t *testing.T) {
|
||||
assertions: []traitAssertion{
|
||||
assertInOutput("source=OciRegistry"),
|
||||
assertInOutput(image),
|
||||
assertInOutput(`no registry credentials configured, using the default keychain`),
|
||||
assertInOutput(fmt.Sprintf(`no registry credentials configured for %q, using the default keychain`, host)),
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -324,6 +324,17 @@ func TestRegistryAuth(t *testing.T) {
|
||||
assertInOutput("insecure-use-http: true"),
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "use tls configuration",
|
||||
args: args,
|
||||
env: map[string]string{
|
||||
"SYFT_REGISTRY_AUTH_TLS_CERT": "place.crt",
|
||||
"SYFT_REGISTRY_AUTH_TLS_KEY": "place.key",
|
||||
},
|
||||
assertions: []traitAssertion{
|
||||
assertInOutput("using custom TLS credentials from"),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
|
||||
Reference in New Issue
Block a user