Socket
Socket
Sign inDemoInstall

snyk-policy

Package Overview
Dependencies
Maintainers
1
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

snyk-policy - npm Package Compare versions

Comparing version 1.0.2 to 1.1.0

.nyc_output/3107.json

21

lib/index.js

@@ -9,4 +9,6 @@ var yaml = require('js-yaml');

var tryRequire = require('snyk-try-require');
var filter = require('./filter');
module.exports = {
filter: filter,
demunge: parse.demunge,

@@ -25,2 +27,12 @@ load: load,

function attachMethods(policy) {
var root = path.dirname(policy.__filename);
policy.filter = function (vulns) {
return filter(vulns, policy, root);
};
policy.save = save.bind(null, policy);
policy.demunge = parse.demunge.bind(null, policy);
return policy;
}
function loadFromText(text) {

@@ -36,3 +48,3 @@ return new Promise(function (resolve) {

resolve(policy);
});
}).then(attachMethods);
}

@@ -77,3 +89,3 @@

return policy;
}).catch(function (error) {
}).then(attachMethods).catch(function (error) {
if (options.loose && error.code === 'ENOENT') {

@@ -163,2 +175,7 @@ return parse({});

}
// strip helper functions
if (typeof object[key] === 'function') {
delete object[key];
}
});

@@ -165,0 +182,0 @@ return yaml.safeDump(object);

17

lib/match.js

@@ -90,8 +90,17 @@ module.exports = {

if (target.name === fromPkg.name && semver.valid(fromPkg.version) &&
semver.satisfies(fromPkg.version, pkgVersion)) {
debugPolicy('semver match');
return true;
// shortcut version match, if it's exact, then skip the semver check
if (target.name === fromPkg.name) {
if (fromPkg.version === pkgVersion) {
debugPolicy('exact version match');
return true;
}
if (semver.valid(fromPkg.version) &&
semver.satisfies(fromPkg.version, pkgVersion)) {
debugPolicy('semver match');
return true;
}
}
debugPolicy('failed match');

@@ -98,0 +107,0 @@

@@ -33,2 +33,3 @@ {

"snyk-module": "^1.6.0",
"snyk-resolve": "^1.0.0",
"snyk-try-require": "^1.1.1",

@@ -41,3 +42,3 @@ "then-fs": "^2.0.0"

},
"version": "1.0.2"
"version": "1.1.0"
}

Sorry, the diff of this file is not supported yet

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