You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Malicious robots.txt can trigger O(N²) parsing, waste CPU #163147
This was originally reported by @VadimToptunov. If robots.txt contains repeated User-Agent lines for a rule, then urllib.robotparser.RobotFileParser.parse() can run in O(N²) and burn a lot of CPU parsing it. Specifically this line in _merge_into building two sets out of the same long list of agents on every line:
Normal robots.txt files shouldn't have many duplicate User-Agent lines, the only reason to do this would be specifically to cause trouble. This is a different issue from #149381 which is about optimizing path parsing which comes up more normally.
Activity