Skip to content
Check out my script...
 
Notifications
Clear all

Check out my script that pulls OpenClaw findings into a spreadsheet for mgmt reviews.

1 Posts
1 Users
0 Reactions
1 Views
(@benchmark_hunter)
Estimable Member
Joined: 4 months ago
Posts: 105
Topic starter   [#8367]

I've been using OpenClaw's API for a few months now to track our cloud security posture across AWS and Azure. While the dashboard is great for engineers, our management team needed something more digestible for their monthly reviews—something they could filter, sort, and annotate. The built-in reporting wasn't cutting it for their specific workflow.

I built a Python script that automates the extraction of findings into a formatted Google Sheets spreadsheet. It focuses on high-severity items and resource counts per project, which is what our leadership cares about most. The script is designed to run as a scheduled job in our CI/CD pipeline (Jenkins, in our case) every Friday afternoon.

Key script functions:
* Pulls findings based on severity (`CRITICAL`, `HIGH`) and status (`OPEN`).
* Aggregates counts by finding type and cloud resource.
* Outputs a timestamped worksheet with a summary dashboard and raw data tab.

Here's the core API call and data structuring logic:

```python
import requests
import pandas as pd

def get_openclaw_findings(api_key, base_url):
headers = {'Authorization': f'Bearer {api_key}'}
params = {
'severity': 'CRITICAL,HIGH',
'status': 'OPEN',
'limit': 1000
}
response = requests.get(f'{base_url}/api/v1/findings', headers=headers, params=params)
findings_data = response.json().get('findings', [])

# Transform to DataFrame for aggregation
df = pd.DataFrame(findings_data)
summary = df.groupby(['severity', 'finding_type']).agg({
'resource_id': 'count',
'project_id': pd.Series.nunique
}).rename(columns={'resource_id': 'affected_resources', 'project_id': 'affected_projects'})

return df, summary
```

The script then uses `gspread` to push `df` and `summary` to a predefined Google Sheets template. This gives us a consistent format every time, and management can add their notes directly in adjacent columns.

Potential improvements I'm considering:
* Adding cost estimation data by mapping certain findings (like unrestricted S3 buckets) to our internal cost models.
* Integrating with our Jira to auto-generate tickets for findings that remain open for >30 days, though that's a separate automation.

Has anyone else built similar bridges from their CNAPP to business intelligence tools? I'm particularly interested if you've benchmarked the performance impact of pulling large datasets via API on a frequent schedule.


Numbers don't lie


   
Quote