From 2e0199f652d17015e4681f61811489e39057134d Mon Sep 17 00:00:00 2001 From: Chlod Alejandro Date: Fri, 1 May 2026 22:08:39 +0200 Subject: [PATCH] fix potential format string pollution Some URLs may have a format string pattern in them, which will cause the argument count to be incorrect and crash the enqueue. This locks in the key and URL to be plain strings and completely uninterpreted to avoid this issue. --- src/earwigbot/wiki/copyvios/workers.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/earwigbot/wiki/copyvios/workers.py b/src/earwigbot/wiki/copyvios/workers.py index 0a7a5ff..ac11cf8 100644 --- a/src/earwigbot/wiki/copyvios/workers.py +++ b/src/earwigbot/wiki/copyvios/workers.py @@ -493,12 +493,13 @@ class CopyvioWorkspace: key = ".".join(urlparse(url).netloc.split(".")[-2:]) - logmsg = f"enqueue(): %s {key} -> {url}" + matchup = f"{key} -> {url}" + logmsg = f"enqueue(): %s %s" if key in self._queues.sites: - self._logger.debug(logmsg % "append") + self._logger.debug(logmsg % ("append", matchup)) self._queues.sites[key].append(source) else: - self._logger.debug(logmsg % "new") + self._logger.debug(logmsg % ("new", matchup)) q: SourceQueue = collections.deque() q.append(source) self._queues.sites[key] = q