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

EnsureHtmlIsXml column cleaner regexp mistakenly matches too much #5012

Merged
merged 3 commits into from
Nov 3, 2023

Conversation

ugras-ergun-sonarsource
Copy link
Contributor

Fixes #4605

@ugras-ergun-sonarsource ugras-ergun-sonarsource changed the title Ue/fix regex EnsureHtmlIsXml column cleaner regexp mistakenly matches too much Nov 3, 2023
@ugras-ergun-sonarsource ugras-ergun-sonarsource marked this pull request as ready for review November 3, 2023 13:48
@@ -30,11 +30,11 @@ internal static class HtmlXmlCompatibilityHelper
// the empty elements and replace them with elements with closing tags
// e.g. <br> => <br/>
// e.g. <col span="123"> => <col span="123"/>
private static readonly Regex CleanCol = new Regex("(?<element>(<col\\s*)|(col\\s+[^/^>]*))>",
private static readonly Regex CleanCol = new Regex("(?<element>(<\\s*col\\s*)|(<\\s*col\\s+[^/^>]*))>",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the \\s* needed here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would work in case of something like < col>. I would say it would work for now without it but I can't think of any scenario that this would be harmful.

Copy link

sonarqubecloud bot commented Nov 3, 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

100.0% 100.0% Coverage
0.0% 0.0% Duplication

@ugras-ergun-sonarsource ugras-ergun-sonarsource merged commit f92be6a into feature/hardening-202311 Nov 3, 2023
10 checks passed
@ugras-ergun-sonarsource ugras-ergun-sonarsource deleted the ue/fix-regex branch November 3, 2023 14:05
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.

EnsureHtmlIsXml column cleaner regexp mistakenly matches too much
2 participants