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

Simple regex errors induce a Rails traceback #995

Open
tripleee opened this issue Feb 16, 2024 · 2 comments
Open

Simple regex errors induce a Rails traceback #995

tripleee opened this issue Feb 16, 2024 · 2 comments

Comments

@tripleee
Copy link
Member

For example, forgetting the closing parenthesis in a regex search causes a traceback.

Demo: https://metasmoke.erwaysoftware.com/search?utf8=%E2%9C%93&body_is_regex=1&body=%28oops

@teward
Copy link
Member

teward commented Feb 16, 2024

Isn't this a "Working as intended"? If you don't have proper regex syntax then you should have a failure case. Or are you asking for it to throw a error notice and not a rails crash trace?

@makyen
Copy link
Contributor

makyen commented Feb 16, 2024

I'm unsure what's desired here. What would you like to see happen instead?

These errors are, of course, inconvenient to get, but they do describe what the regex parsing issue was, allowing the user to fix the problem.

While we could implement some parsing in the page, doing so is non-trivial, particularly given that the regex variant that's used by MariaDB doesn't exactly match the regex variation which is used by either Rails or JavaScript, so it's not possible to just dump the provided regex into either of those parsers to see if it will compile.

It would not be unreasonable to implement very simple in-page parsing/validation of the provided regular expressions, effectively at the "do the number and direction of the non-escaped parentheses match".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants