mirror of
https://github.com/anchore/syft.git
synced 2026-02-13 11:06:43 +01:00
fix: update config struct to not decode password/key (#1538)
* fix: update config struct to not decode password/key * test: update tests to confirm no secrets in output Signed-off-by: Christopher Phillips <christopher.phillips@anchore.com> --------- Signed-off-by: Christopher Phillips <christopher.phillips@anchore.com>
This commit is contained in:
parent
b6a496f18c
commit
9995950c70
@ -3,8 +3,9 @@ package config
|
|||||||
import "github.com/spf13/viper"
|
import "github.com/spf13/viper"
|
||||||
|
|
||||||
type attest struct {
|
type attest struct {
|
||||||
Key string `yaml:"key" json:"key" mapstructure:"key"`
|
// IMPORTANT: do not show the attestation key/password in any YAML/JSON output (sensitive information)
|
||||||
Password string `yaml:"password" json:"password" mapstructure:"password"`
|
Key string `yaml:"-" json:"-" mapstructure:"key"`
|
||||||
|
Password string `yaml:"-" json:"-" mapstructure:"password"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cfg attest) loadDefaultValues(v *viper.Viper) {
|
func (cfg attest) loadDefaultValues(v *viper.Viper) {
|
||||||
|
|||||||
@ -229,6 +229,20 @@ func TestPackagesCmdFlags(t *testing.T) {
|
|||||||
assertSuccessfulReturnCode,
|
assertSuccessfulReturnCode,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "password and key not in config output",
|
||||||
|
args: []string{"packages", "-vvv", "-o", "json", coverageImage},
|
||||||
|
env: map[string]string{
|
||||||
|
"SYFT_ATTEST_PASSWORD": "secret_password",
|
||||||
|
"SYFT_ATTEST_KEY": "secret_key_path",
|
||||||
|
},
|
||||||
|
assertions: []traitAssertion{
|
||||||
|
assertNotInOutput("secret_password"),
|
||||||
|
assertNotInOutput("secret_key_path"),
|
||||||
|
assertPackageCount(34),
|
||||||
|
assertSuccessfulReturnCode,
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user