fix(hermes): reject hyphen-prefixed and NUL database paths - #80
Merged
Merged
Conversation
Match OpenClaw's zkr CLI argv hygiene so ZKR_DB cannot be treated as a flag or truncated at a NUL. Amp-Thread-ID: https://ampcode.com/threads/T-01a0a632-daa5-76fa-ae0e-d3fa4d28ede4 Co-authored-by: Max Carter <undivisible@vk.com>
|
Capy couldn't review this pull request because Max's workspace is out of credits, add credits or enable auto-reload to resume automatic reviews. |
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_c49bbec9-23c8-4b9c-8ddf-3465a973099a) |
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.
What
Validate
ZKR_DBthe same way OpenClaw validates--db: reject NUL bytes and paths that start with-.Why
subprocess.run([binary, \"--db\", path, command])would pass a hyphen-prefixed path as a potential flag. Binary names were already allowlisted; the database path was not.Validation
python3 plugins/hermes/test_plugin.py(14 tests OK)Not auto-merged: plugin trust-boundary change.
Note
Medium Risk
Trust-boundary change around how the plugin builds zkr CLI arguments; behavior is stricter but limited to invalid paths that should never have worked safely.
Overview
Hardens the Hermes zkr plugin against unsafe
ZKR_DBvalues before they are passed tosubprocess.run(..., "--db", path, ...).Adds
_validate_db_path, which rejects paths containing NUL bytes or starting with-(so a malicious path cannot be parsed as a CLI flag).ZkrMemoryProvidernow validates the env default at construction time, mirroring OpenClaw’s--dbchecks alongside the existing zkr binary name allowlist.Unit tests cover hyphen-prefixed env paths and embedded NUL in the validator.
Reviewed by Cursor Bugbot for commit 3a560a7. Configure here.