Stefan Behnel <stefan...@behnel.de> added the comment:

> The check may miss infinite recursions if the hrefs happen to be written in 
> non-matching but equivalent forms. Ex: relative versus absolute paths.

I thought about that, too, but it's not a real problem. There are only a few 
different ways to spell the same file path, and once they are through, the 
recursion would still be detected and never become infinite.

Admittedly, the current implementation might lower the overhead for attacks a 
little, but then, if an attacker can control the input anyway, then there is 
not really much to win by including the same file multiple times rather than 
including different files.

Maybe we should add a "max_depth" parameter to limit the maximum recursion 
depth, defaulting to e.g. 5, that users would have to pass in order to say "I 
know what I'm doing".

I agree with the comment about the overly restrictive global set, though. 
Included file paths should be collected only along an inclusion path and not 
across independent subtrees.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue20928>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to