aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Leon Sandøy <[email protected]>2018-08-11 17:18:21 +0200
committerGravatar Leon Sandøy <[email protected]>2018-08-11 17:18:21 +0200
commitf8d189d3bcca07b6ae8185da4c3634b4f1762802 (patch)
tree228cae9ad18c263ad81d7d3794510e3e39fef4ea
parentMakes TokenRemover, AntiSpam and Clean more consistent, with embeds, message ... (diff)
Improving the token regex to catch tokens with symbols in the HMAC
Diffstat (limited to '')
-rw-r--r--bot/cogs/token_remover.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/bot/cogs/token_remover.py b/bot/cogs/token_remover.py
index 846a46f9d..8277513a7 100644
--- a/bot/cogs/token_remover.py
+++ b/bot/cogs/token_remover.py
@@ -26,11 +26,11 @@ DISCORD_EPOCH_TIMESTAMP = datetime(2017, 1, 1)
TOKEN_EPOCH = 1_293_840_000
TOKEN_RE = re.compile(
r"(?<=(\"|'))" # Lookbehind: Only match if there's a double or single quote in front
- r"[^\W\.]+" # Matches token part 1: The user ID string, encoded as base64
+ r"[^\s\.]+" # Matches token part 1: The user ID string, encoded as base64
r"\." # Matches a literal dot between the token parts
- r"[^\W\.]+" # Matches token part 2: The creation timestamp, as an integer
+ r"[^\s\.]+" # Matches token part 2: The creation timestamp, as an integer
r"\." # Matches a literal dot between the token parts
- r"[^\W\.]+" # Matches token part 3: The HMAC, unused by us, but check that it isn't empty
+ r"[^\s\.]+" # Matches token part 3: The HMAC, unused by us, but check that it isn't empty
r"(?=(\"|'))" # Lookahead: Only match if there's a double or single quote after
)