Skip to content

Conversation

@Nydauron
Copy link
Member

Description

Reworks /ping to be more intuitive

  • Re-adds regex support with re2 being used as the backend
    • At a high level, re2 follows the basic regex principles (i.e. ability to represent the regex as a DFA/NFA) and does not support the more complex features (ironically making it no longer a subset of regex according to Language and Grammar Theory), which cause backtracking.
    • Database migration was needed to allow for categorization of pings to either be normal or re2-based.
  • Uses Components v2 for /ping list
  • /ping remove autocompletes with available pings
  • /ping remove can be removed by index as displayed by /ping list
  • Uses Components v2 for /ping remove if no other param is specified

Checks

  • I ran black over the code to ensure formatting.
  • I added docstrings to any new modules, classes, and methods.
  • I updated the docstrings of any updated modules, classes, and methods.
  • I added/updated Python typings for any new/updated class and module.
  • I updated the bot version (if necessary).
  • I ran mypy and reviewed any shown errors related to my changes.

Important Info

  • This pull request adds new pip dependencies.
  • This pull request adds new external dependencies.
  • This pull request changes the required versions of some dependencies.

Issues Closed

My pull request closes the following issues:
N/A

Thank You

Thank you for your contribution to Scioly.org! This pull request will be reviewed
in a promptly manner. If not done, please feel free to contact @cbrxyz.

The built-in regex engine for Python supports backtracking which can
lead to backtracking DoS (since user input is used for pings). `re2`
aims to fix this by reimplementing how the regex DFA is traversed and
does not allow more complex regex syntax like lookahead/lookbehind,
generalized assertions, and \Z.

Not only does `re2` protect against backtracking algorithms, it also
has a significant performance improvement compared to `re`.

See https://github.com/google/re2/wiki/Syntax for more information on
supported syntax.
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.

1 participant