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

cylc lint S007: fix regex catastrophic backtracking #6078

Merged
merged 1 commit into from
Apr 22, 2024

Conversation

MetRonnie
Copy link
Member

@MetRonnie MetRonnie commented Apr 22, 2024

Closes #6075

Pertains to rule: S007 (family names should not contain lowercase chars)

Fixes ReDoS-like bug (possibly exponential scaling with length of input line).

Check List

  • I have read CONTRIBUTING.md and added my name as a Code Contributor.
  • Contains logically grouped changes (else tidy your branch by rebase).
  • Does not contain off-topic changes (use other PRs for other changes).
  • No dependency changes
  • Tests are included
  • CHANGES.md entry included if this is a change that can affect users
  • No docs change needed
  • If this is a bug fix, PR should be raised against the relevant ?.?.x branch.

@MetRonnie MetRonnie added bug Something is wrong :( small labels Apr 22, 2024
@MetRonnie MetRonnie added this to the 8.2.6 milestone Apr 22, 2024
@MetRonnie MetRonnie requested a review from wxtim April 22, 2024 17:59
@MetRonnie MetRonnie self-assigned this Apr 22, 2024
@MetRonnie
Copy link
Member Author

CC @ColemanTom

Comment on lines -245 to -246
param(item, id=str(ind))
for ind, item in enumerate([
Copy link
Member Author

Choose a reason for hiding this comment

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

Just using the index was making it kind of hard to tell which test cases were failing

Copy link
Member

@wxtim wxtim left a comment

Choose a reason for hiding this comment

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

  • Looks sensible
  • Appears to work: I did a bit of profiling and it's fairly easy to replicate this bug on 8.2 seconds, but even when I went mad and thew inherit = ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEQWERTYUIOPASDFGHJKZXCVBNM, WERTYUIOMNBVCDFTYUK, MNBVCF, POESOINDCN, SJOAIJOIKJNAK, X<fppp>, On at the new branch it seemed to take approx 0.3 seconds.

@wxtim wxtim merged commit 950f66c into cylc:8.2.x Apr 22, 2024
21 of 23 checks passed
@ColemanTom
Copy link
Contributor

Thanks for the quick fix!

@MetRonnie MetRonnie deleted the cylc-lint branch April 23, 2024 09:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is wrong :( small
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cylc lint - S007 issues with long inheritance lines which do have lowercase characters
3 participants