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

Return Of The Regex #170

Closed
wants to merge 1 commit into from
Closed

Return Of The Regex #170

wants to merge 1 commit into from

Conversation

ysf
Copy link
Contributor

@ysf ysf commented May 15, 2020

Fixing regex match if packagename is inside a word.

Changed regexes to a whitelist approach
Closes: #131
@ysf ysf changed the title #161 - Return Of The Regex Return Of The Regex May 15, 2020
@svenstaro svenstaro requested a review from anthraxx August 7, 2020 22:37
Copy link
Member

@anthraxx anthraxx left a comment

Choose a reason for hiding this comment

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

This approach introduces a regression on word boundary ends inside logical elements like a link:

package = CVEGroupPackage()
package.pkgname = "sdl2"
advisory_extend_html("yay\nfoo\nhttps://discourse.libsdl.org/t/vulnerabilities-found-in-libsdl-1-2-15-and-sdl2\n", [], package)
Out[27]: 'https://discourse.libsdl.org/t/vulnerabilities-found-in-libsdl-1-2-15-and-<a href="/package/sdl2" rel="noopener">sdl2</a>\n'

additional this doesn't work for packages with nothing on the left side:

package = CVEGroupPackage()
package.pkgname = "cargo-audit"
advisory_extend_html("cargo-audit is affected\n", [], package)
Out[15]: 'cargo-audit is affected\n'

Can you add some unit test for this function with some use cases that should be covered?

This pull request was closed.
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.

Anywhere package name appears becomes a link
4 participants