Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix code scanning alert - Polynomial regular expression used on uncontrolled data #28

Open
1 task
Godsmith opened this issue Nov 25, 2024 · 0 comments
Open
1 task

Comments

@Godsmith
Copy link
Contributor

Godsmith commented Nov 25, 2024

Tracking issue for:

I think this and similar security issues can be solved by using the fact that endwhile always occurs first on a line, optionally prepended by spaces, and therefore we could add "^ *" at start of the pattern. This ensures that it will only be run once per line.

I think something like the following armchair code should work:

 endwhile_text = re.sub(
        r"^( *)endwhile \([^()]*?\)",
        f"\1endwhile ({breakstatement})",
        endwhile_text,
        flags=re.DOTALL,
    )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant