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

@synatic/mongo-magic

Package Overview
Dependencies
Maintainers
11
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@synatic/mongo-magic - npm Package Compare versions

Comparing version 1.1.2 to 1.1.3

10

lib/Utils.js

@@ -109,6 +109,7 @@ const ObjectID = require('mongodb').ObjectId;

* @param {object[]} aggregate - the aggregate to get paths for
* @param {boolean} throwErrorOnUnsafe - Specifies if the library should throw an error when the aggregation pipeline is unsafe
* @return {object[]} - the paths nad collection names
* @throws
*/
static cleanAggregate(aggregate) {
static cleanAggregate(aggregate, throwErrorOnUnsafe=true) {
if (!$check.array(aggregate)) {

@@ -128,2 +129,5 @@ throw new Error('Invalid aggregate array');

unsafe = true;
if(throwErrorOnUnsafe){
throw new Error(`Unsafe function "${invalidAggr.name}" in pipeline:\n${JSON.stringify(pipeline, null, 4)}`);
}
break;

@@ -151,3 +155,3 @@ }

for (const invalidAggr of _unsafeAggregateFunctions) {
if (path.indexOf('/' + invalidAggr.name)>-1) {
if (path.endsWith('/'+invalidAggr.name) || path.indexOf('/' + invalidAggr.name+'/') > -1) {
unsafe = path;

@@ -159,3 +163,3 @@ break;

if (unsafe) {
throw new Error(`Unsafe functions at: ${unsafe}`);
throw new Error(`Unsafe functions at path: ${unsafe}\nPipeline:\n${JSON.stringify(newAggr, null, 4)}`);
}

@@ -162,0 +166,0 @@

{
"name": "@synatic/mongo-magic",
"version": "1.1.2",
"version": "1.1.3",
"description": "mongo magic utils",

@@ -61,3 +61,3 @@ "main": "index.js",

"eslint-config-prettier": "^8.5.0",
"mocha": "^9.2.2",
"mocha": "^10.0.0",
"nyc": "^15.1.0",

@@ -64,0 +64,0 @@ "prettier": "^2.5.1"

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