Commit d247683
committed
fix(teams): harden graph URL routing per review — fail-closed parse, keep colon paths
Address PR review feedback on the SSRF routing fix:
- Gemini (robustness): wrap urlparse in try/except and fail closed (treat an
unparseable URL, e.g. a bad IPv6 literal, as absolute so the allowlist rejects
it) instead of letting urlparse raise out of the function.
- Codex (P2, colon paths): keep routing on `scheme or netloc`. A bare `root:/…`
segment never joined via urljoin anyway (urljoin sees scheme `root` and returns
it unchanged), so rejecting it is the safe behavior — routing it to the relative
branch would attach the Graph token to a malformed `root:` URL. Realistic Graph
colon paths put the colon AFTER a slash (`me/drive/root:/x:/content`), parse with
no scheme, and still join onto the trusted base — added a test proving it.
Tests: +malformed-URL-fails-closed, +colon-after-slash-relative-path-joins (19 total).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 3dd16f5 commit d247683
2 files changed
Lines changed: 37 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
262 | 262 | | |
263 | 263 | | |
264 | 264 | | |
265 | | - | |
266 | | - | |
267 | | - | |
268 | | - | |
269 | | - | |
270 | | - | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
271 | 276 | | |
272 | 277 | | |
273 | 278 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
326 | 326 | | |
327 | 327 | | |
328 | 328 | | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
329 | 355 | | |
330 | 356 | | |
331 | 357 | | |
| |||
0 commit comments