Commit 8727bcf
committed
fix: guard workspace rename to owner only, validate SELF_DIR JSON safety
Address greptile P1/P2 review findings:
1. **Non-owner sessions unconditionally reset workspace name (greptile P1)**
cmux-session-namer.sh called `cmux rename-workspace` on every SessionStart
regardless of ownership. If Session A (owner) already had a good AI-generated
workspace name, Session B starting in the same workspace would flash the name
back to its project basename.
Fix: guard the `rename-workspace` call with `[ "$WS_OWNER" = "$CMUX_SURFACE_ID" ]`
so only the owning session sets the initial workspace name.
2. **$SELF_DIR injected into JSON without escaping (greptile P2)**
The claude wrapper interpolates $SELF_DIR directly into a JSON string literal.
A path containing '"' or '\' would produce malformed JSON and silently disable
all hooks.
Fix: validate $SELF_DIR before building HOOKS_JSON. If the path contains
JSON-unsafe characters, emit a clear warning to stderr and fall through to
exec the real claude without hooks (safe degradation vs. silent failure).1 parent a80edd0 commit 8727bcf
2 files changed
Lines changed: 18 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
86 | 95 | | |
87 | 96 | | |
88 | 97 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
64 | 68 | | |
0 commit comments