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 RegEx queries in PostgreSQL Repository #8489

Merged
merged 2 commits into from
Nov 13, 2024

Conversation

mandy-chessell
Copy link
Contributor

Description

This PR fixes the search mechanism in the PostgreSQL Repository connector to remove the "\Q...\E" delimitors used to ensure any string from an outside caller can not be executed as a RegEx as part of a query. The delimitors cause the RegEx engine to ignore the text between.

The reason for removing these delimiters is that they are not truely part of the RegEx spec (they come from Purl) and PostgreSQL does not support them. When they are removed, the searches find what is expected.

The reason for using these delimitors is to prevent a denial of service attack that uses bad RegEx to cause big workloads on the database. In order to compensate for removing this protectuon. each RegEx is tested, and if it takes too long to execute, the easrch request is rejected with a RepositoryErrorException.

Related Issue(s)

None

Testing

Testing using a variety of queries

Release Notes & Documentation

None - this is a bug fix

Additional notes

None

@mandy-chessell mandy-chessell merged commit 227dba4 into odpi:main Nov 13, 2024
4 checks passed
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

Successfully merging this pull request may close these issues.

1 participant