Skip to content
This repository was archived by the owner on Sep 7, 2026. It is now read-only.

[#212] Fix Vulnerable Regular Expressions - #217

Open
commenthol wants to merge 1 commit into
jprichardson:masterfrom
commenthol:fix-redos
Open

commenthol wants to merge 1 commit into
jprichardson:masterfrom
commenthol:fix-redos

Conversation

@commenthol

Copy link
Copy Markdown

Fixes Issue #212 Vulnerable Regular Expressions

@will-swu

Copy link
Copy Markdown

@jprichardson nudge to look at merging this.

@shuurai shuurai left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The regular expressiong fix has resolved the denial of service vul.

@dwcaraway

Copy link
Copy Markdown

Also looking for this, thanks for the fix!

@az7arul

az7arul commented Dec 7, 2018

Copy link
Copy Markdown
Collaborator

Thanks @commenthol I will try to add this to the next release

@ceastman-ibm

Copy link
Copy Markdown

@az7arul any update on when the next release is?

@onexdata

onexdata commented Mar 1, 2019

Copy link
Copy Markdown

Is this getting merged or did the maintainers all get kidnapped?

@Frozenfire92

Copy link
Copy Markdown

bump

@xueyongg

Copy link
Copy Markdown

Has this fix been merged in?

@feload

feload commented Mar 26, 2020

Copy link
Copy Markdown

When will this change be merged?

@jxmot

jxmot commented Jan 24, 2021

Copy link
Copy Markdown

I'd be happy with a new release even if just this was in it.

@chrisatcloudwalk

Copy link
Copy Markdown

Wtf? Is this gonna be merged any time soon? Is anything left to do?

@Marioalf2002 Marioalf2002 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[#212] Arreglar Expresiones Regulares Vulnerables

@rhyanns

rhyanns commented Oct 17, 2024

Copy link
Copy Markdown

Since the merge was not performed, does anyone have safer alternatives?

@SameOldNick

Copy link
Copy Markdown

As this PR is 8+ years old, this likely isn't getting merged. The following disables the vulnerable methods by injecting into the string prototype so safer alternatives are forced to be used:

Code

/**
 * Attaches warnings to insecure methods of the string library.
 * This is a security measure to prevent the use of insecure methods that could lead to vulnerabilities.
 */
const attachStringWarnings = (): void => {
    const str = S('');

    const proto = Object.getPrototypeOf(str);

    ['underscore', 'unescapeHTML'].forEach((method) => {
        proto[method] = function () {
            console.error(
                `Do not use ${method}() method from string as it is insecure. It has been overridden to log an error instead of executing. (CVE-2017-16116)`,
            );
        };
    });
};

// Add to JS entrypoint
attachStringWarnings();

Example

import S from 'string';

// Console output: Do not use unescapeHTML() method from string as it is insecure. It has been overridden to log an error instead of executing. (CVE-2017-16116)
const unescaped = S('wafwaf').unescapeHTML(); 

// Console output: Unescaped string: undefined
console.log('Unescaped string:', unescaped);

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.