Commit 8a50740
committed
fix(resolve-file-uri): remove project boundary check for prompt file:// URIs
Remove the `isWithinProject` boundary restriction from `resolvePromptAppend()`
so that `file://` prompt URIs behave as documented — supporting absolute,
home-relative (`~/`), and project-relative paths — instead of being silently
rejected with a warning placeholder.
Since commit 9865978 ("fix(security): confine file resolution to project
roots"), `resolvePromptAppend()` called `isWithinProject(filePath, configDir ??
process.cwd())` and rejected any path outside the current working directory or
config directory. This contradicts the configuration reference which explicitly
lists absolute, relative, and home-relative forms as supported. Users following
the documented examples receive a silent `[WARNING: Path rejected: ...]`
placeholder instead of their intended prompt content.
The boundary check was originally added for security, but `prompt` and
`prompt_append` are user-configured fields — the user is deliberately pointing
to a file they want loaded into the agent prompt. The check prevents legitimate
cross-project prompt sharing, a use case the documentation describes as a
primary motivation for `file://` support.
Fixes the root cause behind #3554.
Changes:
- resolve-file-uri.ts: remove `isWithinProject` import, `log` import, and the
boundary check block (projectRoot declaration + if-statement + log + return).
- resolve-file-uri.test.ts: remove 3 rejection tests that enforced the boundary;
add a test verifying absolute paths load regardless of configDir; update the
home-directory test to expect success; remove the now-unused symlink fixture.
Test: resolve-file-uri 8 pass / 0 fail, sisyphus-junior 47 pass / 0 fail.
Typecheck: clean.1 parent 0c39358 commit 8a50740
2 files changed
Lines changed: 17 additions & 105 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
29 | 28 | | |
30 | 29 | | |
31 | 30 | | |
| |||
38 | 37 | | |
39 | 38 | | |
40 | 39 | | |
41 | | - | |
42 | 40 | | |
43 | 41 | | |
44 | 42 | | |
| |||
50 | 48 | | |
51 | 49 | | |
52 | 50 | | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
| 51 | + | |
61 | 52 | | |
62 | 53 | | |
63 | 54 | | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
69 | 58 | | |
70 | | - | |
71 | | - | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
72 | 62 | | |
73 | 63 | | |
74 | 64 | | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
| 65 | + | |
| 66 | + | |
83 | 67 | | |
84 | 68 | | |
85 | 69 | | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
| 70 | + | |
| 71 | + | |
94 | 72 | | |
95 | 73 | | |
96 | 74 | | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
| 75 | + | |
| 76 | + | |
105 | 77 | | |
106 | 78 | | |
107 | 79 | | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
| 80 | + | |
| 81 | + | |
116 | 82 | | |
117 | 83 | | |
118 | 84 | | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
| 85 | + | |
| 86 | + | |
163 | 87 | | |
164 | 88 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
6 | 4 | | |
7 | 5 | | |
8 | 6 | | |
| |||
20 | 18 | | |
21 | 19 | | |
22 | 20 | | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | 21 | | |
34 | 22 | | |
35 | 23 | | |
| |||
0 commit comments