Преглед на файлове

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.
tags/v0.4.1
Chlod Alejandro преди 5 месеца
родител
ревизия
2e0199f652
No known key found for this signature in database GPG ключ ID: A1E67C59037B0CC1
променени са 1 файла, в които са добавени 4 реда и са изтрити 3 реда
  1. +4
    -3
      src/earwigbot/wiki/copyvios/workers.py

+ 4
- 3
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


Зареждане…
Отказ
Запис