Skip to content

docs: add HOL Guard security analyzer example - #4600

Open
kantorcodes wants to merge 3 commits into
OpenHands:mainfrom
kantorcodes:docs/hol-guard-security-analyzer-example
Open

docs: add HOL Guard security analyzer example#4600
kantorcodes wants to merge 3 commits into
OpenHands:mainfrom
kantorcodes:docs/hol-guard-security-analyzer-example

Conversation

@kantorcodes

@kantorcodes kantorcodes commented Aug 23, 2026

Copy link
Copy Markdown

HUMAN:


AGENT:

Why

OpenHands issue #4593 is marked ready-for-dev and requests a concrete example of using HOL Guard through the existing SecurityAnalyzerBase extension point without introducing HOL-specific core SDK behavior.

Summary

  • add 43_hol_guard_security_analyzer.py, a standalone example that invokes hol-guard command test <command> --json for terminal-command classification
  • map only explicit HOL Guard benign classifications to SecurityRisk.LOW; review, block, unknown, unsupported, CLI-error, and malformed-output paths fail closed to SecurityRisk.HIGH
  • reuse OpenHands ConfirmRisky and reject_pending_actions, and exclude the interactive example from automated example execution like the existing security-analyzer example

Issue Number

Fixes #4593

How to Test

  1. Install the current HOL Guard alpha CLI: pipx install --pip-args='--pre' hol-guard.
  2. Install the OpenHands SDK repository development dependencies as documented in DEVELOPMENT.md and set LLM_API_KEY (plus optional LLM_MODEL / LLM_BASE_URL).
  3. Run python examples/01_standalone_sdk/43_hol_guard_security_analyzer.py.
  4. The pwd action should proceed without a confirmation when HOL Guard classifies it explicitly benign. The bounded rm -rf /tmp/openhands-hol-guard-demo action should be flagged for OpenHands confirmation; rejecting it should call reject_pending_actions and prevent execution.

Automated preparation validation before push: both changed Python files were syntax-compiled successfully, and the committed example was read back from the fork branch after creation. Repository CI remains the authoritative project-level validation.

Type

  • Bug fix
  • Feature
  • Refactor
  • Breaking change
  • Docs / chore

Notes

This adapter intentionally uses HOL Guard's side-effect-free command classification surface. It does not claim that command test is final Guard policy evaluation. OpenHands remains the execution gate for flagged actions. AI assistance was used to prepare this contribution.

@all-hands-bot

Copy link
Copy Markdown
Collaborator

👋 This PR needs a couple of things fixed before OpenHands can review it:

  • the PR description's HUMAN: section needs at least 20 characters describing what you tested, not just the template placeholder

Push an update once this is addressed and this check re-runs automatically.

This is an automated check - no AI was used to generate this comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Example proposal: HOL Guard via SecurityAnalyzerBase

2 participants