Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

web-security

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

web-security - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

20

index.js

@@ -9,3 +9,3 @@ /**

* @date 13/08/2016
* @version 0.0.3 (beta)
* @version 0.0.4 (beta)
*/

@@ -139,3 +139,3 @@

var searchLocation = location.search;
var unSafeChar = searchLocation.match(/[script]/g);
var unSafeChar = searchLocation.match(/[script|document|cookie]/g);

@@ -151,2 +151,18 @@ ((unSafeChar !== null) ? (unSafeChar.length > 0 ? location.replace("/") : "") : "");

webSecurity.safeUrlWithHash = function(hash)
{
if(typeof window !== 'undefined')
{
var searchLocation = location.search;
var unSafeChar = searchLocation.match(/[script|document|cookie]/g);
((unSafeChar !== null) ? (unSafeChar.length > 0 ? location.replace(hash) : "") : "");
}
else
{
throw "Node Doesn't Support safeUrl";
}
};
webSecurity.unSafeUrl = function()

@@ -153,0 +169,0 @@ {

2

package.json

@@ -91,3 +91,3 @@ {

},
"version": "0.0.3"
"version": "0.0.4"
}

@@ -13,3 +13,3 @@ ## Web-Security

@date: 14/08/2016
@version: 0.0.3 (beta)
@version: 0.0.4 (beta)

@@ -54,2 +54,5 @@ ## Description:

- unSafeUrl() {};
- @param: link after base url eg. /home
unSafeUrl(param) {};

@@ -138,4 +141,4 @@

```js
var url = "http://randomrise.com/?<script> document.cookie </script>";
xs.safeUrl(url);
var browserURL = "http://randomrise.com/?<script> document.cookie </script>";
xs.safeUrl();

@@ -148,6 +151,15 @@ // it will reload/refresh the page without search parameter.

```js
var url = "http://randomrise.com/?<script> document.cookie </script>";
xs.unSafeUrl(url);
var browserURL = "http://randomrise.com/?<script> document.cookie </script>";
xs.unSafeUrl();
// it will reload/refresh the page with search parameter.
```
```
### safeUrlWithHash
```js
var browserURL = "http://randomrise.com/?<script> document.cookie </script>";
xs.unSafeUrl('/home'); // eg. you can keep what ever you want.
// it will reload/refresh the page with /home after the default url.
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc