Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
3 changes: 2 additions & 1 deletion internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/google/osv-scanner/v2/internal/cachedregexp"
"github.com/google/osv-scanner/v2/internal/cmdlogger"
"github.com/google/osv-scanner/v2/internal/imodels"
"github.com/google/osv-scanner/v2/internal/output"
)

var OSVScannerConfigName = "osv-scanner.toml"
Expand Down Expand Up @@ -161,7 +162,7 @@ func (c *Config) warnAboutDuplicates() {

for _, vuln := range c.IgnoredVulns {
if _, ok := seen[vuln.ID]; ok {
cmdlogger.Warnf("warning: %s has multiple ignores for %s - only the first will be used!", c.LoadPath, vuln.ID)
cmdlogger.Warnf("warning: %s has multiple ignores for %s - only the first will be used!", output.SanitizeForWorkflowCommand(c.LoadPath), vuln.ID)
}
seen[vuln.ID] = struct{}{}
}
Expand Down
5 changes: 3 additions & 2 deletions internal/config/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/BurntSushi/toml"
"github.com/google/osv-scanner/v2/internal/cachedregexp"
"github.com/google/osv-scanner/v2/internal/cmdlogger"
"github.com/google/osv-scanner/v2/internal/output"
)

type Manager struct {
Expand Down Expand Up @@ -54,11 +55,11 @@ func (m *Manager) Get(targetPath string) Config {

config, configErr := tryLoadConfig(configPath)
if configErr == nil {
cmdlogger.Infof("Loaded filter from: %s", config.LoadPath)
cmdlogger.Infof("Loaded filter from: %s", output.SanitizeForWorkflowCommand(config.LoadPath))
} else {
// anything other than the config file not existing is most likely due to an invalid config file
if !errors.Is(configErr, os.ErrNotExist) {
cmdlogger.Errorf("Ignored invalid config file at %s because: %v", configPath, configErr)
cmdlogger.Errorf("Ignored invalid config file at %s because: %v", output.SanitizeForWorkflowCommand(configPath), configErr)
}
// If config doesn't exist, use the default config
config = m.DefaultConfig
Expand Down
7 changes: 4 additions & 3 deletions internal/sourceanalysis/rust.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"github.com/google/osv-scanner/v2/internal/thirdparty/ar"
"github.com/google/osv-scanner/v2/pkg/models"
"github.com/ianlancetaylor/demangle"
"github.com/google/osv-scanner/v2/internal/output"
)

const (
Expand Down Expand Up @@ -52,14 +53,14 @@ func rustAnalysis(pkgs []models.PackageVulns, source models.SourceInfo) {
// Is a library, so need an extra step to extract the object binary file before passing to parseDWARFData
buf, err := extractRlibArchive(path)
if err != nil {
cmdlogger.Errorf("failed to analyse '%s': %s", path, err)
cmdlogger.Errorf("failed to analyse '%s': %s", output.SanitizeForWorkflowCommand(path), err)
continue
}
readAt = bytes.NewReader(buf.Bytes())
} else {
f, err := os.Open(path)
if err != nil {
cmdlogger.Errorf("failed to read binary '%s': %s", path, err)
cmdlogger.Errorf("failed to read binary '%s': %s", output.SanitizeForWorkflowCommand(path), err)
continue
}
// This is fine to defer til the end of the function as there's
Expand All @@ -70,7 +71,7 @@ func rustAnalysis(pkgs []models.PackageVulns, source models.SourceInfo) {

calls, err := functionsFromDWARF(readAt)
if err != nil {
cmdlogger.Errorf("failed to analyse '%s': %s", path, err)
cmdlogger.Errorf("failed to analyse '%s': %s", output.SanitizeForWorkflowCommand(path), err)
continue
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/osvscanner/osvscanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ func finalizeScanResult(scanResult results.ScanResults, actions ScannerActions)
slices.Sort(configFiles)

for _, configFile := range configFiles {
cmdlogger.Warnf("%s has unused ignores:", configFile)
cmdlogger.Warnf("%s has unused ignores:", output.SanitizeForWorkflowCommand(configFile))

for _, iv := range unusedIgnoredEntries[configFile] {
cmdlogger.Warnf(" - %s", iv.ID)
Expand Down