-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
145 additions
and
0 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
16 changes: 16 additions & 0 deletions
16
api/api-facade/api-tests/src/main/resources/utils/v4/url/decode.js
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* | ||
* Copyright (c) 2010-2019 SAP and others. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contributors: | ||
* SAP - initial API and implementation | ||
*/ | ||
var url = require('utils/v4/url'); | ||
|
||
var input = '%3C%21%5BCDATA%5B%3Cmeta+http-equiv%3D%22refresh%22+content%3D%220%3Burl%3Djavascript%3Adocument.vulnerable%3Dtrue%3B%22%3E%5D%5D%3E'; | ||
var result = url.decode(input, 'UTF-8'); | ||
|
||
result == '<![CDATA[<meta http-equiv="refresh" content="0;url=javascript:document.vulnerable=true;">]]>' |
16 changes: 16 additions & 0 deletions
16
api/api-facade/api-tests/src/main/resources/utils/v4/url/encode.js
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* | ||
* Copyright (c) 2010-2019 SAP and others. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contributors: | ||
* SAP - initial API and implementation | ||
*/ | ||
var url = require('utils/v4/url'); | ||
|
||
var input = '<![CDATA[<meta http-equiv="refresh" content="0;url=javascript:document.vulnerable=true;">]]>'; | ||
var result = url.encode(input, 'UTF-8'); | ||
|
||
result == '%3C%21%5BCDATA%5B%3Cmeta+http-equiv%3D%22refresh%22+content%3D%220%3Burl%3Djavascript%3Adocument.vulnerable%3Dtrue%3B%22%3E%5D%5D%3E'; |
16 changes: 16 additions & 0 deletions
16
api/api-facade/api-tests/src/main/resources/utils/v4/url/escape.js
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* | ||
* Copyright (c) 2010-2019 SAP and others. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contributors: | ||
* SAP - initial API and implementation | ||
*/ | ||
var url = require('utils/v4/url'); | ||
|
||
var input = 'http://www.test.com?var1=abc123&var2=123 456&var3=стойност'; | ||
var result = url.escape(input); | ||
console.log(result); | ||
result == 'http://www.test.com?var1=abc123&var2=123%20456&var3=%D1%81%D1%82%D0%BE%D0%B9%D0%BD%D0%BE%D1%81%D1%82'; |
16 changes: 16 additions & 0 deletions
16
api/api-facade/api-tests/src/main/resources/utils/v4/url/escapeForm.js
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* | ||
* Copyright (c) 2010-2019 SAP and others. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contributors: | ||
* SAP - initial API and implementation | ||
*/ | ||
var url = require('utils/v4/url'); | ||
|
||
var input = 'http://www.test.com?var1=abc123&var2=123 456&var3=стойност'; | ||
var result = url.escapeForm(input); | ||
console.log(result); | ||
result == 'http%3A%2F%2Fwww.test.com%3Fvar1%3Dabc123%26var2%3D123+456%26var3%3D%D1%81%D1%82%D0%BE%D0%B9%D0%BD%D0%BE%D1%81%D1%82'; |
16 changes: 16 additions & 0 deletions
16
api/api-facade/api-tests/src/main/resources/utils/v4/url/escapePath.js
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* | ||
* Copyright (c) 2010-2019 SAP and others. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contributors: | ||
* SAP - initial API and implementation | ||
*/ | ||
var url = require('utils/v4/url'); | ||
|
||
var input = 'http://www.test.com?var1=abc123&var2=123 456&var3=стойност'; | ||
var result = url.escapePath(input); | ||
console.log(result); | ||
result == 'http:%2F%2Fwww.test.com%3Fvar1=abc123&var2=123%20456&var3=%D1%81%D1%82%D0%BE%D0%B9%D0%BD%D0%BE%D1%81%D1%82'; |
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
35 changes: 35 additions & 0 deletions
35
api/api-javascript/api-utils/src/main/resources/utils/v4/url.js
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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Copyright (c) 2010-2019 SAP and others. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contributors: | ||
* SAP - initial API and implementation | ||
*/ | ||
|
||
exports.encode = function(input, charset) { | ||
var output = org.eclipse.dirigible.api.v3.utils.UrlFacade.encode(input, charset); | ||
return output; | ||
}; | ||
|
||
exports.decode = function(input, charset) { | ||
var output = org.eclipse.dirigible.api.v3.utils.UrlFacade.decode(input, charset); | ||
return output; | ||
}; | ||
|
||
exports.escape = function(input) { | ||
var output = org.eclipse.dirigible.api.v3.utils.UrlFacade.escape(input); | ||
return output; | ||
}; | ||
|
||
exports.escapePath = function(input) { | ||
var output = org.eclipse.dirigible.api.v3.utils.UrlFacade.escapePath(input); | ||
return output; | ||
}; | ||
|
||
exports.escapeForm = function(input) { | ||
var output = org.eclipse.dirigible.api.v3.utils.UrlFacade.escapeForm(input); | ||
return output; | ||
}; |