feat: add MaybeDontAnalyzer security analyzer#2142
Open
robotdan wants to merge 1 commit intoOpenHands:mainfrom
Open
feat: add MaybeDontAnalyzer security analyzer#2142robotdan wants to merge 1 commit intoOpenHands:mainfrom
robotdan wants to merge 1 commit intoOpenHands:mainfrom
Conversation
Implements a SecurityAnalyzerBase that validates agent actions against policy rules configured in a Maybe Don't Gateway instance. Calls the gateway's POST /api/v1/action/validate endpoint and maps the response risk_level directly to SecurityRisk. - MaybeDontAnalyzer class following GraySwan patterns - 41 tests covering init, request building, risk mapping, error handling, HTTP lifecycle, and end-to-end security_risk flow - Example script (40_maybedont_security_analyzer.py) - Exported from openhands.sdk.security module Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
MaybeDontAnalyzer, a newSecurityAnalyzerBaseimplementation that validates agent actions against policy rules configured in a Maybe Don't Gateway instance.POST /api/v1/action/validateendpoint before action executionActionEventfields (tool_name,tool_call.arguments,thought,summary) to the gateway's request formatrisk_levelresponse directly toSecurityRisk(HIGH/MEDIUM/LOW/UNKNOWN)UNKNOWNmodel_post_initenv var resolution,set_events/closelifecycleHow it fits with existing integrations
MaybeDont doc for OpenHands
Configuration
Files
openhands-sdk/openhands/sdk/security/maybedont/analyzer.pyMaybeDontAnalyzerclassopenhands-sdk/openhands/sdk/security/maybedont/__init__.pyopenhands-sdk/openhands/sdk/security/__init__.py__all__tests/sdk/security/maybedont/test_maybedont_analyzer.pyexamples/01_standalone_sdk/40_maybedont_security_analyzer.pyTest plan
uv run pytest tests/sdk/security/maybedont/ -v— 41 tests passuv run pytest tests/sdk/security/ -v— 119 tests pass (no regressions)make format && make lint— cleanrm -rf→ HIGH, safe commands → LOW)🤖 Generated with Claude Code