Skip to content

feat(misconf): add option to pass Rego scanner to IaC scanner#8369

Merged
simar7 merged 5 commits intoaquasecurity:mainfrom
nikpivkin:feat/rego-scan-opt
Apr 2, 2025
Merged

feat(misconf): add option to pass Rego scanner to IaC scanner#8369
simar7 merged 5 commits intoaquasecurity:mainfrom
nikpivkin:feat/rego-scan-opt

Conversation

@nikpivkin
Copy link
Copy Markdown
Contributor

@nikpivkin nikpivkin commented Feb 7, 2025

Description

This PR adds an option to pass the Rego scanner to IaC scanners. This gives the ability to initialize the Rego scanner and load checks only once before scanning.

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

Signed-off-by: nikpivkin <nikita.pivkin@smartforce.io>
@nikpivkin nikpivkin force-pushed the feat/rego-scan-opt branch from 7ce2d8c to 85b7614 Compare March 18, 2025 11:18
@nikpivkin nikpivkin marked this pull request as ready for review March 18, 2025 12:23
@nikpivkin nikpivkin removed the request for review from knqyf263 March 18, 2025 12:23
@simar7 simar7 force-pushed the feat/rego-scan-opt branch from 0ec5532 to d593ec9 Compare March 22, 2025 05:58
Comment thread pkg/misconf/scanner.go
regoScanner := rego.NewScanner(regoOpts...)
// note: it is safe to pass nil as fsys, since checks and data files will be loaded
// from the filesystems passed through the options.
if err := regoScanner.LoadPolicies(nil); err != nil {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

While I understand your comment, maybe it's time to refactor this function as passing nil seems a bit clunky. We can do it in a different PR.

@simar7 simar7 added this pull request to the merge queue Apr 2, 2025
Merged via the queue into aquasecurity:main with commit 890a360 Apr 2, 2025
12 checks passed
@aqua-bot aqua-bot mentioned this pull request Apr 2, 2025
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.

2 participants