Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Haye is a simple super fast string expression parser. In support pipe
and qs
string expressions ( explained below ).
Limitations The keys/values inside the expression cannot have any of the reserved keywords, otherwise parser will mis-behave.
haye #pipeToArray x 741,030 ops/sec ±0.97% (90 runs sampled)
haye #pipeToJson x 313,101 ops/sec ±0.95% (87 runs sampled)
haye #qsToArray x 698,688 ops/sec ±0.74% (91 runs sampled)
haye #qsToJson x 303,482 ops/sec ±1.10% (89 runs sampled)
219,138 op/s » haye #pipeToArray #legacy
170,068 op/s » haye #pipeToJson #legacy
147,594 op/s » haye #qsToArray #legacy
121,094 op/s » haye #qsToJson #legacy
747,298 op/s » haye #pipeToArray
363,152 op/s » haye #pipeToJson
742,310 op/s » haye #qsToArray
349,075 op/s » haye #qsToJson
There are couple of breaking changes from 1.0.1 to 2.x.x
Arrays
and Objects
have been removed.
The pipe based expression is very popular in Laravel community, due to their Validation engine, and same is adopted by Indicative.
required|email|max:4|range:10,30
|
:
,
.The query string expression is almost similar to the URL query string, with couple of small modifications to make the expression readable.
required,email,max=4,range=[1, 10]
,
=
,
inside []
.The module is available on npm
npm i haye
# yarn
yarn add haye
Below is the bunch of usage examples
const haye = require('haye')
const expression = 'required|email:unique,users'
const parsed = haye.fromPipe(expression).toArray()
Output
[
{ name: 'required', args: [] },
{ name: 'email', args: ['unique', 'users'] }
]
const haye = require('haye')
const expression = 'required|email:unique,users'
const parsed = haye.fromPipe(expression).toJSON()
Output
{
required: [],
email: [ 'unique', 'users' ]
}
const haye = require('haye')
const expression = 'required,email=[unique,users]'
const parsed = haye.fromQS(expression).toArray()
Output
[
{ name: 'required', args: [] },
{ name: 'email', args: ['unique', 'users'] }
]
const haye = require('haye')
const expression = 'required,email=[unique,users]'
const parsed = haye.fromQS(expression).toJSON()
Output
{
required: [],
email: [ 'unique', 'users' ]
}
FAQs
Haye is a super fast string based expression parser for Node.js
We found that haye demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.