Skip to content

fix: resolve symlink bypass in write deny list on macOS#61

Merged
teknium1 merged 1 commit into
NousResearch:mainfrom
0xbyt4:fix/write-deny-macos-symlink
Feb 27, 2026
Merged

fix: resolve symlink bypass in write deny list on macOS#61
teknium1 merged 1 commit into
NousResearch:mainfrom
0xbyt4:fix/write-deny-macos-symlink

Conversation

@0xbyt4

@0xbyt4 0xbyt4 commented Feb 26, 2026

Copy link
Copy Markdown
Contributor

Summary

  • _is_write_denied() was bypassed on macOS for all /etc/* paths
  • On macOS, /etc is a symlink to /private/etc. The function resolved the input path with os.path.realpath() but deny list entries were stored as literal strings (/etc/shadow), so the resolved path /private/etc/shadow never matched.
  • Fix: Apply os.path.realpath() to deny list entries at module load time so both sides use resolved paths

Affected paths (were unprotected on macOS)

  • /etc/shadow, /etc/passwd, /etc/sudoers
  • /etc/sudoers.d/*, /etc/systemd/*

Test plan

  • 19 regression tests in tests/tools/test_write_deny.py — all passing on macOS
  • Verified fix with inline Python check for all 7 affected paths

On macOS, /etc is a symlink to /private/etc. The _is_write_denied()
function resolves the input path with os.path.realpath() but the deny
list entries were stored as literal strings ("/etc/shadow"). This meant
the resolved path "/private/etc/shadow" never matched, allowing writes
to sensitive system files on macOS.

Fix: Apply os.path.realpath() to deny list entries at module load time
so both sides of the comparison use resolved paths.

Adds 19 regression tests in tests/tools/test_write_deny.py.
0xbyt4 added a commit to 0xbyt4/hermes-agent that referenced this pull request Feb 26, 2026
These tests documented the macOS symlink bypass bug with
platform-conditional assertions. The fix and proper regression
tests are in PR NousResearch#61 (tests/tools/test_write_deny.py), so remove
them here to avoid ordering conflicts between the two PRs.
@teknium1 teknium1 merged commit 0909be3 into NousResearch:main Feb 27, 2026
sudo-yf pushed a commit to sudo-yf/hermes-agent that referenced this pull request Apr 5, 2026
Adds a server-side boolean setting (default: false) that controls whether
CLI sessions from state.db appear in the sidebar. Off by default so the
sidebar is clean until the user explicitly opts in.

- api/config.py: add show_cli_sessions to _SETTINGS_DEFAULTS and _SETTINGS_BOOL_KEYS
- api/routes.py: gate get_cli_sessions() call on the setting at request time
- static/index.html: checkbox in settings panel with description
- static/panels.js: load/save checkbox, refresh session list on save
- static/boot.js: load on startup alongside send_key and show_token_usage

Co-authored-by: Nathan Esquenazi <nesquena@gmail.com>
sudo-yf pushed a commit to sudo-yf/hermes-agent that referenced this pull request Apr 5, 2026
CHANGELOG: add v0.30.1 entry covering PRs NousResearch#57-NousResearch#61 (CLI session bridge
fixes: sidebar rendering, profile-aware state.db path, silent SQL error,
show/hide toggle in Settings.

README: add CLI session bridge, token/cost display, subagent cards,
/usage command, skills linked files, show CLI sessions toggle.

Version label: v0.30 -> v0.30.1 in index.html, SPRINTS, CHANGELOG footer.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
EOF
)
angelburgosrosado pushed a commit to angelburgosrosado/hermes-agent that referenced this pull request Apr 27, 2026
These tests documented the macOS symlink bypass bug with
platform-conditional assertions. The fix and proper regression
tests are in PR NousResearch#61 (tests/tools/test_write_deny.py), so remove
them here to avoid ordering conflicts between the two PRs.
angelburgosrosado pushed a commit to angelburgosrosado/hermes-agent that referenced this pull request Apr 27, 2026
…ymlink

fix: resolve symlink bypass in write deny list on macOS
olympus-terminal pushed a commit to olympus-terminal/hermes-agent that referenced this pull request May 16, 2026
These tests documented the macOS symlink bypass bug with
platform-conditional assertions. The fix and proper regression
tests are in PR NousResearch#61 (tests/tools/test_write_deny.py), so remove
them here to avoid ordering conflicts between the two PRs.
olympus-terminal pushed a commit to olympus-terminal/hermes-agent that referenced this pull request May 16, 2026
…ymlink

fix: resolve symlink bypass in write deny list on macOS
Egavasyug pushed a commit to Egavasyug/hermes-agent that referenced this pull request Jun 10, 2026
These tests documented the macOS symlink bypass bug with
platform-conditional assertions. The fix and proper regression
tests are in PR NousResearch#61 (tests/tools/test_write_deny.py), so remove
them here to avoid ordering conflicts between the two PRs.
Egavasyug pushed a commit to Egavasyug/hermes-agent that referenced this pull request Jun 10, 2026
…ymlink

fix: resolve symlink bypass in write deny list on macOS
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