2025-09-15 09:57:03 -04:00

38 lines
1.2 KiB
Python

from typing import Any
from fastapi import Request
from openhands.events.action.action import Action, ActionSecurityRisk
class SecurityAnalyzer:
"""Security analyzer that analyzes agent actions for security risks."""
def __init__(self) -> None:
"""Initializes a new instance of the SecurityAnalyzer class."""
pass
async def handle_api_request(self, request: Request) -> Any:
"""Handles the incoming API request."""
raise NotImplementedError(
'Need to implement handle_api_request method in SecurityAnalyzer subclass'
)
async def security_risk(self, action: Action) -> ActionSecurityRisk:
"""Evaluates the Action for security risks and returns the risk level."""
raise NotImplementedError(
'Need to implement security_risk method in SecurityAnalyzer subclass'
)
def set_event_stream(self, event_stream) -> None:
"""Set the event stream for accessing conversation history.
Args:
event_stream: EventStream instance for accessing events
"""
pass
async def close(self) -> None:
"""Cleanup resources allocated by the SecurityAnalyzer."""
pass