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
Security analyzers are configured on the conversation, with a confirmation policy:
from openhands.sdk import Conversation
from openhands.sdk.security import ConfirmRisky, SecurityRisk
from rein_openhands import ReinSecurityAnalyzer
conversation = Conversation(agent=agent, workspace=".")
conversation.set_security_analyzer(ReinSecurityAnalyzer())
conversation.set_confirmation_policy(ConfirmRisky(threshold=SecurityRisk.HIGH))
That is all. See the OpenHands docs for agent and conversation setup.
What it flags
rein judges the content of the action. It returns HIGH for, among others:
- unsafe code execution:
os.system,subprocesswithshell=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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rein_openhands-0.3.0.tar.gz.
File metadata
- Download URL: rein_openhands-0.3.0.tar.gz
- Upload date:
- Size: 10.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ac65cd3443aec23901e3b6e006a63e01d988e6cf6c7a12e7d5e88744c695f61d
|
|
| MD5 |
e5a192c394dc0ab3914bc7ccac9be671
|
|
| BLAKE2b-256 |
e63b77e094945cd50c3b3551b7c7783935564552c26ba5721dbb3e0cdb713aa1
|
Provenance
The following attestation bundles were made for rein_openhands-0.3.0.tar.gz:
Publisher:
publish.yml on SametAtas/rein-openhands
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rein_openhands-0.3.0.tar.gz -
Subject digest:
ac65cd3443aec23901e3b6e006a63e01d988e6cf6c7a12e7d5e88744c695f61d - Sigstore transparency entry: 1911085326
- Sigstore integration time:
-
Permalink:
SametAtas/rein-openhands@e6ef0a59f94ad93523124e89ed96b3c4ccb1dbf1 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/SametAtas
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e6ef0a59f94ad93523124e89ed96b3c4ccb1dbf1 -
Trigger Event:
release
-
Statement type:
File details
Details for the file rein_openhands-0.3.0-py3-none-any.whl.
File metadata
- Download URL: rein_openhands-0.3.0-py3-none-any.whl
- Upload date:
- Size: 8.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
01250938a17ea68fe3481d5a46cb2881eeb7ccc3db6086d19ae9b5b29e604848
|
|
| MD5 |
0b892b28df5efe2bcd1d983351fb2037
|
|
| BLAKE2b-256 |
2c945b98291f686d921cff9eedabae0c41e53cd82aff17b4f75f0de9a638a9a4
|
Provenance
The following attestation bundles were made for rein_openhands-0.3.0-py3-none-any.whl:
Publisher:
publish.yml on SametAtas/rein-openhands
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rein_openhands-0.3.0-py3-none-any.whl -
Subject digest:
01250938a17ea68fe3481d5a46cb2881eeb7ccc3db6086d19ae9b5b29e604848 - Sigstore transparency entry: 1911085520
- Sigstore integration time:
-
Permalink:
SametAtas/rein-openhands@e6ef0a59f94ad93523124e89ed96b3c4ccb1dbf1 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/SametAtas
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e6ef0a59f94ad93523124e89ed96b3c4ccb1dbf1 -
Trigger Event:
release
-
Statement type: