Commit 99cd36c
committed
fix: preserve branch in factory URLs with query params (CHE-23666)
CRITICAL BUG FIX: Factory params were incorrectly sent to backend
Problem:
1. Branch information was lost when factory parameters were present in URL
2. Factory params (che-editor, policies.create, etc.) were being sent to
backend factory resolver, but they should NOT be - they are frontend-only
Solution:
- Created sanitizeUrlForFactoryResolver() to extract ONLY backend-relevant params:
* Override params (override.*) for devfile overrides
* Branch params (revision, version) for version control
* Factory params are removed but NOT sent to backend
- Created getRepoFromLocation() for trusted source URL comparisons
- Security fix: Strict allowlist for Azure DevOps domain validation
Backend now receives:
✅ Clean URL with branch in path
✅ Override params (override.*)
✅ Branch params (revision, version)
❌ NO factory params (che-editor, policies.create, etc.)
Technical details:
- Factory params (che-editor, storageType, policies.create, etc.) are frontend-only
- They configure dashboard behavior, not backend processing
- Backend receives clean URLs like 'https://github.com/user/repo/tree/branch'
instead of 'https://github.com/user/repo/tree/branch?che-editor=...'
- Azure DevOps: version param kept in URL for branch detection + extracted
- SSH URLs: only revision and override.* params extracted
Tests:
- 2,280 tests pass (100%)
- 96 new/updated tests for URL sanitization and parameter handling
- All Git providers tested (GitHub, GitLab, Bitbucket, Azure DevOps, SSH)
Resolves: eclipse-che/che#23666
Signed-off-by: Oleksii Orel <oorel@redhat.com>1 parent c6810b3 commit 99cd36c
File tree
15 files changed
+1687
-271
lines changed- packages/dashboard-frontend/src
- components/UntrustedSourceModal
- pages/GetStarted/SamplesList
- __tests__
- services
- backend-client
- __tests__
- helpers/factoryFlow
- __tests__
- registry
- __tests__
- store/Workspaces/Preferences
- __tests__
15 files changed
+1687
-271
lines changedLines changed: 7 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| |||
110 | 111 | | |
111 | 112 | | |
112 | 113 | | |
113 | | - | |
114 | | - | |
| 114 | + | |
| 115 | + | |
115 | 116 | | |
116 | 117 | | |
117 | 118 | | |
| |||
163 | 164 | | |
164 | 165 | | |
165 | 166 | | |
166 | | - | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
167 | 171 | | |
168 | 172 | | |
169 | 173 | | |
| |||
Lines changed: 0 additions & 90 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
239 | 239 | | |
240 | 240 | | |
241 | 241 | | |
242 | | - | |
243 | | - | |
244 | | - | |
245 | | - | |
246 | | - | |
247 | | - | |
248 | | - | |
249 | | - | |
250 | | - | |
251 | | - | |
252 | | - | |
253 | | - | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | | - | |
263 | | - | |
264 | | - | |
265 | | - | |
266 | | - | |
267 | | - | |
268 | | - | |
269 | | - | |
270 | | - | |
271 | | - | |
272 | | - | |
273 | | - | |
274 | | - | |
275 | | - | |
276 | | - | |
277 | | - | |
278 | | - | |
279 | | - | |
280 | | - | |
281 | | - | |
282 | | - | |
283 | | - | |
284 | | - | |
285 | | - | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | | - | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | | - | |
297 | | - | |
298 | | - | |
299 | | - | |
300 | | - | |
301 | | - | |
302 | | - | |
303 | | - | |
304 | | - | |
305 | | - | |
306 | | - | |
307 | | - | |
308 | | - | |
309 | | - | |
310 | | - | |
311 | | - | |
312 | | - | |
313 | | - | |
314 | | - | |
315 | | - | |
316 | | - | |
317 | | - | |
318 | | - | |
319 | | - | |
320 | | - | |
321 | | - | |
322 | | - | |
323 | | - | |
324 | | - | |
325 | | - | |
326 | | - | |
327 | | - | |
328 | | - | |
329 | | - | |
330 | | - | |
331 | | - | |
332 | 242 | | |
333 | 243 | | |
334 | 244 | | |
| |||
Lines changed: 2 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
29 | 28 | | |
30 | 29 | | |
31 | 30 | | |
| |||
98 | 97 | | |
99 | 98 | | |
100 | 99 | | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
| 100 | + | |
113 | 101 | | |
114 | | - | |
| 102 | + | |
115 | 103 | | |
116 | 104 | | |
117 | 105 | | |
| |||
Lines changed: 43 additions & 29 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| 68 | + | |
68 | 69 | | |
69 | | - | |
| 70 | + | |
| 71 | + | |
70 | 72 | | |
71 | 73 | | |
72 | 74 | | |
73 | 75 | | |
74 | | - | |
| 76 | + | |
75 | 77 | | |
76 | 78 | | |
77 | 79 | | |
| |||
81 | 83 | | |
82 | 84 | | |
83 | 85 | | |
84 | | - | |
| 86 | + | |
| 87 | + | |
85 | 88 | | |
86 | | - | |
| 89 | + | |
| 90 | + | |
87 | 91 | | |
88 | 92 | | |
89 | 93 | | |
90 | 94 | | |
91 | | - | |
| 95 | + | |
92 | 96 | | |
93 | 97 | | |
94 | 98 | | |
| |||
98 | 102 | | |
99 | 103 | | |
100 | 104 | | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
101 | 108 | | |
102 | | - | |
| 109 | + | |
103 | 110 | | |
| 111 | + | |
104 | 112 | | |
105 | 113 | | |
106 | 114 | | |
107 | 115 | | |
108 | 116 | | |
109 | 117 | | |
110 | | - | |
| 118 | + | |
111 | 119 | | |
112 | 120 | | |
113 | 121 | | |
| |||
118 | 126 | | |
119 | 127 | | |
120 | 128 | | |
121 | | - | |
| 129 | + | |
122 | 130 | | |
123 | 131 | | |
124 | 132 | | |
125 | 133 | | |
126 | 134 | | |
127 | 135 | | |
128 | 136 | | |
129 | | - | |
| 137 | + | |
130 | 138 | | |
131 | 139 | | |
132 | 140 | | |
| |||
136 | 144 | | |
137 | 145 | | |
138 | 146 | | |
139 | | - | |
| 147 | + | |
| 148 | + | |
140 | 149 | | |
141 | 150 | | |
142 | 151 | | |
143 | | - | |
144 | | - | |
145 | 152 | | |
146 | 153 | | |
147 | 154 | | |
148 | 155 | | |
149 | | - | |
| 156 | + | |
150 | 157 | | |
151 | 158 | | |
152 | 159 | | |
| |||
156 | 163 | | |
157 | 164 | | |
158 | 165 | | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
159 | 169 | | |
160 | 170 | | |
161 | 171 | | |
162 | 172 | | |
163 | 173 | | |
164 | | - | |
165 | 174 | | |
166 | 175 | | |
167 | 176 | | |
| |||
179 | 188 | | |
180 | 189 | | |
181 | 190 | | |
182 | | - | |
| 191 | + | |
183 | 192 | | |
184 | 193 | | |
185 | 194 | | |
186 | 195 | | |
187 | 196 | | |
188 | 197 | | |
| 198 | + | |
189 | 199 | | |
190 | 200 | | |
191 | 201 | | |
192 | 202 | | |
193 | 203 | | |
194 | 204 | | |
195 | 205 | | |
196 | | - | |
| 206 | + | |
197 | 207 | | |
198 | 208 | | |
199 | 209 | | |
| |||
204 | 214 | | |
205 | 215 | | |
206 | 216 | | |
207 | | - | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
208 | 220 | | |
209 | 221 | | |
210 | | - | |
211 | | - | |
212 | | - | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
213 | 225 | | |
214 | 226 | | |
215 | 227 | | |
216 | 228 | | |
217 | | - | |
| 229 | + | |
218 | 230 | | |
219 | 231 | | |
220 | 232 | | |
| |||
224 | 236 | | |
225 | 237 | | |
226 | 238 | | |
227 | | - | |
| 239 | + | |
| 240 | + | |
228 | 241 | | |
229 | 242 | | |
230 | 243 | | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | 244 | | |
235 | 245 | | |
236 | 246 | | |
237 | 247 | | |
238 | | - | |
| 248 | + | |
239 | 249 | | |
240 | 250 | | |
241 | 251 | | |
242 | 252 | | |
243 | | - | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
244 | 257 | | |
| 258 | + | |
245 | 259 | | |
246 | 260 | | |
247 | | - | |
248 | | - | |
| 261 | + | |
| 262 | + | |
249 | 263 | | |
250 | 264 | | |
251 | 265 | | |
| |||
0 commit comments