Skip to main content

Deterministic, no-LLM SecurityAnalyzer for OpenHands, backed by the rein engine.

Project description

rein-openhands

A deterministic, no-LLM SecurityAnalyzer for OpenHands, backed by the rein engine.

OpenHands' built-in LLMSecurityAnalyzer asks the model to grade its own actions. This grades them with rein instead. Before an action runs, rein reviews the code or command it would write for leaked secrets, unsafe code, and slop, and returns a SecurityRisk that feeds OpenHands' ConfirmRisky policy. No model in the loop, so the same action gets the same verdict every time.

Install

pip install rein-openhands

It pulls in rein-engine and openhands-sdk.

Use

from rein_openhands import ReinSecurityAnalyzer

agent = Agent(llm=llm, tools=tools, security_analyzer=ReinSecurityAnalyzer())

Or set it on an existing conversation:

conversation.set_security_analyzer(ReinSecurityAnalyzer())

That is all. See the OpenHands docs for agent and confirmation-policy setup.

What it flags

rein judges the content of the action. It returns HIGH for, among others:

  • unsafe code execution: os.system, subprocess with shell=True, eval, exec
  • unsafe deserialization and loaders: pickle.loads, yaml.load, marshal.loads
  • unverified TLS context: ssl._create_unverified_context
  • hard-coded credentials: AWS, Stripe, GitLab, SendGrid, npm and similar keys

Some weaker risks map to MEDIUM, for example weak hashes (md5/sha1) and requests(..., verify=False). Lint, style, and slop map to MEDIUM/LOW. The exact rule set is rein's, so it grows with the engine.

Fail closed on unparseable code

If a .py action cannot be parsed, rein's AST-based security checks cannot run, so the code is unanalyzed rather than safe. In that case the analyzer returns HIGH instead of letting the result downgrade to the syntax error's own level. "Cannot analyze this code" must not read as "this code is safe." The rule is scoped to .py, so a non-Python command or a text file is left to its normal verdict.

Use alongside other analyzers

This is the code-content layer. It does not authorize actions or inspect shell command patterns. Run it together with OpenHands' action and shell-pattern checks for defense in depth; rein answers "is the code being written dangerous," the others answer "is this action allowed to run."

Policy as data (roadmap)

The rein engine already externalizes its decision rules as data: a .rein.toml declares the verdict policy (fail_at, per-category thresholds), rule disables, and custom regex rules, so a maintainer can declare what is blocked without writing code. This analyzer does not yet read that config (it maps rein's finding severities to SecurityRisk directly); honoring a repo's .rein.toml here so the policy governs the verdict is the next planned step. See the rein docs for the config format.

License

Apache-2.0. See LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rein_openhands-0.2.1.tar.gz (10.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rein_openhands-0.2.1-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

Details for the file rein_openhands-0.2.1.tar.gz.

File metadata

  • Download URL: rein_openhands-0.2.1.tar.gz
  • Upload date:
  • Size: 10.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for rein_openhands-0.2.1.tar.gz
Algorithm Hash digest
SHA256 f791e92ed466caa8f4c170af3fe894a4e96740fea7ee43a52403c00bbdaf9999
MD5 311a27ed330fbb8d9413bd45d3d33ace
BLAKE2b-256 755700a44bc843ebc13ec4bb9f273b8277e056603df2322103ccfd3d55c38618

See more details on using hashes here.

Provenance

The following attestation bundles were made for rein_openhands-0.2.1.tar.gz:

Publisher: publish.yml on SametAtas/rein-openhands

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rein_openhands-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: rein_openhands-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 8.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for rein_openhands-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 491d0f9d0e8c38cc1493ea7033cc6540bb9f2b01787038eaa997885b468fe482
MD5 70e602ce64c03357e7691ff7110dabbc
BLAKE2b-256 e196f35b07776ba9b213d3bed51296c62d62b3dd9ae086336f9189179622e966

See more details on using hashes here.

Provenance

The following attestation bundles were made for rein_openhands-0.2.1-py3-none-any.whl:

Publisher: publish.yml on SametAtas/rein-openhands

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page