trim-off-newlines@1.0.2 vulnerabilities

Similar to String#trim() but removes only newlines

  • latest version

    1.0.3

  • latest non vulnerable version

  • first published

    9 years ago

  • latest version published

    3 years ago

  • licenses detected

  • Direct Vulnerabilities

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

    How to fix?

    Automatically find and fix vulnerabilities affecting your projects. Snyk scans for vulnerabilities and provides fixes for free.

    Fix for free
    VulnerabilityVulnerable 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