Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(misconf): skip broken scans #2396

Merged
merged 6 commits into from
Jun 29, 2022
Merged

fix(misconf): skip broken scans #2396

merged 6 commits into from
Jun 29, 2022

Conversation

afdesk
Copy link
Contributor

@afdesk afdesk commented Jun 23, 2022

Description

Sometime customer's data contains broken json/yaml files and trivy stops working by such errors.

https://github.com/aquasecurity/defsec/blob/e02f93a8b84888a32f912a6caf0932daecee1cd9/pkg/scanners/cloudformation/parser/parser.go#L133-L141

we should show a message about broken files and run other scan.

Related issues

Checklist

  • I've read the guidelines for contributing to this repository.
  • I've followed the conventions in the PR title.
  • I've added tests that prove my fix is effective or that my feature works.
  • I've updated the documentation with the relevant information (if needed).
  • I've added usage information (if the PR introduces new options)
  • I've included a "before" and "after" example to the description (if the PR is a user interface change).

@afdesk afdesk marked this pull request as ready for review June 23, 2022 14:41
@afdesk afdesk requested a review from knqyf263 as a code owner June 23, 2022 14:41
@@ -236,7 +237,8 @@ func (h misconfPostHandler) Handle(ctx context.Context, result *analyzer.Analysi
for t, scanner := range h.scanners {
results, err := scanner.ScanFS(ctx, mapMemoryFS[t], ".")
if err != nil {
return xerrors.Errorf("scan config error: %w", err)
log.Logger.Errorf("scan %q was broken with error: %v", scanner.Name(), err)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we skip only invalid content?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@knqyf263 knqyf263 merged commit 7111301 into main Jun 29, 2022
@knqyf263 knqyf263 deleted the skip-scanner-errors branch June 29, 2022 10:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Trivy erroring out "target is not settable" when scanning image.
2 participants