fix(app): safeNextPath resolves next= against a sentinel origin (closes the /\host and tab/newline open redirect); tests; contract amended
This commit is contained in:
1 parent
aeea1f2e9b
commit
1aed64b4ef
3 files changed
+29
-9
No files matched your search
@@ -59,6 +59,14 @@ describe('safeNextPath', () => {
|
||||
expect(safeNextPath('//evil.test')).toBe('/app')
|
||||
expect(safeNextPath('app')).toBe('/app')
|
||||
})
|
||||
|
||||
it('refuses the backslash and control-character escapes the URL parser accepts', () => {
|
||||
expect(safeNextPath('/\\evil.test')).toBe('/app')
|
||||
expect(safeNextPath('/\t/evil.test')).toBe('/app')
|
||||
expect(safeNextPath('/\n/evil.test/x')).toBe('/app')
|
||||
expect(safeNextPath('/ /evil.test')).toBe('/%20/evil.test')
|
||||
expect(safeNextPath('/app/account?tab=x#s')).toBe('/app/account?tab=x#s')
|
||||
})
|
||||
})
|
||||
|
||||
describe('account validation', () => {
|
||||
|
||||
Reference in new issue
Block a user