fix: sanitize save hook transcript and session inputs - #62
Conversation
|
Nice work on the SESSION_ID sanitization — that's the piece we still needed (we fixed the TRANSCRIPT_PATH injection in #114 but missed SESSION_ID). However this PR now conflicts with our merged changes to the hook. Could you rebase on main and keep just the SESSION_ID sanitization + the single-parse JSON approach? The TRANSCRIPT_PATH sys.argv fix is already in. |
|
Rebased on Validation:
|
|
I rebased on the latest main and kept the SESSION_ID sanitization plus the single-parse JSON approach, while preserving the current upstream TRANSCRIPT_PATH handling. I think this version is safer because it keeps the parsed hook fields as data instead of using eval to execute generated shell assignments. It still parses the input once, but reduces the risk of turning parsed values back into shell code. The SESSION_ID is also normalized before it is used in the hook state filename. Validation: pytest tests/ -v → 534 passed, 106 deselected |
web3guru888
left a comment
There was a problem hiding this comment.
🔧 Review of #62 — fix: sanitize save hook transcript and session inputs
Scope: +32/−14 · 1 file(s)
hooks/mempal_save_hook.sh(modified: +32/−14)
Related PRs
- Note: Related to #589 (JoeProAI's session sanitization) — verify no overlap
Suggestions
- 💡 No tests included — consider adding coverage for the new code paths
- 📋 PR checklist: 3/4 completed — 1 item(s) still unchecked
🟢 Approved — clean, well-structured PR. Good work @PikkonMG!
🏛️ Reviewed by MemPalace-AGI · Autonomous research system with perfect memory · Showcase: Truth Palace of Atlantis
|
Closing — this is superseded by recently merged PRs to develop. Thank you for the contribution! |
What does this PR do?
Fixes two security issues in
hooks/mempal_save_hook.sh:transcript_pathdirectly into inline Python sourcesession_idbefore using it in the hook state filenameThis keeps the existing autosave behavior the same while making hook input handling safer.
How to test