fix(compliance): multi-section undercount & leaked provider tab#11567
Conversation
|
✅ Conflict Markers Resolved All conflict markers have been successfully resolved in this pull request. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughRefactors multiple compliance table builders to deduplicate counts per section/group/tactic/pillar while preserving framework-level overview totals and to fix Provider column attribution by using captured provider variables. ChangesCompliance Framework Table Deduplication
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
✅ All necessary |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #11567 +/- ##
===========================================
- Coverage 94.02% 73.62% -20.41%
===========================================
Files 241 113 -128
Lines 35705 8746 -26959
===========================================
- Hits 33573 6439 -27134
- Misses 2132 2307 +175
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
🔒 Container Security ScanImage: 📊 Vulnerability Summary
9 package(s) affected
|
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
prowler/lib/outputs/compliance/prowler_threatscore/prowler_threatscore.py (1)
8-15:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winAdd return type hint and docstring.
The function
get_prowler_threatscore_tableis missing a return type hint and a docstring. As per coding guidelines, type hints are required for all public functions, and docstrings following Google style are required for all functions.📝 Proposed addition
def get_prowler_threatscore_table( findings: list, bulk_checks_metadata: dict, compliance_framework: str, output_filename: str, output_directory: str, compliance_overview: bool, -): +) -> None: + """Render ProwlerThreatScore compliance table with risk scoring per pillar. + + Args: + findings: List of finding objects to process. + bulk_checks_metadata: Dictionary mapping CheckID to check metadata. + compliance_framework: Name of the compliance framework. + output_filename: Base name for output files. + output_directory: Directory path for output files. + compliance_overview: If True, show only overview without detailed table. + """ pillar_table = {🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@prowler/lib/outputs/compliance/prowler_threatscore/prowler_threatscore.py` around lines 8 - 15, Add a return type hint to the public function get_prowler_threatscore_table (e.g., -> str or -> Path-like/tuple depending on what it returns) and insert a Google-style docstring immediately under the def that describes the purpose, all parameters (findings: list, bulk_checks_metadata: dict, compliance_framework: str, output_filename: str, output_directory: str, compliance_overview: bool) with types and meanings, and the return value and its type; ensure the docstring follows Google style (Args:, Returns:, Raises: if applicable) and keep the signature and existing behavior unchanged.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tests/lib/outputs/compliance/okta_idaas_stig/okta_idaas_stig_table_test.py`:
- Line 28: Add a Google-style docstring to the test class
TestOktaIDaaSSTIGTable: insert a short one-line summary describing the purpose
of the test class and, if helpful, a brief extended description or attributes
section explaining what behaviors or fixtures the tests cover; place the
docstring immediately below the class declaration in TestOktaIDaaSSTIGTable.
---
Outside diff comments:
In `@prowler/lib/outputs/compliance/prowler_threatscore/prowler_threatscore.py`:
- Around line 8-15: Add a return type hint to the public function
get_prowler_threatscore_table (e.g., -> str or -> Path-like/tuple depending on
what it returns) and insert a Google-style docstring immediately under the def
that describes the purpose, all parameters (findings: list,
bulk_checks_metadata: dict, compliance_framework: str, output_filename: str,
output_directory: str, compliance_overview: bool) with types and meanings, and
the return value and its type; ensure the docstring follows Google style (Args:,
Returns:, Raises: if applicable) and keep the signature and existing behavior
unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: d941c17e-3827-4473-9352-9e2b2f48c88f
📒 Files selected for processing (12)
prowler/lib/outputs/compliance/asd_essential_eight/asd_essential_eight.pyprowler/lib/outputs/compliance/c5/c5.pyprowler/lib/outputs/compliance/ccc/ccc.pyprowler/lib/outputs/compliance/cis/cis.pyprowler/lib/outputs/compliance/ens/ens.pyprowler/lib/outputs/compliance/kisa_ismsp/kisa_ismsp.pyprowler/lib/outputs/compliance/mitre_attack/mitre_attack.pyprowler/lib/outputs/compliance/okta_idaas_stig/okta_idaas_stig.pyprowler/lib/outputs/compliance/prowler_threatscore/prowler_threatscore.pyprowler/lib/outputs/compliance/universal/universal_table.pytests/lib/outputs/compliance/okta_idaas_stig/okta_idaas_stig_table_test.pytests/lib/outputs/compliance/universal/universal_table_test.py
| ) | ||
|
|
||
|
|
||
| class TestOktaIDaaSSTIGTable: |
There was a problem hiding this comment.
Add class docstring.
The test class TestOktaIDaaSSTIGTable is missing a docstring. As per coding guidelines, docstrings following Google style are required for all classes.
📝 Proposed addition
class TestOktaIDaaSSTIGTable:
+ """Test cases for Okta IDaaS STIG compliance table rendering.
+
+ Verifies multi-section counting and provider column attribution fixes.
+ """
def test_multi_section_fail_not_undercounted(self, capsys):🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@tests/lib/outputs/compliance/okta_idaas_stig/okta_idaas_stig_table_test.py`
at line 28, Add a Google-style docstring to the test class
TestOktaIDaaSSTIGTable: insert a short one-line summary describing the purpose
of the test class and, if helpful, a brief extended description or attributes
section explaining what behaviors or fixtures the tests cover; place the
docstring immediately below the class declaration in TestOktaIDaaSSTIGTable.
Source: Coding guidelines
Description
Fixes two bugs shared by every CLI compliance summary table generator:
compliance.Provider) that could point at another framework. It now uses the provider captured from the matched framework.Affected: okta_idaas_stig, cis, ens, c5, ccc, asd_essential_eight, kisa_ismsp, mitre_attack, prowler_threatscore and the universal table renderer. Only the CLI table output is affected; CSV/JSON/OCSF files and the API/UI are unchanged.
License
By submitting this pull request, I confirm that my contribution is made under
the terms of the Apache 2.0 license.
Steps to review
Please add a detailed description of how to review this PR.
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.
Summary by CodeRabbit
Bug Fixes
Tests
Chores