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

@lifeomic/abac

Package Overview
Dependencies
Maintainers
2
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lifeomic/abac - npm Package Compare versions

Comparing version 4.0.2 to 4.1.0

.github/workflows/basic-code-scanning.yml

37

dist/index.js

@@ -391,3 +391,23 @@ 'use strict';

/**
* Synchronously determines if a given attribute path is in the list of rules
* Return true iff left is a path prefix of right
*/
const isPathPrefix = (left, right) => {
const lhs = left.split('.');
const rhs = right.split('.');
if (lhs.length > rhs.length) {
return false;
}
for (let i = 0; i < lhs.length; ++i) {
if (lhs[i] !== rhs[i]) {
return false;
}
}
return true;
};
/**
* Synchronously determines if a given attribute path is used in the rules
* for a given policy. This may be useful for determining if additional metadata

@@ -402,3 +422,16 @@ * should be fetched before enforcing a policy.

const rules = (0, _values2.default)(policy.rules).filter(rule => Array.isArray(rule)).reduce((left, right) => left.concat(right), []);
return rules.some(rule => rule.hasOwnProperty(attribute));
for (const rule of rules) {
for (const key in rule) {
if (isPathPrefix(attribute, key)) {
return true;
} else {
const target = rule[key].target;
if (target && isPathPrefix(attribute, target)) {
return true;
}
}
}
}
return false;
};

@@ -405,0 +438,0 @@

@@ -534,3 +534,23 @@ 'use strict';

/**
* Synchronously determines if a given attribute path is in the list of rules
* Return true iff left is a path prefix of right
*/
var isPathPrefix = function isPathPrefix(left, right) {
var lhs = left.split('.');
var rhs = right.split('.');
if (lhs.length > rhs.length) {
return false;
}
for (var i = 0; i < lhs.length; ++i) {
if (lhs[i] !== rhs[i]) {
return false;
}
}
return true;
};
/**
* Synchronously determines if a given attribute path is used in the rules
* for a given policy. This may be useful for determining if additional metadata

@@ -549,5 +569,38 @@ * should be fetched before enforcing a policy.

}, []);
return rules.some(function (rule) {
return rule.hasOwnProperty(attribute);
});
var _iteratorNormalCompletion7 = true;
var _didIteratorError7 = false;
var _iteratorError7 = undefined;
try {
for (var _iterator7 = _getIterator(rules), _step7; !(_iteratorNormalCompletion7 = (_step7 = _iterator7.next()).done); _iteratorNormalCompletion7 = true) {
var rule = _step7.value;
for (var key in rule) {
if (isPathPrefix(attribute, key)) {
return true;
} else {
var target = rule[key].target;
if (target && isPathPrefix(attribute, target)) {
return true;
}
}
}
}
} catch (err) {
_didIteratorError7 = true;
_iteratorError7 = err;
} finally {
try {
if (!_iteratorNormalCompletion7 && _iterator7.return) {
_iterator7.return();
}
} finally {
if (_didIteratorError7) {
throw _iteratorError7;
}
}
}
return false;
};

@@ -554,0 +607,0 @@

@@ -367,3 +367,23 @@ 'use strict';

/**
* Synchronously determines if a given attribute path is in the list of rules
* Return true iff left is a path prefix of right
*/
const isPathPrefix = (left, right) => {
const lhs = left.split('.');
const rhs = right.split('.');
if (lhs.length > rhs.length) {
return false;
}
for (let i = 0; i < lhs.length; ++i) {
if (lhs[i] !== rhs[i]) {
return false;
}
}
return true;
};
/**
* Synchronously determines if a given attribute path is used in the rules
* for a given policy. This may be useful for determining if additional metadata

@@ -378,3 +398,16 @@ * should be fetched before enforcing a policy.

const rules = _Object$values(policy.rules).filter(rule => Array.isArray(rule)).reduce((left, right) => left.concat(right), []);
return rules.some(rule => rule.hasOwnProperty(attribute));
for (const rule of rules) {
for (const key in rule) {
if (isPathPrefix(attribute, key)) {
return true;
} else {
const target = rule[key].target;
if (target && isPathPrefix(attribute, target)) {
return true;
}
}
}
}
return false;
};

@@ -381,0 +414,0 @@

2

package.json
{
"name": "@lifeomic/abac",
"version": "4.0.2",
"version": "4.1.0",
"description": "Lifeomic Attribute Based Access Control Support Module",

@@ -5,0 +5,0 @@ "main": "./dist/index.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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