File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed
openhands-sdk/openhands/sdk/agent Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -308,8 +308,16 @@ def _requires_user_confirmation(
308308 return False
309309
310310 def _extract_security_risk (
311- self , arguments : dict , tool_name : str
311+ self ,
312+ arguments : dict ,
313+ tool_name : str ,
314+ readOnlyHint : bool ,
312315 ) -> risk .SecurityRisk :
316+ # Default risk value for action event
317+ # Tool is marked as read-only so security risk can be ignored
318+ if readOnlyHint :
319+ return risk .SecurityRisk .UNKNOWN
320+
313321 requires_sr = isinstance (self .security_analyzer , LLMSecurityAnalyzer )
314322 raw = arguments .pop ("security_risk" , None )
315323
@@ -380,7 +388,11 @@ def _get_action_event(
380388
381389 # Fix malformed arguments (e.g., JSON strings for list/dict fields)
382390 arguments = fix_malformed_tool_arguments (arguments , tool .action_type )
383- security_risk = self ._extract_security_risk (arguments , tool .name )
391+ security_risk = self ._extract_security_risk (
392+ arguments ,
393+ tool .name ,
394+ tool .annotations .readOnlyHint if tool .annotations else False ,
395+ )
384396 assert "security_risk" not in arguments , (
385397 "Unexpected 'security_risk' key found in tool arguments"
386398 )
You can’t perform that action at this time.
0 commit comments