Personal_AI_Infrastructure icon indicating copy to clipboard operation
Personal_AI_Infrastructure copied to clipboard

`MigrateApprove.ts` resolves feedback-memory paths through a literal, never-interpolated `"${HARNESS_USER_DIR}"`

Open jbmml opened this issue 3 months ago • 2 comments

Summary

LIFEOS/TOOLS/MigrateApprove.ts (~line 89), in the memory/feedback branch:

return join(HOME, ".claude", "projects", "${HARNESS_USER_DIR}", "memory");

The ${...} sits inside an ordinary double-quoted TypeScript string — it is never interpolated, so the branch resolves to a directory literally named ${HARNESS_USER_DIR}. No real slug can ever match; every path this branch produces is wrong, silently. This is a wrong-path/silent-miswrite bug rather than dead code: the branch runs and returns a path that cannot correspond to any real session directory.

Suggested fix

SessionHarvester.ts in the same directory already implements the pattern this branch meant to use: it derives the project slug with CLAUDE_DIR.replace(/[\/\.]/g, "-") and builds join(CLAUDE_DIR, "projects", CWD_SLUG). (HARNESS_USER_DIR exists nowhere as a real symbol or env var — it's only a doc-comment placeholder for that slug.) The fix is to compute the slug the same way and interpolate it, rather than embedding the literal string — likely join(HOME, ".claude", "projects", <cwd-slug>, "memory").

Note: the unguarded join(LIFEOS_DIR, target) in the same function (accepts ../absolute segments) is a potential path-traversal if proposed_target is model-influenced. That one is being routed to the maintainer through GitHub private vulnerability reporting rather than this public issue, per upstream's SECURITY.md.

jbmml avatar Aug 21 '26 12:08 jbmml

This is Shiva, Eugene's AI Assistant, reporting on Eugene's behalf.

Confirmed on this install: LIFEOS/TOOLS/MigrateApprove.ts:89 contains the literal, non-interpolated string "${HARNESS_USER_DIR}" inside a double-quoted TS string — it can never match a real session directory. The suggested fix (deriving the slug the same way SessionHarvester.ts already does, via CLAUDE_DIR.replace(/[\/\.]/g, "-"), and interpolating it) checks out against this file.

waveman2020-sudo avatar Aug 21 '26 20:08 waveman2020-sudo

Landed via your #1935, adapted: the slug is derived from the config root, so it follows CLAUDE_CONFIG_DIR and the principal-specific literal is gone from the shipped file. If you did send a traversal finding through private reporting, I'll pick it up there. Next release. Thanks.

danielmiessler avatar Sep 04 '26 01:09 danielmiessler