Re: XML(sanitize=True) and incorrect HTML

46 views
Skip to first unread message

Anthony

unread,
Jun 14, 2016, 2:25:07 PM6/14/16
to web2py-users, web2py-developers
In gluon.sanitizer.XssCleaner:

    def handle_endtag(self, tag):
        bracketed
= '</%s>' % tag
       
self.in_disallowed.pop()
       
if tag not in self.permitted_tags:
           
if (not self.strip_disallowed):
               
self.result += xssescape(bracketed)
       
elif tag in self.open_tags:
           
self.result += bracketed
           
self.open_tags.remove(tag)

maybe change the third line to:

        self.in_disallowed and self.in_disallowed.pop()

Note sure if that will cause any other problems.

Feel free to file a Github issue.

Anthony


On Tuesday, June 14, 2016 at 2:06:28 PM UTC-4, Kirill Shatalaev wrote:
Hello.

XML crashes while trying to sanitize some sorts of incorrect html.

For example:

a = '</em></em>' # wrong html
b = XML(a, sanitize=True)

<type 'exceptions.IndexError'> pop from empty list


I suppose this is a severe bug.

Massimo Di Pierro

unread,
Jun 18, 2016, 9:06:19 AM6/18/16
to web2py-users, web2py-d...@googlegroups.com
thanks for reporting this.

On Wednesday, 15 June 2016 02:29:53 UTC-5, Kirill Shatalaev wrote:
Opened #1363

вторник, 14 июня 2016 г., 22:25:05 UTC+4 пользователь Anthony написал:
Reply all
Reply to author
Forward
0 new messages