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

feat(misconf): Show misconfig ID in output #7762

Merged
merged 3 commits into from
Oct 23, 2024
Merged

Conversation

simar7
Copy link
Member

@simar7 simar7 commented Oct 18, 2024

Description

Show misconfig ID in output

Before

my-file ()
==========
Tests: 1 (SUCCESSES: 0, FAILURES: 1, EXCEPTIONS: 0)
Failures: 1 (LOW: 0, MEDIUM: 0, HIGH: 1, CRITICAL: 0)

HIGH: Oh no, a bad config.
════════════════════════════════════════
Your config file is not good.

See https://google.com/search?q=bad%20config
────────────────────────────────────────
 my-file
────────────────────────────────────────
   1   
   2 [ bad: true
   3   
────────────────────────────────────────

After

my-file ()
==========
Tests: 1 (SUCCESSES: 0, FAILURES: 1, EXCEPTIONS: 0)
Failures: 1 (LOW: 0, MEDIUM: 0, HIGH: 1, CRITICAL: 0)

AVD-XYZ-0123 (HIGH): Oh no, a bad config.
════════════════════════════════════════
Your config file is not good.

See https://google.com/search?q=bad%20config
────────────────────────────────────────
 my-file
────────────────────────────────────────
   1   
   2 [ bad: true
   3   
────────────────────────────────────────

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).

@simar7 simar7 requested a review from nikpivkin October 18, 2024 06:05
@simar7 simar7 self-assigned this Oct 18, 2024
@simar7 simar7 marked this pull request as ready for review October 18, 2024 06:26
@simar7 simar7 requested a review from knqyf263 as a code owner October 18, 2024 06:26
@nikpivkin
Copy link
Contributor

I think the before and after output should be added to the description.

@simar7
Copy link
Member Author

simar7 commented Oct 19, 2024

I think the before and after output should be added to the description.

Thanks! I forgot about that.

@knqyf263
Copy link
Collaborator

I prefer a single line as below, but I guess @itaysk has some idea as it's his request.

AVD-XYZ-0123 (HIGH): Oh no, a bad config.
HIGH: Oh no, a bad config (AVD-XYZ-0123).

@itaysk
Copy link
Contributor

itaysk commented Oct 21, 2024

agree with @knqyf263
of the two options I'd probably pick the first

@simar7
Copy link
Member Author

simar7 commented Oct 21, 2024

I prefer a single line as below, but I guess @itaysk has some idea as it's his request.

AVD-XYZ-0123 (HIGH): Oh no, a bad config.
HIGH: Oh no, a bad config (AVD-XYZ-0123).

Agreed. Implemented 0513137

@knqyf263
Copy link
Collaborator

nit: There are some more options.

[AVD-XYZ-0123] HIGH: Oh no, a bad config.
AVD-XYZ-0123 [HIGH]: Oh no, a bad config.
<AVD-XYZ-0123> HIGH: Oh no, a bad config.
AVD-XYZ-0123 <HIGH>: Oh no, a bad config.

Copy link
Collaborator

@knqyf263 knqyf263 left a comment

Choose a reason for hiding this comment

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

LGTM. If you prefer another option, please feel free to update and merge this PR.

switch misconf.Severity {
case severityCritical:
r.printf("<red><bold>%s: ", misconf.Severity)
r.printf("%s <red><bold>(%s): ", misconf.ID, misconf.Severity)
Copy link
Contributor

Choose a reason for hiding this comment

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

It is better to use the AVDID field instead of ID because ID can contain aliases https://github.com/aquasecurity/trivy/blob/main/pkg/misconf/scanner.go#L452-L454

s3-bucket-logging (LOW): Bucket has logging disabled
══════════════════════════════════════════════════════════════════════════════════════════════════════════════════
Ensures S3 bucket logging is enabled for S3 buckets

Copy link
Member Author

Choose a reason for hiding this comment

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

thanks! good catch, updated.

@simar7 simar7 added this pull request to the merge queue Oct 23, 2024
Merged via the queue into aquasecurity:main with commit f75c0d1 Oct 23, 2024
12 checks passed
@simar7 simar7 deleted the feat-7629 branch October 23, 2024 19:15
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.

feat(misconf): Show misconfig ID in table (default) view
4 participants