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 link patterns extra matching against internal hashes #501

Merged
merged 3 commits into from Apr 11, 2023

Conversation

Crozzers
Copy link
Contributor

This PR fixes #287 by preventing any link pattern regular expressions from matching against internal hashes.

It does this by checking the overlap between any link pattern match and the positions of the hashes in the text.
If a link pattern matches against text inside the start-end positions of an internal hash, it is ignored.

@nicholasserra
Copy link
Collaborator

What's the side effect here, does a block of text we'd normally be hashing get skipped? Haven't dove into this yet, apologies.

@Crozzers
Copy link
Contributor Author

In theory, no. A match is only rejected when it starts or ends within an internal hash, so unless the user is exploiting the internal hashing mechanism and intentionally matching the hashes, it shouldn't break anything.

Just in case, I could add some arguments for the link patterns extra so that users can turn this behaviour off

@nicholasserra
Copy link
Collaborator

Guess i'm just confused how people are reporting collisions in the first place. I honestly haven't spent much time looking at it yet, so I should dive in before I keep asking questions lol

Thank you

@nicholasserra
Copy link
Collaborator

Awesome

@nicholasserra nicholasserra merged commit bce3f18 into trentm:master Apr 11, 2023
18 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.

Link Pattern Regex for finding hashes produces odd output
2 participants