fix(cli): generate compliance after scan#10919
Conversation
|
✅ All necessary |
|
✅ Conflict Markers Resolved All conflict markers have been successfully resolved in this pull request. |
There was a problem hiding this comment.
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.
| # `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 |
There was a problem hiding this comment.
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).
| # 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`. |
🔒 Container Security ScanImage: 📊 Vulnerability Summary
4 package(s) affected
|
💚 All backports created successfully
Questions ?Please refer to the Backport tool documentation and see the Github Action logs for details |
Description
Fix
KeyErrorwhile generating compliance output in the CLI.Checklist
Community Checklist
SDK/CLI
UI
API
License
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.