bug(claude): PreToolUse write gate resolves projects through another OS user's engram serve on 7437 and denies every write (regression of #1120 class)
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 55/100
Research direction
Start with the Go hook subcommand engram hook claude-pre-tool-use and trace how it connects to the server on 127.0.0.1:7437. Reproduce the issue using the provided command while another OS account runs engram serve. Done means the hook does not adopt a server owned by another account: it uses an instance owned by the caller or returns an explicit ownership error.
Written by the indexing model from the issue text.
Description
📝 Bug Description
On a machine with two OS accounts, the Claude Code PreToolUse write gate (engram hook claude-pre-tool-use) sends its project resolution to whichever engram serve answers on 127.0.0.1:7437, even when that server belongs to the other OS account. That server then tries to read the calling user's <repo>/.engram/config.json with its own UID, gets EACCES (the caller's home is mode 0700), and the hook denies every Engram write:
Claude host project resolution failed: project_resolution_failed: invalid .engram/config.json: read <repo>/.engram/config.json: open <repo>/.engram/config.json: permission denied
This looks like the same class as #1120 (closed by #1127, "isolate managed instances by data directory"), reached through a path that fix did not cover: #1127 changed the shell session-start.sh probes, while the failing caller here is the Go hook subcommand claude-pre-tool-use.
Environment
- engram
3.5.4(stable, contains #1127's merge commit8ae5839) - Claude Code plugin
engram@engram0.1.17, Claude Code2.1.310 - Linux x86_64, two local OS accounts; account B runs
engram serveon127.0.0.1:7437; account A (the caller) has noengram serveof its own, onlyengram mcp --tools=agent - Account A's home is
drwx------;.engram/config.jsonis-rw-r--r--owned by account A
Steps to reproduce
- Account B starts
engram serve(default port 7437). - Account A opens Claude Code in a repository that has
.engram/config.json, inside a0700home. - Account A calls
mem_save(any write tool matched by the PreToolUse hook).
Manual reproduction from account A's shell, outside Claude Code:
printf '%s' '{"session_id":"probe","hook_event_name":"PreToolUse","cwd":"'"$PWD"'","tool_name":"mcp__engram__mem_save","tool_input":{"title":"probe"}}' \
| engram hook claude-pre-tool-use
Expected
The hook either uses a server owned by the calling account (or starts/finds its own instance, as #1127 does for SessionStart), or fails with an explicit ownership error that names the mismatch.
Actual
permissionDecision: "deny" with the permission denied reason above, on every write (mem_save, mem_session_summary, ...). Reads through MCP stdio keep working (mem_current_project resolves the project from config), so only writes fail.
Evidence
strace -e trace=openaton the hook: the hook process never opensconfig.jsonitself.strace -e trace=connecton the hook: one connection to127.0.0.1:7437.- The only
engram serveon the machine runs as account B. - The calling account can read the file (
catsucceeds); only the other account cannot. - Repeated twice within the session with the same result; no state was changed to work around it.
Security note
Because the hook adopts a server owned by another OS account, hook traffic from account A (project resolution, and potentially session and write-gate data) is handled by account B's process. Here it failed closed only because A's home is 0700; with a readable home the cross-account routing would be silent, which is the class of issue #1120 described. Loopback is a process boundary, not a user boundary (#200), so the adapter needs to verify server ownership before adopting it.
- Dominant language
- Go
- Stars
- 7.1k
- Forks
- 729
- Avg merge
- 9h 34m
- Merged PRs (30d)
- 335
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Gentleman-Programming/engram
-
status:needs-review type:bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Gentleman-Programming/engram#2138 ·
Maintainers usually reply within 1 day
-
status:needs-review type:bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Gentleman-Programming/engram#2137 ·
Maintainers usually reply within 1 day
-
status:needs-review
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Gentleman-Programming/engram#2065 ·
Maintainers usually reply within 1 day
-
priority:medium status:needs-review type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
Gentleman-Programming/engram#863 · 1 comment ·
Maintainers usually reply within 1 day
-
status:needs-review type:bug
Difficulty 4/5 3-5 days Newbie friendliness 48/100
Gentleman-Programming/engram#2152 ·
Maintainers usually reply within 1 day
All issues in Gentleman-Programming/engram
Similar issues
-
documentation ready
Difficulty 1/5 Under an hour Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
Needs Triage
Difficulty 1/5 Under an hour Newbie friendliness 90/100
-
bug good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
solongate/agent-security#154 ·
Maintainers usually reply within 1 day
-
tree: RootStyle is applied twice to the root nodePossibly taken @PhotoDotPi claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
charmbracelet/lipgloss#772 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 76/100
Maintainers usually reply within 1 day