Socket
Socket
Sign inDemoInstall

ldapts

Package Overview
Dependencies
Maintainers
1
Versions
99
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ldapts - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

6

CHANGELOG.md

@@ -0,1 +1,7 @@

### 1.1.1
* Add original string to error message when parsing filters
* Adjust parsing & and | in filters
* Add more filter parsing tests
### 1.1.0

@@ -2,0 +8,0 @@

29

dist/FilterParser.js

@@ -19,2 +19,3 @@ "use strict";

}
// Wrap input in parens if it wasn't already
if (filterString.charAt(0) !== '(') {

@@ -24,6 +25,6 @@ // tslint:disable-next-line:no-parameter-reassignment

}
const parseResult = FilterParser._parseString(filterString, 0);
const parseResult = FilterParser._parseString(filterString, 0, filterString);
const end = filterString.length - 1;
if (parseResult.end < end) {
throw new Error('Unbalanced parens');
throw new Error(`Unbalanced parens in filter string: ${filterString}`);
}

@@ -120,3 +121,3 @@ return parseResult.filter;

}
static _parseString(filterString, start) {
static _parseString(filterString, start, fullString) {
let cursor = start;

@@ -126,3 +127,3 @@ const length = filterString.length;

if (filterString[cursor] !== '(') {
throw new Error(`Missing paren: ${filterString}`);
throw new Error(`Missing paren: ${filterString}. Full string: ${fullString}`);
}

@@ -134,7 +135,7 @@ cursor += 1;

const children = [];
while (cursor < length && filterString[cursor] !== ')') {
const childResult = FilterParser._parseString(filterString, cursor);
do {
const childResult = FilterParser._parseString(filterString, cursor, fullString);
children.push(childResult.filter);
cursor = childResult.end + 1;
}
} while (cursor < length && filterString[cursor] !== ')');
filter = new AndFilter_1.AndFilter({

@@ -148,7 +149,7 @@ filters: children,

const children = [];
while (cursor < length && filterString[cursor] !== ')') {
const childResult = FilterParser._parseString(filterString, cursor);
do {
const childResult = FilterParser._parseString(filterString, cursor, fullString);
children.push(childResult.filter);
cursor = childResult.end + 1;
}
} while (cursor < length && filterString[cursor] !== ')');
filter = new OrFilter_1.OrFilter({

@@ -160,3 +161,3 @@ filters: children,

case '!': {
const childResult = FilterParser._parseString(filterString, cursor + 1);
const childResult = FilterParser._parseString(filterString, cursor + 1, fullString);
filter = new NotFilter_1.NotFilter({

@@ -171,3 +172,3 @@ filter: childResult.filter,

if (end === -1) {
throw new Error(`Unbalanced parens: ${filterString}`);
throw new Error(`Unbalanced parens: ${filterString}. Full string: ${fullString}`);
}

@@ -288,7 +289,7 @@ filter = FilterParser._parseExpressionFilterFromString(filterString.substr(cursor, end - cursor));

case '(':
throw new Error(`Illegal unescaped character: ${char}`);
throw new Error(`Illegal unescaped character: ${char} in value: ${input}`);
case '\\': {
const value = input.substr(index + 1, 2);
if (value.match(/^[a-fA-F0-9]{2}$/) === null) {
throw new Error(`Invalid escaped hex character: ${value}`);
throw new Error(`Invalid escaped hex character: ${value} in value: ${input}`);
}

@@ -295,0 +296,0 @@ result += String.fromCharCode(Number.parseInt(value, 16));

{
"name": "ldapts",
"version": "1.1.0",
"version": "1.1.1",
"description": "LDAP client",

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

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