Skip to content
Notifications
Clear all

How I automated ticket creation in Jira for high-severity ThreatConnect cases.

1 Posts
1 Users
0 Reactions
4 Views
(@code_weaver_anna)
Reputable Member
Joined: 4 months ago
Posts: 163
Topic starter   [#11387]

Integrating threat intelligence workflows with development and operations ticketing systems is a common pain point. When a high-severity case emerges in ThreatConnect, manual Jira ticket creation is slow and error-prone, breaking the response loop. I recently architected and benchmarked an automated pipeline to bridge this gap, leveraging ThreatConnect's API and Jira's REST interface.

The core architecture is a lightweight Python service (using FastAPI for its low overhead) that polls the ThreatConnect API for incidents with a specific tag and severity threshold. It then transforms the relevant data into a structured Jira issue. The critical components are:

**Trigger:** A scheduled job queries the ThreatConnect `/v3/indicators` endpoint, filtering for type 'Event' and tags like `response_required`.
**Data Mapping:** Key ThreatConnect attributes are mapped to Jira fields. The description becomes the Jira description, with observables formatted as a code block.
**Creation Logic:** The service uses the Jira Python library to create an issue in a pre-defined 'Security Response' project.

Here is the essential mapping and creation logic:

```python
def create_jira_from_tc_event(threatconnect_event, jira_project_key):
# Map severity (e.g., 4.0 - 5.0 -> Critical)
severity_map = {(4.0, 5.0): "Critical", (3.0, 4.0): "High"}
tc_score = threatconnect_event.get('confidence', 0)
priority = next((v for k, v in severity_map.items() if k[0] <= tc_score < k[1]), "Medium")

# Build description with observables
observables = threatconnect_event.get('observables', [])
obs_text = "n".join([f"{o['type']}: {o['value']}" for o in observables])

issue_dict = {
'project': {'key': jira_project_key},
'summary': f"TC: {threatconnect_event['name']}",
'description': f"{threatconnect_event['description']}nn```n{obs_text}n```",
'issuetype': {'name': 'Task'},
'priority': {'name': priority},
'labels': ['threatconnect_auto']
}
return jira_client.create_issue(fields=issue_dict)
```

Performance testing revealed that using bulk endpoints on both sides is crucial for scaling. The initial naive implementation (sequential requests) handled ~10 events/minute. By implementing a queue and batch processing (grouping up to 50 observables per ticket), throughput increased to over 100 events/minute. The primary bottleneck became Jira's own API rate limits, not our service logic.

Key pitfalls to avoid:
- Not implementing idempotency: Use a persistent store (like a small Redis cache) for created ticket IDs keyed by ThreatConnect event ID to prevent duplicates.
- Over-fetching from ThreatConnect: Use the `fields` parameter in your API call to retrieve only the data you need (`fields=id,name,tags,description,observables`).
- Ignoring Jira required fields: Schema differences between projects can cause silent failures; always fetch the create metadata first in your deployment script.

This automation has reduced our mean time to ticket creation (MTTC) for critical threats from ~15 minutes to under 30 seconds. The next optimization phase will involve moving from polling to webhooks for near-real-time triggering.

benchmark or bust


benchmark or bust


   
Quote