New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

hapiest-mysql

Package Overview
Dependencies
Maintainers
1
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hapiest-mysql - npm Package Compare versions

Comparing version 0.0.19 to 0.0.20

2

lib/mysqlDaoQueryHelper.js

@@ -94,3 +94,3 @@ 'use strict';

let cleanValue = null;
if (_.includes(['current_timestamp','now()'],_.toLower(uncleanValue))) {
if (_.includes(['current_timestamp','now()','is null', 'is not null'],_.toLower(uncleanValue))) {
cleanValue = uncleanValue;

@@ -97,0 +97,0 @@ } else {

{
"name": "hapiest-mysql",
"version": "0.0.19",
"version": "0.0.20",
"description": "A wrapper around mysql that provides a very descriptive way of running queries.",

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

@@ -470,2 +470,14 @@ 'use strict';

nowClean.should.eql("'NOW()'");
const isNullUnclean = "IS NULL";
const isNullClean = userDao.clean(isNullUnclean);
Should.exist(isNullClean);
isNullClean.should.eql("'IS NULL'");
const isNotNullUnclean = "IS NOT NULL";
const isNotNullClean = userDao.clean(isNotNullUnclean);
Should.exist(isNotNullClean);
isNotNullClean.should.eql("'IS NOT NULL'");
});

@@ -495,2 +507,14 @@ });

nowClean.should.eql("NOW()");
const isNullUnclean = "IS NULL";
const isNullClean = userDao.cleanSpecial(isNullUnclean);
Should.exist(isNullClean);
isNullClean.should.eql("IS NULL");
const isNotNullUnclean = "IS NOT NULL";
const isNotNullClean = userDao.cleanSpecial(isNotNullUnclean);
Should.exist(isNotNullClean);
isNotNullClean.should.eql("IS NOT NULL");
});

@@ -497,0 +521,0 @@ });

@@ -176,2 +176,14 @@ 'use strict';

nowClean.should.eql("'NOW()'");
const isNullUnclean = "IS NULL";
const isNullClean = mysqlDaoQueryHelper.clean(isNullUnclean);
Should.exist(isNullClean);
isNullClean.should.eql("'IS NULL'");
const isNotNullUnclean = "IS NOT NULL";
const isNotNullClean = mysqlDaoQueryHelper.clean(isNotNullUnclean);
Should.exist(isNotNullClean);
isNotNullClean.should.eql("'IS NOT NULL'");
});

@@ -201,2 +213,14 @@ });

nowClean.should.eql("NOW()");
const isNullUnclean = "IS NULL";
const isNullClean = mysqlDaoQueryHelper.cleanSpecial(isNullUnclean);
Should.exist(isNullClean);
isNullClean.should.eql("IS NULL");
const isNotNullUnclean = "IS NOT NULL";
const isNotNullClean = mysqlDaoQueryHelper.cleanSpecial(isNotNullUnclean);
Should.exist(isNotNullClean);
isNotNullClean.should.eql("IS NOT NULL");
});

@@ -267,7 +291,9 @@ });

it('Allows special value CURRENT_TIMESTAMP and does not escape with quotes', function() {
it('Allows special values (CURRENT_TIMESTAMP, NOW(), IS NULL, IS NOT NULL) and does not escape with quotes', function() {
const output = mysqlDaoQueryHelper._cleanAndMapValues({
firstName: 'firstName',
dateCreated: 'CURRENT_TIMESTAMP',
dateAgain: 'NOW()'
dateAgain: 'NOW()',
someNullField: 'IS NULL',
nonNullField: 'IS NOT NULL'
});

@@ -279,9 +305,13 @@ Should.exist(output);

output.date_again.should.eql("NOW()");
output.some_null_field.should.eql("IS NULL");
output.non_null_field.should.eql("IS NOT NULL");
});
it('Escapes special value CURRENT_TIMESTAMP when explicitly asked', function() {
it('Escapes special values (CURRENT_TIMESTAMP, NOW(), IS NULL, IS NOT NULL) when explicitly asked', function() {
const output = mysqlDaoQueryHelper._cleanAndMapValues({
firstName: 'firstName',
dateCreated: 'CURRENT_TIMESTAMP',
dateAgain: 'NOW()'
dateAgain: 'NOW()',
someNullField: 'IS NULL',
nonNullField: 'IS NOT NULL'
}, {dontCleanMysqlFunctions: false});

@@ -293,2 +323,4 @@ Should.exist(output);

output.date_again.should.eql("'NOW()'");
output.some_null_field.should.eql("'IS NULL'");
output.non_null_field.should.eql("'IS NOT NULL'");
});

@@ -295,0 +327,0 @@

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