Skip to content

fix(hermes): reject hyphen-prefixed and NUL database paths - #80

Merged
undivisible merged 1 commit into
mainfrom
fix/hermes-db-path-validation
Sep 16, 2026
Merged

undivisible merged 1 commit into
mainfrom
fix/hermes-db-path-validation

Conversation

@undivisible

@undivisible undivisible commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

What

Validate ZKR_DB the 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_DB values before they are passed to subprocess.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). ZkrMemoryProvider now validates the env default at construction time, mirroring OpenClaw’s --db checks 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.

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-ai

capy-ai Bot commented Sep 15, 2026

Copy link
Copy Markdown

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.

Open in Capy

@cursor

cursor Bot commented Sep 15, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot 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)

@undivisible
undivisible merged commit 8428f77 into main Sep 16, 2026
7 checks passed
@undivisible
undivisible deleted the fix/hermes-db-path-validation branch September 16, 2026 02:04
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.

2 participants