Skip to main content

openhands.security.analyzer

SecurityAnalyzer Objects

class SecurityAnalyzer()

Security analyzer that receives all events and analyzes agent actions for security risks.

__init__

def __init__(event_stream: EventStream)

Initializes a new instance of the SecurityAnalyzer class.

Arguments:

  • event_stream - The event stream to listen for events.

on_event

async def on_event(event: Event) -> None

Handles the incoming event, and when Action is received, analyzes it for security risks.

handle_api_request

async def handle_api_request(request: Request) -> Any

Handles the incoming API request.

log_event

async def log_event(event: Event) -> None

Logs the incoming event.

act

async def act(event: Event) -> None

Performs an action based on the analyzed event.

security_risk

async def security_risk(event: Action) -> ActionSecurityRisk

Evaluates the Action for security risks and returns the risk level.

close

async def close() -> None

Cleanup resources allocated by the SecurityAnalyzer.