aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar sco1 <[email protected]>2019-10-08 21:04:00 -0400
committerGravatar sco1 <[email protected]>2019-10-08 21:04:00 -0400
commita03945ab1b7ab841e57c58ef851cd4172b50f470 (patch)
treeeca27799e6a7cc58e35297906b33e89a247fc623
parentMerge pull request #504 from python-discord/show-reason-bot-actor-infractions (diff)
Expand token detection regex character exclusion
This helps enable broader detection of tokens being used in contexts beyond simple assignment
-rw-r--r--bot/cogs/token_remover.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/bot/cogs/token_remover.py b/bot/cogs/token_remover.py
index 4a655d049..5a0d20e57 100644
--- a/bot/cogs/token_remover.py
+++ b/bot/cogs/token_remover.py
@@ -26,11 +26,11 @@ DELETION_MESSAGE_TEMPLATE = (
DISCORD_EPOCH_TIMESTAMP = datetime(2017, 1, 1)
TOKEN_EPOCH = 1_293_840_000
TOKEN_RE = re.compile(
- r"[^\s\.]+" # Matches token part 1: The user ID string, encoded as base64
- r"\." # Matches a literal dot between the token parts
- r"[^\s\.]+" # Matches token part 2: The creation timestamp, as an integer
- r"\." # Matches a literal dot between the token parts
- r"[^\s\.]+" # Matches token part 3: The HMAC, unused by us, but check that it isn't empty
+ r"[^\s\.()\"']+" # Matches token part 1: The user ID string, encoded as base64
+ r"\." # Matches a literal dot between the token parts
+ r"[^\s\.()\"']+" # Matches token part 2: The creation timestamp, as an integer
+ r"\." # Matches a literal dot between the token parts
+ r"[^\s\.()\"']+" # Matches token part 3: The HMAC, unused by us, but check that it isn't empty
)