Skip to content

Commit 7e0c554

Browse files
authored
feat(api): restore compliance overview endpoint (#9330)
1 parent 79ec53b commit 7e0c554

File tree

5 files changed

+149
-570
lines changed

5 files changed

+149
-570
lines changed

api/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
All notable changes to the **Prowler API** are documented in this file.
44

5+
## [1.16.0] (Unreleased)
6+
7+
### Changed
8+
- Restore the compliance overview endpoint's mandatory filters [(#9330)](https://github.com/prowler-cloud/prowler/pull/9330)
9+
10+
---
11+
512
## [1.15.1] (Prowler v5.14.1)
613

714
### Fixed

api/src/backend/api/filters.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -761,14 +761,6 @@ class Meta:
761761
class ComplianceOverviewFilter(FilterSet):
762762
inserted_at = DateFilter(field_name="inserted_at", lookup_expr="date")
763763
scan_id = UUIDFilter(field_name="scan_id")
764-
provider_id = UUIDFilter(field_name="scan__provider__id", lookup_expr="exact")
765-
provider_id__in = UUIDInFilter(field_name="scan__provider__id", lookup_expr="in")
766-
provider_type = ChoiceFilter(
767-
field_name="scan__provider__provider", choices=Provider.ProviderChoices.choices
768-
)
769-
provider_type__in = ChoiceInFilter(
770-
field_name="scan__provider__provider", choices=Provider.ProviderChoices.choices
771-
)
772764
region = CharFilter(field_name="region")
773765

774766
class Meta:

api/src/backend/api/specs/v1.yaml

Lines changed: 78 additions & 166 deletions
Original file line numberDiff line numberDiff line change
@@ -283,11 +283,8 @@ paths:
283283
/api/v1/compliance-overviews:
284284
get:
285285
operationId: compliance_overviews_list
286-
description: Retrieve an overview of all compliance frameworks. If scan_id is
287-
provided, returns compliance data for that specific scan. If scan_id is omitted,
288-
returns compliance data aggregated from the latest completed scan of each
289-
provider.
290-
summary: List compliance overviews
286+
description: Retrieve an overview of all the compliance in a given scan.
287+
summary: List compliance overviews for a scan
291288
parameters:
292289
- in: query
293290
name: fields[compliance-overviews]
@@ -346,32 +343,6 @@ paths:
346343
schema:
347344
type: string
348345
format: date-time
349-
- in: query
350-
name: filter[provider_id]
351-
schema:
352-
type: string
353-
format: uuid
354-
description: Filter by specific provider ID.
355-
- in: query
356-
name: filter[provider_id__in]
357-
schema:
358-
type: array
359-
items:
360-
type: string
361-
format: uuid
362-
description: Filter by multiple provider IDs (comma-separated).
363-
- in: query
364-
name: filter[provider_type]
365-
schema:
366-
type: string
367-
description: Filter by provider type (e.g., aws, azure, gcp).
368-
- in: query
369-
name: filter[provider_type__in]
370-
schema:
371-
type: array
372-
items:
373-
type: string
374-
description: Filter by multiple provider types (comma-separated).
375346
- in: query
376347
name: filter[region]
377348
schema:
@@ -394,8 +365,8 @@ paths:
394365
schema:
395366
type: string
396367
format: uuid
397-
description: Optional scan ID. If provided, returns compliance for that scan.
398-
If omitted, returns compliance for the latest completed scan per provider.
368+
description: Related scan ID.
369+
required: true
399370
- name: filter[search]
400371
required: false
401372
in: query
@@ -635,77 +606,6 @@ paths:
635606
schema:
636607
type: string
637608
format: date-time
638-
- in: query
639-
name: filter[provider_id]
640-
schema:
641-
type: string
642-
format: uuid
643-
- in: query
644-
name: filter[provider_id__in]
645-
schema:
646-
type: array
647-
items:
648-
type: string
649-
format: uuid
650-
description: Multiple values may be separated by commas.
651-
explode: false
652-
style: form
653-
- in: query
654-
name: filter[provider_type]
655-
schema:
656-
type: string
657-
x-spec-enum-id: eca8c51e6bd28935
658-
enum:
659-
- aws
660-
- azure
661-
- gcp
662-
- github
663-
- iac
664-
- kubernetes
665-
- m365
666-
- mongodbatlas
667-
- oraclecloud
668-
description: |-
669-
* `aws` - AWS
670-
* `azure` - Azure
671-
* `gcp` - GCP
672-
* `kubernetes` - Kubernetes
673-
* `m365` - M365
674-
* `github` - GitHub
675-
* `mongodbatlas` - MongoDB Atlas
676-
* `iac` - IaC
677-
* `oraclecloud` - Oracle Cloud Infrastructure
678-
- in: query
679-
name: filter[provider_type__in]
680-
schema:
681-
type: array
682-
items:
683-
type: string
684-
x-spec-enum-id: eca8c51e6bd28935
685-
enum:
686-
- aws
687-
- azure
688-
- gcp
689-
- github
690-
- iac
691-
- kubernetes
692-
- m365
693-
- mongodbatlas
694-
- oraclecloud
695-
description: |-
696-
Multiple values may be separated by commas.
697-
698-
* `aws` - AWS
699-
* `azure` - Azure
700-
* `gcp` - GCP
701-
* `kubernetes` - Kubernetes
702-
* `m365` - M365
703-
* `github` - GitHub
704-
* `mongodbatlas` - MongoDB Atlas
705-
* `iac` - IaC
706-
* `oraclecloud` - Oracle Cloud Infrastructure
707-
explode: false
708-
style: form
709609
- in: query
710610
name: filter[region]
711611
schema:
@@ -5068,6 +4968,8 @@ paths:
50684968
type: string
50694969
enum:
50704970
- id
4971+
- provider_type
4972+
- region
50714973
- total
50724974
- fail
50734975
- muted
@@ -5200,6 +5102,10 @@ paths:
52005102
enum:
52015103
- id
52025104
- -id
5105+
- provider_type
5106+
- -provider_type
5107+
- region
5108+
- -region
52035109
- total
52045110
- -total
52055111
- fail
@@ -8984,50 +8890,12 @@ paths:
89848890
description: CSV file containing the compliance report
89858891
'404':
89868892
description: Compliance report not found
8987-
/api/v1/scans/{id}/report:
8988-
get:
8989-
operationId: scans_report_retrieve
8990-
description: Returns a ZIP file containing the requested report
8991-
summary: Download ZIP report
8992-
parameters:
8993-
- in: query
8994-
name: fields[scan-reports]
8995-
schema:
8996-
type: array
8997-
items:
8998-
type: string
8999-
enum:
9000-
- id
9001-
description: endpoint return only specific fields in the response on a per-type
9002-
basis by including a fields[TYPE] query parameter.
9003-
explode: false
9004-
- in: path
9005-
name: id
9006-
schema:
9007-
type: string
9008-
format: uuid
9009-
description: A UUID string identifying this scan.
9010-
required: true
9011-
tags:
9012-
- Scan
9013-
security:
9014-
- JWT or API Key: []
9015-
responses:
9016-
'200':
9017-
description: Report obtained successfully
9018-
'202':
9019-
description: The task is in progress
9020-
'403':
9021-
description: There is a problem with credentials
9022-
'404':
9023-
description: The scan has no reports, or the report generation task has
9024-
not started yet
9025-
/api/v1/scans/{id}/threatscore:
8893+
/api/v1/scans/{id}/ens:
90268894
get:
9027-
operationId: scans_threatscore_retrieve
9028-
description: Download a specific threatscore report (e.g., 'prowler_threatscore_aws')
8895+
operationId: scans_ens_retrieve
8896+
description: Download ENS RD2022 compliance report (e.g., 'ens_rd2022_aws')
90298897
as a PDF file.
9030-
summary: Retrieve threatscore report
8898+
summary: Retrieve ENS RD2022 compliance report
90318899
parameters:
90328900
- in: query
90338901
name: fields[scans]
@@ -9078,22 +8946,22 @@ paths:
90788946
- JWT or API Key: []
90798947
responses:
90808948
'200':
9081-
description: PDF file containing the threatscore report
8949+
description: PDF file containing the ENS compliance report
90828950
'202':
90838951
description: The task is in progress
90848952
'401':
90858953
description: API key missing or user not Authenticated
90868954
'403':
90878955
description: There is a problem with credentials
90888956
'404':
9089-
description: The scan has no threatscore reports, or the threatscore report
9090-
generation task has not started yet
9091-
/api/v1/scans/{id}/ens:
8957+
description: The scan has no ENS reports, or the ENS report generation task
8958+
has not started yet
8959+
/api/v1/scans/{id}/nis2:
90928960
get:
9093-
operationId: scans_ens_retrieve
9094-
description: Download a specific ENS compliance report (e.g., 'prowler_ens_aws')
9095-
as a PDF file.
9096-
summary: Retrieve ENS compliance report
8961+
operationId: scans_nis2_retrieve
8962+
description: Download NIS2 compliance report (Directive (EU) 2022/2555) as a
8963+
PDF file.
8964+
summary: Retrieve NIS2 compliance report
90978965
parameters:
90988966
- in: query
90998967
name: fields[scans]
@@ -9144,22 +9012,60 @@ paths:
91449012
- JWT or API Key: []
91459013
responses:
91469014
'200':
9147-
description: PDF file containing the ENS compliance report
9015+
description: PDF file containing the NIS2 compliance report
91489016
'202':
91499017
description: The task is in progress
91509018
'401':
91519019
description: API key missing or user not Authenticated
91529020
'403':
91539021
description: There is a problem with credentials
91549022
'404':
9155-
description: The scan has no ENS reports, or the ENS report generation task
9156-
has not started yet
9157-
/api/v1/scans/{id}/nis2:
9023+
description: The scan has no NIS2 reports, or the NIS2 report generation
9024+
task has not started yet
9025+
/api/v1/scans/{id}/report:
91589026
get:
9159-
operationId: scans_nis2_retrieve
9160-
description: Download NIS2 compliance report (Directive (EU) 2022/2555) as a
9161-
PDF file.
9162-
summary: Retrieve NIS2 compliance report
9027+
operationId: scans_report_retrieve
9028+
description: Returns a ZIP file containing the requested report
9029+
summary: Download ZIP report
9030+
parameters:
9031+
- in: query
9032+
name: fields[scan-reports]
9033+
schema:
9034+
type: array
9035+
items:
9036+
type: string
9037+
enum:
9038+
- id
9039+
description: endpoint return only specific fields in the response on a per-type
9040+
basis by including a fields[TYPE] query parameter.
9041+
explode: false
9042+
- in: path
9043+
name: id
9044+
schema:
9045+
type: string
9046+
format: uuid
9047+
description: A UUID string identifying this scan.
9048+
required: true
9049+
tags:
9050+
- Scan
9051+
security:
9052+
- JWT or API Key: []
9053+
responses:
9054+
'200':
9055+
description: Report obtained successfully
9056+
'202':
9057+
description: The task is in progress
9058+
'403':
9059+
description: There is a problem with credentials
9060+
'404':
9061+
description: The scan has no reports, or the report generation task has
9062+
not started yet
9063+
/api/v1/scans/{id}/threatscore:
9064+
get:
9065+
operationId: scans_threatscore_retrieve
9066+
description: Download a specific threatscore report (e.g., 'prowler_threatscore_aws')
9067+
as a PDF file.
9068+
summary: Retrieve threatscore report
91639069
parameters:
91649070
- in: query
91659071
name: fields[scans]
@@ -9210,16 +9116,16 @@ paths:
92109116
- JWT or API Key: []
92119117
responses:
92129118
'200':
9213-
description: PDF file containing the NIS2 compliance report
9119+
description: PDF file containing the threatscore report
92149120
'202':
92159121
description: The task is in progress
92169122
'401':
92179123
description: API key missing or user not Authenticated
92189124
'403':
92199125
description: There is a problem with credentials
92209126
'404':
9221-
description: The scan has no NIS2 reports, or the NIS2 report generation
9222-
task has not started yet
9127+
description: The scan has no threatscore reports, or the threatscore report
9128+
generation task has not started yet
92239129
/api/v1/schedules/daily:
92249130
post:
92259131
operationId: schedules_daily_create
@@ -13558,6 +13464,11 @@ components:
1355813464
properties:
1355913465
id:
1356013466
type: string
13467+
readOnly: true
13468+
provider_type:
13469+
type: string
13470+
region:
13471+
type: string
1356113472
total:
1356213473
type: integer
1356313474
fail:
@@ -13567,7 +13478,8 @@ components:
1356713478
pass:
1356813479
type: integer
1356913480
required:
13570-
- id
13481+
- provider_type
13482+
- region
1357113483
- total
1357213484
- fail
1357313485
- muted

0 commit comments

Comments
 (0)