Commit a489e7d
fix: don't crash the server on URI paths with invalid percent-encoding
Scanner requests like /chat/..%c0%af..%c0%afetc/passwd or
/chat/WEB-INF/web.xml%C0%80.jsp killed prod pods: SvelteKit calls the
handle hook even when the pathname fails to decode (it only produces the
400 Malformed URI error inside resolve()), so the OAuth login branch ran
first and its thrown redirect() ended up as an unhandled promise
rejection, which terminates the Node process.
Two changes:
- handle hook rejects paths with invalid percent-encoding with a plain
400 before any auth/OAuth logic
- triggerOauthFlow returns a real 302 Response instead of throwing a
Redirect, so it can never surface as an unhandled rejection
Co-authored-by: Cursor <cursoragent@cursor.com>1 parent f4ed195 commit a489e7d
2 files changed
Lines changed: 16 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
580 | 580 | | |
581 | 581 | | |
582 | 582 | | |
583 | | - | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
584 | 588 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
62 | 72 | | |
63 | 73 | | |
64 | 74 | | |
| |||
0 commit comments