-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "safeNextPathFrom(): add tests for bad content (#1003)"
This reverts commit 0d2efaa.
- Loading branch information
Showing
1 changed file
with
3 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,45 +27,9 @@ describe('util/html', () => { | |
|
||
describe('safeNextPathFrom()', () => { | ||
[ | ||
// odk-central-frontend | ||
[ '/account/edit', '/#/account/edit' ], // eslint-disable-line no-multi-spaces | ||
[ '/users', '/#/users' ], // eslint-disable-line no-multi-spaces | ||
[ '/users"><badTag ', '/#/users%22%3E%3CbadTag' ], // eslint-disable-line no-multi-spaces | ||
|
||
// query params | ||
[ '/users?"><badTag ', '/#/users?%22%3E%3CbadTag' ], // eslint-disable-line no-multi-spaces | ||
[ '/users?="><badTag ', '/#/users?=%22%3E%3CbadTag' ], // eslint-disable-line no-multi-spaces | ||
[ '/users?a="><badTag ', '/#/users?a=%22%3E%3CbadTag' ], // eslint-disable-line no-multi-spaces | ||
[ '/users?"=><badTag ', '/#/users?%22=%3E%3CbadTag' ], // eslint-disable-line no-multi-spaces | ||
|
||
// fragments | ||
[ '/users#"><badTag ', '/#/users#%22%3E%3CbadTag' ], // eslint-disable-line no-multi-spaces | ||
[ '/users#="><badTag ', '/#/users#=%22%3E%3CbadTag' ], // eslint-disable-line no-multi-spaces | ||
[ '/users#a="><badTag ', '/#/users#a=%22%3E%3CbadTag' ], // eslint-disable-line no-multi-spaces | ||
[ '/users#"=><badTag ', '/#/users#%22=%3E%3CbadTag' ], // eslint-disable-line no-multi-spaces | ||
|
||
// query string & fragment | ||
[ '/users?"=1#"=><badTag ', '/#/users?%22=1#%22=%3E%3CbadTag' ], // eslint-disable-line no-multi-spaces | ||
|
||
// enketo-express | ||
[ '/-/xyz', 'http://localhost:8989/-/xyz' ], // eslint-disable-line no-multi-spaces | ||
[ '/-/xyz?"><b', 'http://localhost:8989/-/xyz?%22%3E%3Cb' ], // eslint-disable-line no-multi-spaces | ||
[ '/-/xyz#"><b', 'http://localhost:8989/-/xyz#%22%3E%3Cb' ], // eslint-disable-line no-multi-spaces | ||
[ '/-/xyz?"><b#"><b', 'http://localhost:8989/-/xyz?%22%3E%3Cb#%22%3E%3Cb' ], // eslint-disable-line no-multi-spaces | ||
|
||
// bad domain | ||
[ 'http://example.com', '/#/' ], // eslint-disable-line no-multi-spaces | ||
// with @ char - not a problem if positioned in fragment or after first `/`: | ||
[ '@baddomain.com', '/#/@baddomain.com' ], // eslint-disable-line no-multi-spaces | ||
[ '/-/@baddomain.com', 'http://localhost:8989/-/@baddomain.com' ], // eslint-disable-line no-multi-spaces | ||
[ '&64;baddomain.com', '/#/&64;baddomain.com' ], // eslint-disable-line no-multi-spaces | ||
[ '/-/&64;baddomain.com', 'http://localhost:8989/-/&64;baddomain.com' ], // eslint-disable-line no-multi-spaces | ||
[ 'http://localhost:[email protected]', '/#/' ], // eslint-disable-line no-multi-spaces | ||
[ 'http://localhost:[email protected]', '/#/' ], // eslint-disable-line no-multi-spaces | ||
|
||
// bad protocols | ||
[ 'https://localhost:8989', '/#/' ], // eslint-disable-line no-multi-spaces | ||
[ 'javascript:badFn()', '/#/' ], // eslint-disable-line no-multi-spaces,no-script-url | ||
[ '/-/xyz', 'http://localhost:8989/-/xyz' ], // eslint-disable-line no-multi-spaces | ||
[ '/account/edit', '/#/account/edit' ], // eslint-disable-line no-multi-spaces | ||
[ '/users', '/#/users' ], // eslint-disable-line no-multi-spaces | ||
].forEach(([next, expected]) => { | ||
it(`should convert next=${next} to ${expected}`, () => { | ||
safeNextPathFrom(next).should.equal(expected); | ||
|