mirror of
https://github.com/anchore/syft.git
synced 2026-02-12 10:36:45 +01:00
rename Contents to FileContents in app config and documentation
Signed-off-by: Alex Goodman <alex.goodman@anchore.com>
This commit is contained in:
parent
44915b435f
commit
51b13f8221
10
README.md
10
README.md
@ -120,22 +120,22 @@ file-classification:
|
|||||||
scope: "squashed"
|
scope: "squashed"
|
||||||
|
|
||||||
# cataloging file contents is exposed through the power-user subcommand
|
# cataloging file contents is exposed through the power-user subcommand
|
||||||
contents:
|
file-contents:
|
||||||
cataloger:
|
cataloger:
|
||||||
# enable/disable cataloging of secrets
|
# enable/disable cataloging of secrets
|
||||||
# SYFT_CONTENTS_CATALOGER_ENABLED env var
|
# SYFT_FILE_CONTENTS_CATALOGER_ENABLED env var
|
||||||
enabled: true
|
enabled: true
|
||||||
|
|
||||||
# the search space to look for secrets (options: all-layers, squashed)
|
# the search space to look for secrets (options: all-layers, squashed)
|
||||||
# SYFT_CONTENTS_CATALOGER_SCOPE env var
|
# SYFT_FILE_CONTENTS_CATALOGER_SCOPE env var
|
||||||
scope: "squashed"
|
scope: "squashed"
|
||||||
|
|
||||||
# skip searching a file entirely if it is above the given size (default = 1MB; unit = bytes)
|
# skip searching a file entirely if it is above the given size (default = 1MB; unit = bytes)
|
||||||
# SYFT_CONTENTS_SKIP_FILES_ABOVE_SIZE env var
|
# SYFT_FILE_CONTENTS_SKIP_FILES_ABOVE_SIZE env var
|
||||||
skip-files-above-size: 1048576
|
skip-files-above-size: 1048576
|
||||||
|
|
||||||
# file globs for the cataloger to match on
|
# file globs for the cataloger to match on
|
||||||
# SYFT_CONTENTS_GLOBS env var
|
# SYFT_FILE_CONTENTS_GLOBS env var
|
||||||
globs: []
|
globs: []
|
||||||
|
|
||||||
# cataloging file metadata is exposed through the power-user subcommand
|
# cataloging file metadata is exposed through the power-user subcommand
|
||||||
|
|||||||
@ -188,11 +188,11 @@ func catalogFileClassificationsTask() (powerUserTask, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func catalogContentsTask() (powerUserTask, error) {
|
func catalogContentsTask() (powerUserTask, error) {
|
||||||
if !appConfig.Contents.Cataloger.Enabled {
|
if !appConfig.FileContents.Cataloger.Enabled {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
contentsCataloger, err := file.NewContentsCataloger(appConfig.Contents.Globs, appConfig.Contents.SkipFilesAboveSize)
|
contentsCataloger, err := file.NewContentsCataloger(appConfig.FileContents.Globs, appConfig.FileContents.SkipFilesAboveSize)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
@ -38,7 +38,7 @@ type Application struct {
|
|||||||
Package packages `yaml:"package" json:"package" mapstructure:"package"`
|
Package packages `yaml:"package" json:"package" mapstructure:"package"`
|
||||||
FileMetadata FileMetadata `yaml:"file-metadata" json:"file-metadata" mapstructure:"file-metadata"`
|
FileMetadata FileMetadata `yaml:"file-metadata" json:"file-metadata" mapstructure:"file-metadata"`
|
||||||
FileClassification fileClassification `yaml:"file-classification" json:"file-classification" mapstructure:"file-classification"`
|
FileClassification fileClassification `yaml:"file-classification" json:"file-classification" mapstructure:"file-classification"`
|
||||||
Contents contents `yaml:"contents" json:"contents" mapstructure:"contents"`
|
FileContents fileContents `yaml:"file-contents" json:"file-contents" mapstructure:"file-contents"`
|
||||||
Secrets secrets `yaml:"secrets" json:"secrets" mapstructure:"secrets"`
|
Secrets secrets `yaml:"secrets" json:"secrets" mapstructure:"secrets"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -6,19 +6,19 @@ import (
|
|||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
)
|
)
|
||||||
|
|
||||||
type contents struct {
|
type fileContents struct {
|
||||||
Cataloger catalogerOptions `yaml:"cataloger" json:"cataloger" mapstructure:"cataloger"`
|
Cataloger catalogerOptions `yaml:"cataloger" json:"cataloger" mapstructure:"cataloger"`
|
||||||
SkipFilesAboveSize int64 `yaml:"skip-files-above-size" json:"skip-files-above-size" mapstructure:"skip-files-above-size"`
|
SkipFilesAboveSize int64 `yaml:"skip-files-above-size" json:"skip-files-above-size" mapstructure:"skip-files-above-size"`
|
||||||
Globs []string `yaml:"globs" json:"globs" mapstructure:"globs"`
|
Globs []string `yaml:"globs" json:"globs" mapstructure:"globs"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cfg contents) loadDefaultValues(v *viper.Viper) {
|
func (cfg fileContents) loadDefaultValues(v *viper.Viper) {
|
||||||
v.SetDefault("contents.cataloger.enabled", true)
|
v.SetDefault("file-contents.cataloger.enabled", true)
|
||||||
v.SetDefault("contents.cataloger.scope", source.SquashedScope)
|
v.SetDefault("file-contents.cataloger.scope", source.SquashedScope)
|
||||||
v.SetDefault("contents.skip-files-above-size", 1*file.MB)
|
v.SetDefault("file-contents.skip-files-above-size", 1*file.MB)
|
||||||
v.SetDefault("contents.globs", []string{})
|
v.SetDefault("file-contents.globs", []string{})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cfg *contents) parseConfigValues() error {
|
func (cfg *fileContents) parseConfigValues() error {
|
||||||
return cfg.Cataloger.parseConfigValues()
|
return cfg.Cataloger.parseConfigValues()
|
||||||
}
|
}
|
||||||
@ -206,7 +206,7 @@
|
|||||||
"scope": ""
|
"scope": ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"contents": {
|
"file-contents": {
|
||||||
"cataloger": {
|
"cataloger": {
|
||||||
"enabled": false,
|
"enabled": false,
|
||||||
"scope": ""
|
"scope": ""
|
||||||
|
|||||||
@ -55,7 +55,7 @@ func TestPowerUserCmdFlags(t *testing.T) {
|
|||||||
name: "content-cataloger-wired-up",
|
name: "content-cataloger-wired-up",
|
||||||
args: []string{"power-user", "docker-archive:" + getFixtureImage(t, "image-secrets")},
|
args: []string{"power-user", "docker-archive:" + getFixtureImage(t, "image-secrets")},
|
||||||
env: map[string]string{
|
env: map[string]string{
|
||||||
"SYFT_CONTENTS_GLOBS": "/api-key.txt",
|
"SYFT_FILE_CONTENTS_GLOBS": "/api-key.txt",
|
||||||
},
|
},
|
||||||
assertions: []traitAssertion{
|
assertions: []traitAssertion{
|
||||||
assertInOutput(`"contents": "c29tZV9BcEkta0V5ID0gIjEyMzQ1QTdhOTAxYjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MCIK"`), // proof of the content cataloger
|
assertInOutput(`"contents": "c29tZV9BcEkta0V5ID0gIjEyMzQ1QTdhOTAxYjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MCIK"`), // proof of the content cataloger
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user