Skip to content

GitHub Code Scanning / CodeQL on some regular expression code #1337

Open
@mfranzke

Description

@mfranzke

I am using Pattern Lab Node v5.14.3 on Mac, with Node v12.12, using a Vanilla Edition.

Expected Behavior

The build runs through without a feedback by CodeQL.

Actual Behavior

The build runs through without a feedback by CodeQL.

Steps to Reproduce

CodeQL reports a problem with the following regular expression:

const findPartialsRE = /{{#?>\s*([\w-\/.]+)(?:.|\s+)*?}}/g;

The exact message is:

Inefficient regular expression
This part of the regular expression may cause exponential backtracking on strings starting with '{{{{>.' and containing many repetitions of ' '.

Here's the related check on a current merge request (which changes themselves aren't related to this topic):
https://github.com/pattern-lab/patternlab-node/pull/1335/checks?check_run_id=2908755127

Sadly I'm not a regular expression expert. @geoffp, the previous change with commit 2485996 with a heavy simplification on the previous more complex regular expression has been made you – do you have the chance in supporting by having a look at this reporting ?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions