Add HTML sanitization code

Bug #117784 reported by Aaron Swartz
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
web.py
Confirmed
High
Anand Chitipothu

Bug Description

The HTML sanitization code at http://www.aaronsw.com/2002/sanitize/ (and possibly the other code there) should be integrated into web.py, perhaps after we get some approval of its sanity by someone.

Revision history for this message
Anand Chitipothu (anandology) wrote : Re: [Bug 117784] Add HTML sanitization code

How is this related to web.py?

On 30-May-07, at 9:24 PM, Aaron Swartz wrote:

> Public bug reported:
>
> The HTML sanitization code at http://www.aaronsw.com/2002/sanitize/
> (and
> possibly the other code there) should be integrated into web.py,
> perhaps
> after we get some approval of its sanity by someone.
>
> ** Affects: webpy (upstream)
> Importance: Undecided
> Status: Unconfirmed
>
> --
> Add HTML sanitization code
> https://bugs.launchpad.net/bugs/117784
> You received this bug notification because you are a member of Web.py
> Administrators, which is the registrant for web.py.

Revision history for this message
Eleanor Berger (intellectronica) wrote :

> How is this related to web.py?

Actually, it makes sense - many web applications have 'user-contributed' parts, and they always require this sort of facility.

Aaron Swartz (aaronsw)
Changed in webpy:
assignee: nobody → aaronsw
importance: Undecided → High
status: New → Confirmed
Changed in webpy:
milestone: none → 0.3
Revision history for this message
huntercross (hunter-ponticlaro) wrote :

i agree we need sanitation / filtering for all user input built-in to web.py. i added a bug report here: https://bugs.launchpad.net/webpy/+bug/179962 that includes another approach to this that could be used in conjunction with aaron's sanitize code. i attached that code to this bug as well.

Aaron Swartz (aaronsw)
Changed in webpy:
assignee: aaronsw → anandology
Revision history for this message
Aaron Swartz (aaronsw) wrote :

taking off 0.3.

Changed in webpy:
milestone: 0.3 → none
milestone: none → 0.35
Aaron Swartz (aaronsw)
Changed in webpy:
milestone: 0.35 → 0.31
Changed in webpy:
milestone: 0.32 → 0.35
Revision history for this message
Anand Chitipothu (anandology) wrote :

Genshi has very elegant support for filtering and sanitizing html.

http://genshi.edgewall.org/wiki/Documentation/filters.html

Here is some code that I use for sanitizing user pages in Open Library.

def sanitize(html)
    stream = genshi.HTML(html) | genshi.filters.HTMLSanitizer() | genshi.filters.Transformer("a").attr("rel", "nofollow")
    return stream.render()

Should we just point people to use Genshi for doing sanitization instead of adding something to web.py?

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.