Skip to content

Commit

Permalink
precommit fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorwalton committed Jun 28, 2024
1 parent 23e57bb commit 5ca6a76
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 8 deletions.
2 changes: 1 addition & 1 deletion backend/app/routers/threat_intel.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from fastapi import APIRouter

from app.threat_intel.routes.socfortress import threat_intel_socfortress_router
from app.threat_intel.routes.epss import threat_intel_epss_router
from app.threat_intel.routes.socfortress import threat_intel_socfortress_router

# Instantiate the APIRouter
router = APIRouter()
Expand Down
4 changes: 2 additions & 2 deletions backend/app/threat_intel/routes/epss.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
from fastapi import Security
from loguru import logger


from app.auth.utils import AuthHandler
from app.threat_intel.schema.epss import EpssThreatIntelRequest, EpssThreatIntelResponse
from app.threat_intel.schema.epss import EpssThreatIntelRequest
from app.threat_intel.schema.epss import EpssThreatIntelResponse
from app.threat_intel.services.epss import collect_epss_score

# App specific imports
Expand Down
6 changes: 4 additions & 2 deletions backend/app/threat_intel/schema/epss.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
from typing import Optional
from typing import List
from typing import Optional

from pydantic import BaseModel
from pydantic import Field



class EpssThreatIntelRequest(BaseModel):
cve: str = Field(
...,
description="The CVE to evaluate.",
)


class EpssData(BaseModel):
cve: str
epss: str
percentile: str
date: str


class EpssApiResponse(BaseModel):
status: str
status_code: int
Expand All @@ -32,6 +33,7 @@ class EpssApiResponse(BaseModel):
def to_dict(self):
return self.dict()


class EpssThreatIntelResponse(BaseModel):
data: Optional[List[EpssData]] = Field(None, description="The data for the IoC")
success: bool = Field(..., description="Indicates if it was successful")
Expand Down
9 changes: 7 additions & 2 deletions backend/app/threat_intel/services/epss.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
from fastapi import HTTPException
from app.threat_intel.schema.epss import EpssThreatIntelRequest, EpssThreatIntelResponse, EpssData
import httpx
from fastapi import HTTPException
from loguru import logger

from app.threat_intel.schema.epss import EpssData
from app.threat_intel.schema.epss import EpssThreatIntelRequest
from app.threat_intel.schema.epss import EpssThreatIntelResponse


async def invoke_epss_api(
url: str,
request: EpssThreatIntelRequest,
Expand All @@ -28,6 +32,7 @@ async def invoke_epss_api(
response = await client.get(url, headers=headers, params=params)
return response.json()


async def collect_epss_score(
request: EpssThreatIntelRequest,
) -> EpssThreatIntelResponse:
Expand Down
2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,4 @@
"engines": {
"node": ">=18.0.0"
}
}
}

0 comments on commit 5ca6a76

Please sign in to comment.