This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

Introduction

This package contains utilities that can help to protect parts of Plone or applications build on top of the Plone framework.

protect decorator

The most common way to use plone.app.protect is through the protect decorator. This decorator takes a list of checkers as parameters: each checker will check a specific security aspect of the request. For example:

from plone.app.protect import protect
from plone.app.protect import PostOnly

@protect(PostOnly)
def SensitiveMethod(self, REQUEST=None):
    # This is only allowed with HTTP POST requests.

This relies on the protected method having a parameter called REQUEST.

HTTP POST

If you only need to allow HTTP POST requests you can use the PostOnly checker:

from plone.app.protect import PostOnly
from plone.app.protect import protect

@protect(PostOnly)
def manage_doSomething(self, param, REQUEST=None):
    pass

This checker only operators on HTTP requests; other types of requests are not checked.

Form authentication

A common problem in web applications is Cross Site Request Forgery or CSRF. This is an attack method in which an attacker tricks a browser to do a HTTP form submit to another site. To do this the attacker needs to know the exact form parameters. Form authentication is a method to make it impossible for an attacker to predict those parameters by adding an extra authenticator which can be verified.

To use the form authenticator you first need to insert it into your form. This can be done using a simple TAL statement inside your form:

<span tal:replace="structure context/@@authenticator/authenticator"/>

this will produce a HTML input element with the authentication information. Next you need to add logic somewhere to verify the authenticator. This can be done using a call to the authenticator view. For example:

authenticator=getMultiAdapter((request, context), name=u"authenticator")
if not authenticator.verify():
    raise Unauthorized

You can do the same thing more conveniently using the protect decorator:

from plone.app.protect import CheckAuthenticator
from plone.app.protect import protect

@protect(CheckAuthenticator)
def manage_doSomething(self, param, REQUEST=None):
    pass

Changelog

1.0b1 - March 7, 2008

  • Refactor the code to offer a generic protect decorator for methods which takes a list of checkers as options. Add checkers for both the authenticator verification and HTTP POST-only. [wichert]

1.0a1 - January 27, 2008

  • Initial release [wichert]
Release History

Release History

1.0b1

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0a1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
plone.app.protect-1.0b1-py2.4.egg (18.2 kB) Copy SHA256 Checksum SHA256 2.4 Egg Mar 7, 2008
plone.app.protect-1.0b1.tar.gz (12.2 kB) Copy SHA256 Checksum SHA256 Source Mar 7, 2008

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting