Skip to content

Commit d90680c

Browse files
authored
Merge pull request #2 from pangerlkr/copilot/fix-workflow-errors
[WIP] Fix errors in the workflow
2 parents eb507e1 + f123fe8 commit d90680c

File tree

4 files changed

+24
-17
lines changed

4 files changed

+24
-17
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,11 @@ jobs:
9090

9191
- name: Build Docker images
9292
run: |
93-
docker-compose build --no-cache
93+
docker compose build --no-cache
9494
9595
- name: Test Docker Compose
9696
run: |
97-
docker-compose config
97+
docker compose config
9898
9999
security-scan:
100100
name: Security Vulnerability Scan
@@ -127,7 +127,7 @@ jobs:
127127
output: 'trivy-results.sarif'
128128

129129
- name: Upload Trivy results to GitHub Security
130-
uses: github/codeql-action/upload-sarif@v2
130+
uses: github/codeql-action/upload-sarif@v3
131131
if: always()
132132
with:
133133
sarif_file: 'trivy-results.sarif'

gateway/app.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from fastapi import FastAPI, HTTPException
33
from fastapi.middleware.cors import CORSMiddleware
44
from pydantic import BaseModel
5-
from typing import List, Dict, Any
5+
from typing import List
66
import sys
77
import os
88

@@ -79,7 +79,7 @@ async def analyze_ioc(request: IOCRequest):
7979
"""Analyze a single IOC"""
8080
if not ioc_analyzer:
8181
raise HTTPException(status_code=503, detail="IOC Analyzer service unavailable")
82-
82+
8383
result = ioc_analyzer.analyze(request.ioc)
8484
return result
8585

@@ -89,7 +89,7 @@ async def batch_analyze_ioc(request: BatchIOCRequest):
8989
"""Analyze multiple IOCs"""
9090
if not ioc_analyzer:
9191
raise HTTPException(status_code=503, detail="IOC Analyzer service unavailable")
92-
92+
9393
results = ioc_analyzer.batch_analyze(request.iocs)
9494
return {"results": results, "count": len(results)}
9595

@@ -99,7 +99,7 @@ async def get_threat_feeds():
9999
"""Get configured threat feeds"""
100100
if not threat_feed:
101101
raise HTTPException(status_code=503, detail="Threat Feed service unavailable")
102-
102+
103103
feeds = threat_feed.get_feeds()
104104
return {"feeds": feeds, "count": len(feeds)}
105105

@@ -109,7 +109,7 @@ async def get_threat_indicators():
109109
"""Get threat indicators from feeds"""
110110
if not threat_feed:
111111
raise HTTPException(status_code=503, detail="Threat Feed service unavailable")
112-
112+
113113
indicators = threat_feed.fetch_indicators()
114114
return {"indicators": indicators, "count": len(indicators)}
115115

gateway/main.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
"""CTIAS Lab Gateway API - Main FastAPI Application"""
2-
import os
32
from fastapi import FastAPI, HTTPException
43
from fastapi.middleware.cors import CORSMiddleware
54
from fastapi.responses import JSONResponse
@@ -29,21 +28,26 @@
2928
)
3029

3130
# Request/Response models
31+
32+
3233
class HealthCheckResponse(BaseModel):
3334
status: str
3435
version: str
3536
database: str
3637
redis: str
3738

39+
3840
class IOCSubmission(BaseModel):
3941
ioc_value: str
4042
ioc_type: str # ip, domain, url, hash, email
4143
tags: list[str] = []
4244

45+
4346
class ReconRequest(BaseModel):
4447
target: str
4548
modules: list[str] = ["dns", "whois", "ssl"]
4649

50+
4751
# Routes
4852
@app.get("/")
4953
async def root():
@@ -59,6 +63,7 @@ async def root():
5963
}
6064
}
6165

66+
6267
@app.get("/health")
6368
async def health_check():
6469
"""Health check endpoint"""
@@ -76,6 +81,7 @@ async def health_check():
7681
content={"status": "unhealthy", "error": str(e)}
7782
)
7883

84+
7985
@app.post("/api/v1/ioc/analyze")
8086
async def analyze_ioc(submission: IOCSubmission):
8187
"""Analyze an Indicator of Compromise (IOC)"""
@@ -93,6 +99,7 @@ async def analyze_ioc(submission: IOCSubmission):
9399
except Exception as e:
94100
raise HTTPException(status_code=400, detail=str(e))
95101

102+
96103
@app.post("/api/v1/recon")
97104
async def start_reconnaissance(recon_req: ReconRequest):
98105
"""Start reconnaissance on a target"""
@@ -108,6 +115,7 @@ async def start_reconnaissance(recon_req: ReconRequest):
108115
except Exception as e:
109116
raise HTTPException(status_code=400, detail=str(e))
110117

118+
111119
@app.get("/api/v1/status/{task_id}")
112120
async def get_task_status(task_id: str):
113121
"""Get status of a task"""

modules-python/ioc_analyzer.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"""IOC Analyzer Module for CTIAS Lab"""
22
import re
3-
import hashlib
43
from typing import Dict, List, Any
54

65

@@ -27,39 +26,39 @@ def identify_ioc_type(self, ioc: str) -> str:
2726
def analyze(self, ioc: str) -> Dict[str, Any]:
2827
"""Analyze an IOC and return threat intelligence"""
2928
ioc_type = self.identify_ioc_type(ioc)
30-
29+
3130
result = {
3231
'ioc': ioc,
3332
'type': ioc_type,
3433
'risk_score': self._calculate_risk_score(ioc, ioc_type),
3534
'metadata': self._get_metadata(ioc, ioc_type)
3635
}
37-
36+
3837
return result
3938

4039
def _calculate_risk_score(self, ioc: str, ioc_type: str) -> int:
4140
"""Calculate risk score (0-100) based on IOC characteristics"""
4241
# Placeholder risk scoring logic
4342
base_score = 50
44-
43+
4544
if ioc_type == 'unknown':
4645
return 0
47-
46+
4847
# Add risk factors
4948
if ioc_type in ['md5', 'sha1', 'sha256']:
5049
base_score += 20 # File hashes are potentially malicious
51-
50+
5251
return min(base_score, 100)
5352

5453
def _get_metadata(self, ioc: str, ioc_type: str) -> Dict[str, Any]:
5554
"""Extract metadata from IOC"""
5655
metadata = {'analyzed': True}
57-
56+
5857
if ioc_type in ['md5', 'sha1', 'sha256']:
5958
metadata['hash_algorithm'] = ioc_type.upper()
6059
elif ioc_type == 'ip':
6160
metadata['ip_version'] = 'IPv4'
62-
61+
6362
return metadata
6463

6564
def batch_analyze(self, iocs: List[str]) -> List[Dict[str, Any]]:

0 commit comments

Comments
 (0)