Skip to content

Commit 71ee421

Browse files
authored
chore(ingestions): rename flag, update docs (#10236)
1 parent e96ea54 commit 71ee421

File tree

8 files changed

+86
-63
lines changed

8 files changed

+86
-63
lines changed

docs/user-guide/tutorials/prowler-app-import-findings.mdx

Lines changed: 48 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -132,69 +132,77 @@ Only **Detection Finding** (`class_uid: 2004`) records are accepted. Other OCSF
132132

133133
## Required permissions
134134

135-
The **Manage Ingestions** RBAC permission controls access to the ingestion endpoints. Without this permission, findings cannot be submitted via the API or `--export-ocsf`.
135+
The **Manage Ingestions** RBAC permission controls access to the ingestion endpoints. Without this permission, findings cannot be submitted via the API or `--push-to-cloud`.
136136

137137
For more information about RBAC permissions, refer to the [Prowler App RBAC documentation](/user-guide/tutorials/prowler-app-rbac).
138138

139139
## Using the CLI
140140

141-
The `--export-ocsf` flag uploads scan results directly to Prowler Cloud after a scan completes. This approach automates the ingestion process without manual file uploads.
141+
The `--push-to-cloud` flag uploads scan results directly to Prowler Cloud after a scan completes. This approach automates the ingestion process without manual file uploads.
142142

143143
### Prerequisites
144144

145145
- A valid Prowler Cloud API key (see [API Keys](/user-guide/tutorials/prowler-app-api-keys))
146-
- The `PROWLER_API_KEY` environment variable configured
146+
- The `PROWLER_CLOUD_API_KEY` environment variable configured
147147

148148
### Basic usage
149149

150150
```bash
151-
export PROWLER_API_KEY="pk_your_api_key_here"
151+
export PROWLER_CLOUD_API_KEY="pk_your_api_key_here"
152152

153-
prowler aws --export-ocsf
153+
prowler aws --push-to-cloud
154154
```
155155

156156
### Combining with output formats
157157

158-
When using `--export-ocsf` with custom output formats that exclude OCSF, Prowler generates a temporary OCSF file for upload:
158+
When using `--push-to-cloud` with custom output formats that exclude OCSF, Prowler generates a temporary OCSF file for upload:
159159

160160
The temporary OCSF file is saved in the system temporary directory and not in the output path passed with `-o`.
161161

162162
```bash
163-
prowler aws --services accessanalyzer -M csv --export-ocsf -o /tmp/scan-output
163+
prowler aws --services accessanalyzer -M csv --push-to-cloud -o /tmp/scan-output
164164
```
165165

166166
When default output formats include OCSF, Prowler reuses the existing file. Default output formats include JSON-OCSF:
167167

168168
```bash
169-
prowler aws --services accessanalyzer --export-ocsf -o /tmp/scan-output
169+
prowler aws --services accessanalyzer --push-to-cloud -o /tmp/scan-output
170170
```
171171

172172
### CLI output examples
173173

174174
**Successful upload:**
175175
```
176-
Exporting OCSF to Prowler Cloud, please wait...
176+
Pushing findings to Prowler Cloud, please wait...
177177
178-
OCSF export accepted. Ingestion job: fa8bc8c5-4925-46a0-9fe0-f6575905e094
178+
Findings successfully pushed to Prowler Cloud. Ingestion job: fa8bc8c5-4925-46a0-9fe0-f6575905e094
179+
See more details here: https://cloud.prowler.com/scans
179180
```
180181

181182
**Missing API key:**
182183
```
183-
WARNING: OCSF export skipped: no API key configured. Set the PROWLER_API_KEY
184+
Push to Prowler Cloud skipped: no API key configured. Set the PROWLER_CLOUD_API_KEY
184185
environment variable to enable it. Scan results were saved to
185186
/tmp/scan-output/prowler-output-123456789012-20260217131755.ocsf.json
186187
```
187188

188189
**API unreachable:**
189190
```
190-
WARNING: OCSF export skipped: could not reach the Prowler Cloud API at
191+
Push to Prowler Cloud failed: could not reach the Prowler Cloud API at
191192
https://api.prowler.com. Check the URL and your network connection. Scan results
192193
were saved to /tmp/scan-output/prowler-output-123456789012-20260217131755.ocsf.json
193194
```
194195

196+
**No subscription:**
197+
```
198+
Push to Prowler Cloud failed: this feature is only available with a Prowler Cloud
199+
subscription. Scan results were saved to
200+
/tmp/scan-output/prowler-output-123456789012-20260217131755.ocsf.json
201+
```
202+
195203
**Invalid API key:**
196204
```
197-
WARNING: OCSF export failed: the API returned HTTP 401. Verify your API key is
205+
Push to Prowler Cloud failed: the API returned HTTP 401. Verify your API key is
198206
valid and has the right permissions. Scan results were saved to
199207
/tmp/scan-output/prowler-output-123456789012-20260217131755.ocsf.json
200208
```
@@ -212,10 +220,10 @@ The Ingestion API provides endpoints for submitting OCSF files and monitoring jo
212220
Include the API key in the `Authorization` header:
213221

214222
```bash
215-
export PROWLER_API_KEY="pk_your_api_key_here"
223+
export PROWLER_CLOUD_API_KEY="pk_your_api_key_here"
216224

217225
curl -X POST \
218-
-H "Authorization: Api-Key ${PROWLER_API_KEY}" \
226+
-H "Authorization: Api-Key ${PROWLER_CLOUD_API_KEY}" \
219227
-F "file=@/path/to/findings.ocsf.json" \
220228
https://api.prowler.com/api/v1/ingestions
221229
```
@@ -229,7 +237,7 @@ Upload a `.ocsf.json` file containing a JSON array of OCSF Detection Finding rec
229237
**Request:**
230238
```bash
231239
curl -X POST \
232-
-H "Authorization: Api-Key ${PROWLER_API_KEY}" \
240+
-H "Authorization: Api-Key ${PROWLER_CLOUD_API_KEY}" \
233241
-F "file=@scan-results.ocsf.json" \
234242
https://api.prowler.com/api/v1/ingestions
235243
```
@@ -267,7 +275,7 @@ Monitor the progress of an ingestion job.
267275
**Request:**
268276
```bash
269277
curl -X GET \
270-
-H "Authorization: Api-Key ${PROWLER_API_KEY}" \
278+
-H "Authorization: Api-Key ${PROWLER_CLOUD_API_KEY}" \
271279
-H "Accept: application/vnd.api+json" \
272280
https://api.prowler.com/api/v1/ingestions/3650fef9-8e5f-4808-a95f-74f0afae8499
273281
```
@@ -319,7 +327,7 @@ Retrieve a list of ingestion jobs for the tenant.
319327
**Request:**
320328
```bash
321329
curl -X GET \
322-
-H "Authorization: Api-Key ${PROWLER_API_KEY}" \
330+
-H "Authorization: Api-Key ${PROWLER_CLOUD_API_KEY}" \
323331
-H "Accept: application/vnd.api+json" \
324332
"https://api.prowler.com/api/v1/ingestions?filter[status]=completed&page[size]=10"
325333
```
@@ -333,7 +341,7 @@ Retrieve error details for a specific ingestion job.
333341
**Request:**
334342
```bash
335343
curl -X GET \
336-
-H "Authorization: Api-Key ${PROWLER_API_KEY}" \
344+
-H "Authorization: Api-Key ${PROWLER_CLOUD_API_KEY}" \
337345
-H "Accept: application/vnd.api+json" \
338346
https://api.prowler.com/api/v1/ingestions/3650fef9-8e5f-4808-a95f-74f0afae8499/errors
339347
```
@@ -363,9 +371,9 @@ Prowler must be installed in the CI/CD environment before running scans. Refer t
363371

364372
- name: Run Prowler and upload to Cloud
365373
env:
366-
PROWLER_API_KEY: ${{ secrets.PROWLER_API_KEY }}
374+
PROWLER_CLOUD_API_KEY: ${{ secrets.PROWLER_CLOUD_API_KEY }}
367375
run: |
368-
prowler aws --services s3,iam --export-ocsf
376+
prowler aws --services s3,iam --push-to-cloud
369377
```
370378
371379
### GitLab CI
@@ -374,9 +382,9 @@ Prowler must be installed in the CI/CD environment before running scans. Refer t
374382
prowler_scan:
375383
script:
376384
- pip install prowler
377-
- prowler aws --services s3,iam --export-ocsf
385+
- prowler aws --services s3,iam --push-to-cloud
378386
variables:
379-
PROWLER_API_KEY: $PROWLER_API_KEY
387+
PROWLER_CLOUD_API_KEY: $PROWLER_CLOUD_API_KEY
380388
```
381389
382390
## Billing impact
@@ -392,6 +400,23 @@ For pricing details, see [Prowler Cloud Pricing](https://prowler.com/pricing).
392400
393401
## Troubleshooting
394402
403+
### "Push to Prowler Cloud skipped: no API key configured"
404+
405+
- Set the `PROWLER_CLOUD_API_KEY` environment variable before running the scan
406+
- Verify the variable is exported and not empty
407+
408+
### "Push to Prowler Cloud failed: could not reach the Prowler Cloud API"
409+
410+
- Verify network connectivity to `api.prowler.com`
411+
- Check firewall rules allow outbound HTTPS traffic
412+
- Confirm the API endpoint is not blocked by proxy settings
413+
- If using a custom base URL via `PROWLER_CLOUD_API_BASE_URL`, verify it is correct
414+
415+
### "Push to Prowler Cloud failed: this feature is only available with a Prowler Cloud subscription"
416+
417+
- The API returned HTTP 402, meaning your tenant does not have an active subscription
418+
- Visit [Prowler Cloud Pricing](https://prowler.com/pricing) to review available plans
419+
395420
### HTTP 401 Unauthorized
396421

397422
- Verify the API key is valid and not revoked
@@ -408,9 +433,3 @@ For pricing details, see [Prowler Cloud Pricing](https://prowler.com/pricing).
408433
- Check the `/api/v1/ingestions/{id}/errors` endpoint for details
409434
- Verify the OCSF file format is valid
410435
- Ensure the file contains Detection Finding records
411-
412-
### CLI reports "could not reach the Prowler Cloud API"
413-
414-
- Verify network connectivity to `api.prowler.com`
415-
- Check firewall rules allow outbound HTTPS traffic
416-
- Confirm the API endpoint is not blocked by proxy settings

docs/user-guide/tutorials/prowler-app-rbac.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,6 @@ To grant all administrative permissions, select the **Grant all admin permission
238238

239239
The following permissions are available exclusively in **Prowler Cloud**:
240240

241-
**Manage Ingestions:** Submit and manage findings ingestion jobs via the API. Required to upload OCSF scan results using the `--export-ocsf` CLI flag or the ingestion endpoints. See [Import Findings](/user-guide/tutorials/prowler-app-import-findings) for details.
241+
**Manage Ingestions:** Submit and manage findings ingestion jobs via the API. Required to upload OCSF scan results using the `--push-to-cloud` CLI flag or the ingestion endpoints. See [Import Findings](/user-guide/tutorials/prowler-app-import-findings) for details.
242242

243243
**Manage Billing:** Access and manage billing settings, subscription plans, and payment methods.

prowler/__main__.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ def streaming_callback(findings_batch):
529529
provider=global_provider, stats=stats
530530
)
531531

532-
if getattr(args, "export_ocsf", False):
532+
if getattr(args, "push_to_cloud", False):
533533
if not ocsf_output or not getattr(ocsf_output, "file_path", None):
534534
tmp_ocsf = tempfile.NamedTemporaryFile(
535535
suffix=json_ocsf_file_suffix, delete=False
@@ -541,49 +541,50 @@ def streaming_callback(findings_batch):
541541
tmp_ocsf.close()
542542
ocsf_output.batch_write_data_to_file()
543543
print(
544-
f"{Style.BRIGHT}\nExporting OCSF to Prowler Cloud, please wait...{Style.RESET_ALL}"
544+
f"{Style.BRIGHT}\nPushing findings to Prowler Cloud, please wait...{Style.RESET_ALL}"
545545
)
546546
try:
547547
response = send_ocsf_to_api(ocsf_output.file_path)
548548
except ValueError:
549549
print(
550-
f"{Style.BRIGHT}{Fore.YELLOW}\nOCSF export skipped: no API key configured. "
551-
"Set the PROWLER_API_KEY environment variable to enable it. "
550+
f"{Style.BRIGHT}{Fore.YELLOW}\nPush to Prowler Cloud skipped: no API key configured. "
551+
"Set the PROWLER_CLOUD_API_KEY environment variable to enable it. "
552552
f"Scan results were saved to {ocsf_output.file_path}{Style.RESET_ALL}"
553553
)
554554
except requests.ConnectionError:
555555
print(
556-
f"{Style.BRIGHT}{Fore.RED}\nOCSF export failed: could not reach the Prowler Cloud API at "
556+
f"{Style.BRIGHT}{Fore.RED}\nPush to Prowler Cloud failed: could not reach the Prowler Cloud API at "
557557
f"{cloud_api_base_url}. Check the URL and your network connection. "
558558
f"Scan results were saved to {ocsf_output.file_path}{Style.RESET_ALL}"
559559
)
560560
except requests.HTTPError as http_err:
561561
if http_err.response.status_code == 402:
562562
print(
563-
f"{Style.BRIGHT}{Fore.RED}\nOCSF export failed: "
563+
f"{Style.BRIGHT}{Fore.RED}\nPush to Prowler Cloud failed: "
564564
"this feature is only available with a Prowler Cloud subscription. "
565565
f"Scan results were saved to {ocsf_output.file_path}{Style.RESET_ALL}"
566566
)
567567
else:
568568
print(
569-
f"{Style.BRIGHT}{Fore.RED}\nOCSF export failed: the API returned HTTP {http_err.response.status_code}. "
569+
f"{Style.BRIGHT}{Fore.RED}\nPush to Prowler Cloud failed: the API returned HTTP {http_err.response.status_code}. "
570570
"Verify your API key is valid and has the right permissions. "
571571
f"Scan results were saved to {ocsf_output.file_path}{Style.RESET_ALL}"
572572
)
573573
except Exception as error:
574574
print(
575-
f"{Style.BRIGHT}{Fore.RED}\nOCSF export failed unexpectedly: {error}. "
575+
f"{Style.BRIGHT}{Fore.RED}\nPush to Prowler Cloud failed unexpectedly: {error}. "
576576
f"Scan results were saved to {ocsf_output.file_path}{Style.RESET_ALL}"
577577
)
578578
else:
579579
job_id = response.get("data", {}).get("id") if response else None
580580
if job_id:
581581
print(
582-
f"{Style.BRIGHT}{Fore.GREEN}\nOCSF export accepted. Ingestion job: {job_id}{Style.RESET_ALL}"
582+
f"{Style.BRIGHT}{Fore.GREEN}\nFindings successfully pushed to Prowler Cloud. Ingestion job: {job_id}"
583+
f"\nSee more details here: https://cloud.prowler.com/scans{Style.RESET_ALL}"
583584
)
584585
else:
585586
logger.warning(
586-
"OCSF export: unexpected API response (missing ingestion job ID). "
587+
"Push to Prowler Cloud: unexpected API response (missing ingestion job ID). "
587588
f"Scan results were saved to {ocsf_output.file_path}"
588589
)
589590

prowler/config/config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,8 @@ def get_available_compliance_frameworks(provider=None):
122122
available_output_formats = ["csv", "json-asff", "json-ocsf", "html"]
123123

124124
# Prowler Cloud API settings
125-
cloud_api_base_url = os.getenv("PROWLER_CLOUD_API_BASE", "https://api.prowler.com")
126-
cloud_api_key = os.getenv("PROWLER_API_KEY", "")
125+
cloud_api_base_url = os.getenv("PROWLER_CLOUD_API_BASE_URL", "https://api.prowler.com")
126+
cloud_api_key = os.getenv("PROWLER_CLOUD_API_KEY", "")
127127
cloud_api_ingestion_path = "/api/v1/ingestions"
128128

129129

prowler/lib/cli/parser.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -217,12 +217,13 @@ def __init_outputs_parser__(self):
217217
help="Set the output timestamp format as unix timestamps instead of iso format timestamps (default mode).",
218218
)
219219
common_outputs_parser.add_argument(
220-
"--export-ocsf",
220+
"--push-to-cloud",
221221
action="store_true",
222222
help=(
223-
"Send OCSF output to Prowler Cloud ingestion endpoint. "
224-
"Requires PROWLER_API_KEY environment variable. "
225-
"For the IaC provider, --provider-uid is also required."
223+
"Send findings in OCSF format to Prowler Cloud. "
224+
"Requires PROWLER_CLOUD_API_KEY environment variable. "
225+
"For the IaC provider, --provider-uid is also required. "
226+
"More details here: https://goto.prowler.com/import-findings"
226227
),
227228
)
228229

prowler/lib/outputs/ocsf/ingestion.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ def send_ocsf_to_api(
2121
2222
Args:
2323
file_path: Path to the OCSF JSON file to upload.
24-
base_url: API base URL. Falls back to PROWLER_CLOUD_API_BASE env var,
24+
base_url: API base URL. Falls back to PROWLER_CLOUD_API_BASE_URL env var,
2525
then to https://api.prowler.com.
26-
api_key: API key. Falls back to PROWLER_API_KEY env var.
26+
api_key: API key. Falls back to PROWLER_CLOUD_API_KEY env var.
2727
timeout: Request timeout in seconds.
2828
2929
Returns:
@@ -42,7 +42,9 @@ def send_ocsf_to_api(
4242

4343
api_key = api_key or cloud_api_key
4444
if not api_key:
45-
raise ValueError("Missing API key. Set PROWLER_API_KEY environment variable.")
45+
raise ValueError(
46+
"Missing API key. Set PROWLER_CLOUD_API_KEY environment variable."
47+
)
4648

4749
base_url = base_url or cloud_api_base_url
4850
base_url = base_url.rstrip("/")

prowler/providers/iac/lib/arguments/arguments.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def init_parser(self):
7474
"--provider-uid",
7575
dest="provider_uid",
7676
default=None,
77-
help="Unique identifier for the IaC provider. Required when using --export-ocsf.",
77+
help="Unique identifier for the IaC provider. Required when using --push-to-cloud.",
7878
)
7979

8080

@@ -88,12 +88,12 @@ def validate_arguments(arguments):
8888
False,
8989
"--scan-path (-P) and --scan-repository-url (-R) are mutually exclusive. Please specify only one.",
9090
)
91-
export_ocsf = getattr(arguments, "export_ocsf", False)
91+
push_to_cloud = getattr(arguments, "push_to_cloud", False)
9292
provider_uid = getattr(arguments, "provider_uid", None)
93-
if export_ocsf and not provider_uid:
93+
if push_to_cloud and not provider_uid:
9494
return (
9595
False,
96-
"--provider-uid is required when using --export-ocsf with the IAC provider.",
96+
"--provider-uid is required when using --push-to-cloud with the IAC provider.",
9797
)
9898
if provider_uid and not re.match(
9999
r"^(https?://|git@|ssh://)[^\s/]+[^\s]*\.git$|^(https?://)[^\s/]+[^\s]*$",

0 commit comments

Comments
 (0)