Package posterity :: Package web :: Class CSRFFilter

Class CSRFFilter



object --+
         |
        CSRFFilter

Cross Site Request Forgery protection filter

Inserts a shared secret hidden variable into all non GET-forms. CSRF attacks can be detected by validating this shared secret when non-GET forms are submitted.

>>> from genshi.input import HTML
>>> stream = HTML('<form method="post"/>')
>>> stream = stream | CSRFFilter('shared_secret')
>>> stream.render()
'<form method="post"><input type="hidden" name="_form_token" value="shared_secret"/></form>'


Instance Methods
 
__init__(self, form_token)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
 
__call__(self, stream)

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Properties

Inherited from object: __class__

Method Details

__init__(self, form_token)
(Constructor)

 
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
Overrides: object.__init__
(inherited documentation)