Skip to content

fix(cli): generate compliance after scan#10919

Merged
jfagoagas merged 2 commits into
masterfrom
fix-compliance-loading-cli
Apr 28, 2026
Merged

fix(cli): generate compliance after scan#10919
jfagoagas merged 2 commits into
masterfrom
fix-compliance-loading-cli

Conversation

@jfagoagas
Copy link
Copy Markdown
Member

Description

Fix KeyError while generating compliance output in the CLI.

Checklist

Community Checklist
  • This feature/issue is listed in here or roadmap.prowler.com
  • Is it assigned to me, if not, request it via the issue/feature in here or Prowler Community Slack

SDK/CLI

  • Are there new checks included in this PR? Yes / No
    • If so, do we need to update permissions for the provider? Please review this carefully.

UI

  • All issue/task requirements work as expected on the UI
  • Screenshots/Video of the functionality flow (if applicable) - Mobile (X < 640px)
  • Screenshots/Video of the functionality flow (if applicable) - Table (640px > X < 1024px)
  • Screenshots/Video of the functionality flow (if applicable) - Desktop (X > 1024px)
  • Ensure new entries are added to CHANGELOG.md, if applicable.

API

  • All issue/task requirements work as expected on the API
  • Endpoint response output (if applicable)
  • EXPLAIN ANALYZE output for new/modified queries or indexes (if applicable)
  • Performance test results (if applicable)
  • Any other relevant evidence of the implementation (if applicable)
  • Verify if API specs need to be regenerated.
  • Check if version updates are required (e.g., specs, Poetry, etc.).
  • Ensure new entries are added to CHANGELOG.md, if applicable.

License

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Copilot AI review requested due to automatic review settings April 28, 2026 13:28
@jfagoagas jfagoagas requested a review from a team as a code owner April 28, 2026 13:28
@jfagoagas jfagoagas added the backport-to-v5.25 Backport PR to the v5.25 branch label Apr 28, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 28, 2026

✅ All necessary CHANGELOG.md files have been updated.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 28, 2026

Conflict Markers Resolved

All conflict markers have been successfully resolved in this pull request.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes a CLI crash (KeyError) when generating compliance outputs after a scan by ensuring the compliance frameworks selected for output generation are limited to those that are actually bulk-loadable for the current provider.

Changes:

  • Use bulk_compliance_frameworks.keys() (bulk-loadable frameworks) as the source of truth when deciding which compliance outputs to generate.
  • Add a Prowler SDK changelog entry documenting the fix.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
prowler/__main__.py Prevents KeyError by filtering requested compliance output modes down to bulk-loaded framework keys.
prowler/CHANGELOG.md Adds a release-note entry for the CLI compliance output KeyError fix.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread prowler/CHANGELOG.md Outdated
Comment thread prowler/__main__.py
# `get_available_compliance_frameworks(provider)` also discovers top-level
# multi-provider universal JSONs (e.g. `prowler/compliance/csa_ccm_4.0.json`)
# which `Compliance.get_bulk(provider)` does not load, and which the legacy
# output handlers below cannot consume — using it as the source produced
Copy link

Copilot AI Apr 28, 2026

Choose a reason for hiding this comment

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

The explanatory comment ends mid-sentence ("using it as the source produced"), which makes the rationale unclear. Please complete/reword this comment so it clearly states the failure mode being prevented (e.g., the KeyError from universal/top-level frameworks not present in bulk_compliance_frameworks).

Suggested change
# output handlers below cannot consume — using it as the source produced
# output handlers below cannot consume. Using that broader list here could
# include framework names not present in `bulk_compliance_frameworks`,
# causing a `KeyError` when the handlers later index by `compliance_name`.

Copilot uses AI. Check for mistakes.
Comment thread prowler/__main__.py
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 28, 2026

🔒 Container Security Scan

Image: prowler:0b8dbd1
Last scan: 2026-04-28 14:46:01 UTC

📊 Vulnerability Summary

Severity Count
🔴 Critical 4
Total 4

4 package(s) affected

⚠️ Action Required

Critical severity vulnerabilities detected. These should be addressed before merging:

  • Review the detailed scan results
  • Update affected packages to patched versions
  • Consider using a different base image if updates are unavailable

📋 Resources:

@jfagoagas jfagoagas merged commit be3c5fb into master Apr 28, 2026
34 checks passed
@jfagoagas jfagoagas deleted the fix-compliance-loading-cli branch April 28, 2026 15:18
@prowler-bot prowler-bot added the was-backported The PR was successfully backported to the target branch label Apr 28, 2026
@prowler-bot
Copy link
Copy Markdown
Collaborator

💚 All backports created successfully

Status Branch Result
v5.25

Questions ?

Please refer to the Backport tool documentation and see the Github Action logs for details

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-to-v5.25 Backport PR to the v5.25 branch was-backported The PR was successfully backported to the target branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants