Security News
Internet Archive Hacked, 31 Million Record Compromised
The Internet Archive's "Wayback Machine" has been hacked and defaced, with 31 millions records compromised.
vuln-regex-detector
Advanced tools
Detect vulnerable regexes by querying a service hosted at Virginia Tech.
In JavaScript, regular expressions (regexes) can be "vulnerable": susceptible to catastrophic backtracking. If your application is used on the client side, this can be a performance issue. On the server side, this can expose you to Regular Expression Denial of Service (REDOS).
This module lets you check a regex for vulnerability.
const vulnRegexDetector = require('vuln-regex-detector');
vulnRegexDetector.test('(a+)+$')
.then((result) => {
if (result === vulnRegexDetector.responses.vulnerable) {
console.log('Regex is vulnerable');
} else if (result === vulnRegexDetector.responses.safe) {
console.log('Regex is safe');
} else {
console.log('Not sure if regex is safe or not');
}
});
The module exports:
test
responses
/**
* @regex: RegExp or string (e.g. /re/ or 're')
* @config: object with fields: hostname port
* default: 'toybox.cs.vt.edu', '8000'
*
* returns a Promise fulfilled with a response or rejected with RESPONSE_INVALID or an error.
*/
vulnRegexDetector.test (regex, config)
If fulfilled, the returned Promise takes on one of the following values:
responses.vulnerable
responses.safe
responses.unknown
If rejected, the returned Promise might be:
responses.invalid
This module queries a server hosted at Virginia Tech. When you use it, your regex will be shipped (via HTTPS) to the server and tested there. If the regex has not been seen before, the server will respond "UNKNOWN" and test it in the background. The server cannot test synchronously because testing is expensive (potentially minutes) and there might be a long line.
By using this module you are consenting to send us your regexes. If your code is not open-source then you can host your own service. See here for details, and provide your config when you call the API.
We may:
The IP address of any client querying our server will be anonymized.
MIT
FAQs
Detect vulnerable regexes by querying a service hosted at Virginia Tech.
The npm package vuln-regex-detector receives a total of 374 weekly downloads. As such, vuln-regex-detector popularity was classified as not popular.
We found that vuln-regex-detector 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
The Internet Archive's "Wayback Machine" has been hacked and defaced, with 31 millions records compromised.
Security News
TC39 is meeting in Tokyo this week and they have approved nearly a dozen proposals to advance to the next stages.
Security News
Our threat research team breaks down two malicious npm packages designed to exploit developer trust, steal your data, and destroy data on your machine.