mirror of
https://github.com/anchore/syft.git
synced 2025-11-18 00:43:20 +01:00
add syft attest command to produce an attestation as application/vnd.in-toto+json to standard out using on disk PKI Signed-off-by: Christopher Phillips <christopher.phillips@anchore.com>
30 lines
684 B
Go
30 lines
684 B
Go
package config
|
|
|
|
import (
|
|
"os"
|
|
|
|
"github.com/spf13/viper"
|
|
)
|
|
|
|
type attest struct {
|
|
Key string `yaml:"key" json:"key" mapstructure:"key"`
|
|
// IMPORTANT: do not show the password in any YAML/JSON output (sensitive information)
|
|
Password string `yaml:"-" json:"-" mapstructure:"password"`
|
|
}
|
|
|
|
//nolint:unparam
|
|
func (cfg *attest) parseConfigValues() error {
|
|
if cfg.Password == "" {
|
|
// we allow for configuration via syft config/env vars and additionally interop with known cosign config env vars
|
|
if pw, ok := os.LookupEnv("COSIGN_PASSWORD"); ok {
|
|
cfg.Password = pw
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (cfg attest) loadDefaultValues(v *viper.Viper) {
|
|
v.SetDefault("attest.password", "")
|
|
}
|