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,subprocesswithshell=True,eval,exec - unsafe deserialization and loaders:
pickle.loads,yaml.load,marshal.loads - hard-coded credentials: AWS, Stripe, GitLab, SendGrid, npm and similar keys
- weakened security: disabled TLS verification, weak hashes (md5/sha1)
The exact rule set is rein's, so it grows with the engine. Lower-severity
findings (lint, style, slop) map to MEDIUM/LOW.
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."
Configure with .rein.toml
The decision rules are data, not a Python class. rein reads a .rein.toml at the
project root for the verdict policy (fail_at, per-category thresholds), rule
disables, and custom regex rules, so a maintainer can declare what is blocked
without changing this analyzer. See the rein docs for the 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.2.0.tar.gz.
File metadata
- Download URL: rein_openhands-0.2.0.tar.gz
- Upload date:
- Size: 9.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1d87c6365fdb09470fbcf95720f6e7639360acddb821630d00edd9c68027d068
|
|
| MD5 |
6c218bc0ab8939ac737bfceda6e93067
|
|
| BLAKE2b-256 |
af96d1ddfa6ac5d2698659175c50da5a20150995153e50b1bce2f43d0e22352c
|
Provenance
The following attestation bundles were made for rein_openhands-0.2.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.2.0.tar.gz -
Subject digest:
1d87c6365fdb09470fbcf95720f6e7639360acddb821630d00edd9c68027d068 - Sigstore transparency entry: 1865509575
- Sigstore integration time:
-
Permalink:
SametAtas/rein-openhands@fa700fc024641929f80dc6ad4e0deb96a9ca3c7b -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/SametAtas
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@fa700fc024641929f80dc6ad4e0deb96a9ca3c7b -
Trigger Event:
release
-
Statement type:
File details
Details for the file rein_openhands-0.2.0-py3-none-any.whl.
File metadata
- Download URL: rein_openhands-0.2.0-py3-none-any.whl
- Upload date:
- Size: 8.4 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 |
f6f53d7b41684bb7eea53f6c9e054c047c792412d7135db90b4315ec92cde22f
|
|
| MD5 |
59bfd357d291fe702b18937cb19cf62b
|
|
| BLAKE2b-256 |
18d53cd608207716a6c3b9b091f199489c9383ac8e041df0f7986975e219a835
|
Provenance
The following attestation bundles were made for rein_openhands-0.2.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.2.0-py3-none-any.whl -
Subject digest:
f6f53d7b41684bb7eea53f6c9e054c047c792412d7135db90b4315ec92cde22f - Sigstore transparency entry: 1865509910
- Sigstore integration time:
-
Permalink:
SametAtas/rein-openhands@fa700fc024641929f80dc6ad4e0deb96a9ca3c7b -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/SametAtas
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@fa700fc024641929f80dc6ad4e0deb96a9ca3c7b -
Trigger Event:
release
-
Statement type: