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

CQI-83: added new way of regex working to satisfy security requirements #77

Merged
merged 2 commits into from
Oct 19, 2023

Conversation

sniedzielski
Copy link
Contributor

TICKET: https://openimis.atlassian.net/browse/CQI-83

EXPLANATION: The Sonar issue is raised because the regular expression used in our code can lead to denial of service due to its vulnerability to super-linear runtime caused by backtracking. This is a security concern as it might make your application vulnerable to attacks that exploit this regex's inefficiency.

To fix this issue, we modified the regular expression to make it more efficient and less prone to backtracking. One way to do this is by using a non-capturing group to make the expression more deterministic.

The modified regular expression (?:[^\s@]+@[^\s@]+.[^\s@]+) should work in the same intended way as the previous one, while addressing the security issue. It maintains the same email address validation pattern and functionality while making the regular expression more efficient and less prone to super-linear runtime caused by backtracking.

@sonarcloud
Copy link

sonarcloud bot commented Oct 18, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@dborowiecki dborowiecki merged commit 32c7b70 into develop Oct 19, 2023
3 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.

2 participants