Commit 84af5fb
committed
fix(auth): close encoded-backslash open-redirect + tidy callback findings
Address the latest Copilot review on PR #39:
- sanitizeRelativePath: reject a backslash in the decoded path. A
percent-encoded backslash ("/%5cevil.com") survived the literal "/\\"
prefix check, and user agents that normalize "\" to "/" would read the
decoded "//evil.com" as a protocol-relative redirect.
- Callback: return 400 (not 502) on nonce mismatch — a client/session
issue or attack, not an upstream failure, mirroring the state path.
- Fix the package comment: the flow now carries four flow cookies
(state/verifier/nonce/returnUrl), not three.
- Pin the bypass with percent-encoded backslash test cases.
Claude-Session: https://claude.ai/code/session_01M4Dd5oASBGHwr6ts6wTnYn1 parent ebbd794 commit 84af5fb
2 files changed
Lines changed: 14 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| |||
162 | 162 | | |
163 | 163 | | |
164 | 164 | | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
165 | 172 | | |
166 | 173 | | |
167 | 174 | | |
| |||
293 | 300 | | |
294 | 301 | | |
295 | 302 | | |
296 | | - | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
297 | 306 | | |
298 | 307 | | |
299 | 308 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
26 | 29 | | |
27 | 30 | | |
28 | 31 | | |
| |||
0 commit comments