跳到主要内容

openhands.security.invariant.analyzer

InvariantAnalyzer Objects

class InvariantAnalyzer(SecurityAnalyzer)

Security analyzer based on Invariant.

__init__

def __init__(event_stream: EventStream,
policy: str | None = None,
sid: str | None = None)

Initializes a new instance of the InvariantAnalzyer class.

check_usertask

async def check_usertask()

Looks at the most recent trace element. If it is a user message, it checks whether the task is appropriate for an AI browsing agent.

Ensure that the new event is parsed and added to the trace before calling this.

check_fillaction

async def check_fillaction()

Looks at the most recent trace element. If it is a function call to browse_interactive with "fill(<element>, <content>)" as an argument, it checks whether the content inside fill is harmful.

Ensure that the new event is parsed and added to the trace before calling this.