zope.securitypolicy


Namezope.securitypolicy JSON
Version 6.0 PyPI version JSON
download
home_pagehttps://github.com/zopefoundation/zope.securitypolicy
SummaryDefault security policy for Zope3
upload_time2025-09-12 07:40:04
maintainerNone
docs_urlNone
authorZope Foundation and Contributors
requires_python>=3.9
licenseZPL-2.1
keywords zope3 security policy
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            =====================
 zope.securitypolicy
=====================

.. image:: https://img.shields.io/pypi/v/zope.securitypolicy.svg
   :target: https://pypi.org/project/zope.securitypolicy/
   :alt: Latest release

.. image:: https://img.shields.io/pypi/pyversions/zope.securitypolicy.svg
   :target: https://pypi.org/project/zope.securitypolicy/
   :alt: Supported Python versions

.. image:: https://github.com/zopefoundation/zope.securitypolicy/actions/workflows/tests.yml/badge.svg
   :target: https://github.com/zopefoundation/zope.securitypolicy/actions/workflows/tests.yml

.. image:: https://coveralls.io/repos/github/zopefoundation/zope.securitypolicy/badge.svg?branch=master
   :target: https://coveralls.io/github/zopefoundation/zope.securitypolicy?branch=master



This package provides an useful security policy for Zope3. It's the
default security policy used in "zope3 the application" and many other
zope-based projects.


Classic Zope Security Policy
============================

This package implements a role-based security policy similar to the
policy found in Zope 2.  The security policy is responsible for
deciding whether an interaction has a permission on an object.  This
security policy does this using grant and denial information.  Managers
can grant or deny:

  - roles to principals,

  - permissions to principals, and

  - permissions to roles

Grants and denials are stored as annotations on objects.  To store
grants and denials, objects must be annotatable:

  >>> import zope.interface
  >>> from zope.annotation.interfaces import IAttributeAnnotatable
  >>> @zope.interface.implementer(IAttributeAnnotatable)
  ... class Ob:
  ...     pass

  >>> ob = Ob()

We use objects to represent principals.  These objects implement an
interface named `IPrincipal`, but the security policy only uses the `id`
and `groups` attributes:

  >>> class Principal:
  ...     def __init__(self, id):
  ...         self.id = id
  ...         self.groups = []

  >>> principal = Principal('bob')

Roles and permissions are also represented by objects, however, for
the purposes of the security policy, only string `ids` are used.

The security policy provides a factory for creating interactions:

  >>> import zope.securitypolicy.zopepolicy
  >>> interaction = zope.securitypolicy.zopepolicy.ZopeSecurityPolicy()

An interaction represents a specific interaction between some
principals (normally users) and the system.  Normally, we are only
concerned with the interaction of one principal with the system, although
we can have interactions of multiple principals.  Multiple-principal
interactions normally occur when untrusted users store code on a
system for later execution.  When untrusted code is executing, the
authors of the code participate in the interaction.  An
interaction has a permission on an object only if all of the
principals participating in the interaction have access to the object.

The `checkPermission` method on interactions is used to test whether
an interaction has a permission for an object.  An interaction without
participants always has every permission:

  >>> interaction.checkPermission('P1', ob)
  True

In this example, 'P1' is a permission id.

Normally, interactions have participants:

  >>> class Participation:
  ...     interaction = None
  >>> participation = Participation()
  >>> participation.principal = principal
  >>> interaction.add(participation)

If we have participants, then we don't have a permission unless there
are grants:

  >>> interaction.checkPermission('P1', ob)
  False

Note, however, that we always have the CheckerPublic permission:

  >>> from zope.security.checker import CheckerPublic
  >>> interaction.checkPermission(CheckerPublic, ob)
  True

We make grants and denials on objects by adapting them to various
granting interfaces.  The objects returned from the adaptation are 
object-specific manager objects:

  >>> from zope.securitypolicy import interfaces
  >>> roleper  = interfaces.IRolePermissionManager(ob)
  >>> prinrole = interfaces.IPrincipalRoleManager(ob)
  >>> prinper  = interfaces.IPrincipalPermissionManager(ob)

The computations involved in checking permissions can be
significant. To reduce the computational cost, caching is used
extensively. We could invalidate the cache as we make grants, but the
adapters for making grants will automatically invalidate the cache of
the current interaction.  They use the security-management apis to do
this. To take advantage of the cache invalidation, we'll need to let
the security-management system manage our interactions.  First, we'll
set our security policy as the default:

  >>> import zope.security.management
  >>> oldpolicy = zope.security.management.setSecurityPolicy(
  ...      zope.securitypolicy.zopepolicy.ZopeSecurityPolicy)

and then we'll create a new interaction:

  >>> participation = Participation()
  >>> participation.principal = principal
  >>> zope.security.management.newInteraction(participation)
  >>> interaction = zope.security.management.getInteraction()

We normally provide access by granting permissions to roles for an object:

  >>> roleper.grantPermissionToRole('P1', 'R1')

and then granting roles to principals for an object (local roles):

  >>> prinrole.assignRoleToPrincipal('R1', 'bob')

The combination of these grants, which we call a role-based grant,
provides the permission:

  >>> interaction.checkPermission('P1', ob)
  True

We can also provide a permission directly:

  >>> prinper.grantPermissionToPrincipal('P2', 'bob')
  >>> interaction.checkPermission('P2', ob)
  True

Permission grants or denials override role-based grant or denials.  So
if we deny P1:

  >>> prinper.denyPermissionToPrincipal('P1', 'bob')

we cause the interaction to lack the permission, despite the role
grants:

  >>> interaction.checkPermission('P1', ob)
  False

Similarly, even if we have a role-based denial of P2:

  >>> roleper.denyPermissionToRole('P2', 'R1')

we still have access, because of the permission-based grant:

  >>> interaction.checkPermission('P2', ob)
  True

A role-based denial doesn't actually deny a permission; rather it
prevents the granting of a permission. So, if we have both grants and
denials based on roles, we have access:

  >>> roleper.grantPermissionToRole('P3', 'R1')
  >>> roleper.grantPermissionToRole('P3', 'R2')
  >>> roleper.denyPermissionToRole('P3', 'R3')
  >>> prinrole.removeRoleFromPrincipal('R2', 'bob')
  >>> prinrole.assignRoleToPrincipal('R3', 'bob')

  >>> interaction.checkPermission('P3', ob)
  True

Global grants
-------------

Grants made to an object are said to be "local".  We can also make
global grants:

  >>> from zope.securitypolicy.rolepermission import \
  ...     rolePermissionManager as roleperG
  >>> from zope.securitypolicy.principalpermission import \
  ...     principalPermissionManager as prinperG
  >>> from zope.securitypolicy.principalrole import \
  ...     principalRoleManager as prinroleG

And the same rules apply to global grants and denials.

  >>> roleperG.grantPermissionToRole('P1G', 'R1G', False)

In these tests, we aren't bothering to define any roles, permissions,
or principals, so we pass an extra argument that tells the granting
routines not to check the validity of the values.

  >>> prinroleG.assignRoleToPrincipal('R1G', 'bob', False)
  >>> interaction.checkPermission('P1G', ob)
  True

  >>> prinperG.grantPermissionToPrincipal('P2G', 'bob', False)
  >>> interaction.checkPermission('P2G', ob)
  True

  >>> prinperG.denyPermissionToPrincipal('P1G', 'bob', False)
  >>> interaction.checkPermission('P1G', ob)
  False

  >>> roleperG.denyPermissionToRole('P2G', 'R1G', False)
  >>> interaction.checkPermission('P2G', ob)
  True

  >>> roleperG.grantPermissionToRole('P3G', 'R1G', False)
  >>> roleperG.grantPermissionToRole('P3G', 'R2G', False)
  >>> roleperG.denyPermissionToRole('P3G', 'R3G', False)
  >>> prinroleG.removeRoleFromPrincipal('R2G', 'bob', False)
  >>> prinroleG.assignRoleToPrincipal('R3G', 'bob', False)
  >>> interaction.checkPermission('P3G', ob)
  True

Local versus global grants
--------------------------

We, of course, acquire global grants by default:

  >>> interaction.checkPermission('P1G', ob)
  False
  >>> interaction.checkPermission('P2G', ob)
  True
  >>> interaction.checkPermission('P3G', ob)
  True

Local role-based grants do not override global principal-specific denials:

  >>> roleper.grantPermissionToRole('P1G', 'R1G')
  >>> prinrole.assignRoleToPrincipal('R1G', 'bob')
  >>> interaction.checkPermission('P1G', ob)
  False

And local role-based denials don't override global
principal-grants:

  >>> roleper.denyPermissionToRole('P2G', 'R1G')
  >>> interaction.checkPermission('P2G', ob)
  True

A local role-based deny can cancel a global role-based grant:

  >>> roleper.denyPermissionToRole('P3G', 'R1G')
  >>> interaction.checkPermission('P3G', ob)
  False

and a local role-based grant can override a global role-based denial:

  >>> roleperG.denyPermissionToRole('P4G', 'R1G', False)
  >>> prinroleG.assignRoleToPrincipal('R1G', "bob", False)
  >>> interaction.checkPermission('P4G', ob)
  False
  >>> roleper.grantPermissionToRole('P4G', 'R1G')
  >>> interaction.checkPermission('P4G', ob)
  True
  >>> prinroleG.removeRoleFromPrincipal('R1G', "bob", False)
  >>> interaction.checkPermission('P4G', ob)
  True

Of course, a local permission-based grant or denial overrides any
global setting and overrides local role-based grants or denials:

  >>> prinper.grantPermissionToPrincipal('P3G', 'bob')
  >>> interaction.checkPermission('P3G', ob)
  True

  >>> prinper.denyPermissionToPrincipal('P2G', 'bob')
  >>> interaction.checkPermission('P2G', ob)
  False

Sublocations
------------

We can have sub-locations. A sublocation of a location is an object
whose `__parent__` attribute is the location:

  >>> ob2 = Ob()
  >>> ob2.__parent__ = ob

By default, sublocations acquire grants from higher locations:

  >>> interaction.checkPermission('P1', ob2)
  False
  >>> interaction.checkPermission('P2', ob2)
  True
  >>> interaction.checkPermission('P3', ob2)
  True
  >>> interaction.checkPermission('P1G', ob2)
  False
  >>> interaction.checkPermission('P2G', ob2)
  False
  >>> interaction.checkPermission('P3G', ob2)
  True
  >>> interaction.checkPermission('P4G', ob2)
  True

Sublocation role-based grants do not override their parent
principal-specific denials:

  >>> roleper2  = interfaces.IRolePermissionManager(ob2)
  >>> prinrole2 = interfaces.IPrincipalRoleManager(ob2)
  >>> prinper2  = interfaces.IPrincipalPermissionManager(ob2)

  >>> roleper2.grantPermissionToRole('P1', 'R1')
  >>> prinrole2.assignRoleToPrincipal('R1', 'bob')
  >>> interaction.checkPermission('P1', ob2)
  False

And local role-based denials don't override their parents
principal-grant:

  >>> roleper2.denyPermissionToRole('P2', 'R1')
  >>> interaction.checkPermission('P2', ob2)
  True

A local role-based deny can cancel a parent role-based grant:

  >>> roleper2.denyPermissionToRole('P3', 'R1')
  >>> interaction.checkPermission('P3', ob2)
  False

and a local role-based grant can override a parent role-based denial:

  >>> roleper.denyPermissionToRole('P4', 'R1')
  >>> prinrole.assignRoleToPrincipal('R1', 'bob')
  >>> interaction.checkPermission('P4', ob2)
  False
  >>> roleper2.grantPermissionToRole('P4', 'R1')
  >>> interaction.checkPermission('P4', ob2)
  True
  >>> prinrole.removeRoleFromPrincipal('R1', 'bob')
  >>> interaction.checkPermission('P4', ob2)
  True


Of course, a local permission-based grant or denial overrides any
global setting and overrides local role-based grants or denials:

  >>> prinper.grantPermissionToPrincipal('P3', 'bob')
  >>> interaction.checkPermission('P3', ob2)
  True

  >>> prinper.denyPermissionToPrincipal('P2', 'bob')
  >>> interaction.checkPermission('P2', ob2)
  False

If an object is not annotatable, but does have a parent, it will get
its grants from its parent:

  >>> class C:
  ...     pass

  >>> ob3 = C()
  >>> ob3.__parent__ = ob

  >>> interaction.checkPermission('P1', ob3)
  False
  >>> interaction.checkPermission('P2', ob3)
  False
  >>> interaction.checkPermission('P3', ob3)
  True
  >>> interaction.checkPermission('P1G', ob3)
  False
  >>> interaction.checkPermission('P2G', ob3)
  False
  >>> interaction.checkPermission('P3G', ob3)
  True
  >>> interaction.checkPermission('P4G', ob3)
  True

The same results will be had if there are multiple non-annotatable
objects:

  >>> ob3.__parent__ = C()
  >>> ob3.__parent__.__parent__ = ob

  >>> interaction.checkPermission('P1', ob3)
  False
  >>> interaction.checkPermission('P2', ob3)
  False
  >>> interaction.checkPermission('P3', ob3)
  True
  >>> interaction.checkPermission('P1G', ob3)
  False
  >>> interaction.checkPermission('P2G', ob3)
  False
  >>> interaction.checkPermission('P3G', ob3)
  True
  >>> interaction.checkPermission('P4G', ob3)
  True

and if an object doesn't have a parent:

  >>> ob4 = C()

it will have whatever grants were made globally:

  >>> interaction.checkPermission('P1', ob4)
  False
  >>> interaction.checkPermission('P2', ob4)
  False
  >>> interaction.checkPermission('P3', ob4)
  False
  >>> interaction.checkPermission('P1G', ob4)
  False
  >>> interaction.checkPermission('P2G', ob4)
  True
  >>> interaction.checkPermission('P3G', ob4)
  False
  >>> interaction.checkPermission('P4G', ob4)
  False

  >>> prinroleG.assignRoleToPrincipal('R1G', "bob", False)
  >>> interaction.checkPermission('P3G', ob4)
  True

We'll get the same result if we have a non-annotatable parent without a
parent:

  >>> ob3.__parent__ = C()

  >>> interaction.checkPermission('P1', ob3)
  False
  >>> interaction.checkPermission('P2', ob3)
  False
  >>> interaction.checkPermission('P3', ob3)
  False
  >>> interaction.checkPermission('P1G', ob3)
  False
  >>> interaction.checkPermission('P2G', ob3)
  True
  >>> interaction.checkPermission('P3G', ob3)
  True
  >>> interaction.checkPermission('P4G', ob3)
  False

The Anonymous role
------------------

The security policy defines a special role named "zope.Anonymous".  All
principals have this role and the role cannot be taken away.

  >>> roleperG.grantPermissionToRole('P5', 'zope.Anonymous', False)
  >>> interaction.checkPermission('P5', ob2)
  True

Proxies
-------

Objects may be proxied:

  >>> from zope.security.checker import ProxyFactory
  >>> ob = ProxyFactory(ob)
  >>> interaction.checkPermission('P1', ob)
  False
  >>> interaction.checkPermission('P2', ob)
  False
  >>> interaction.checkPermission('P3', ob)
  True
  >>> interaction.checkPermission('P1G', ob)
  False
  >>> interaction.checkPermission('P2G', ob)
  False
  >>> interaction.checkPermission('P3G', ob)
  True
  >>> interaction.checkPermission('P4G', ob)
  True

as may their parents:

  >>> ob3 = C()
  >>> ob3.__parent__ = ob

  >>> interaction.checkPermission('P1', ob3)
  False
  >>> interaction.checkPermission('P2', ob3)
  False
  >>> interaction.checkPermission('P3', ob3)
  True
  >>> interaction.checkPermission('P1G', ob3)
  False
  >>> interaction.checkPermission('P2G', ob3)
  False
  >>> interaction.checkPermission('P3G', ob3)
  True
  >>> interaction.checkPermission('P4G', ob3)
  True

Groups
------

Principals may have groups.  Groups are also principals (and, thus,
may have groups).

If a principal has groups, the groups are available as group ids in
the principal's `groups` attribute.  The interaction has to convert
these group ids to group objects, so that it can tell whether the
groups have groups.  It does this by calling the `getPrincipal` method
on the principal authentication service, which is responsible for,
among other things, converting a principal id to a principal.
For our examples here, we'll create and register a stub principal
authentication service:

  >>> from zope.authentication.interfaces import IAuthentication
  >>> @zope.interface.implementer(IAuthentication)
  ... class FauxPrincipals(object):
  ...     def __init__(self):
  ...         self.data = {}
  ...     def __setitem__(self, key, value):
  ...         self.data[key] = value
  ...     def __getitem__(self, key):
  ...         return self.data[key]
  ...     def getPrincipal(self, id):
  ...         return self.data[id]

  >>> auth = FauxPrincipals()

  >>> from zope.component import provideUtility
  >>> provideUtility(auth, IAuthentication)

Let's define a group:

  >>> auth['g1'] = Principal('g1')

Let's put the principal in our group.  We do that by adding the group id
to the new principals groups:

  >>> principal.groups.append('g1')

Of course, the principal doesn't have permissions not granted:

  >>> interaction.checkPermission('gP1', ob)
  False

Now, if we grant a permission to the group:

  >>> prinper.grantPermissionToPrincipal('gP1', 'g1')

We see that our principal has the permission:

  >>> interaction.checkPermission('gP1', ob)
  True

This works even if the group grant is global:

  >>> interaction.checkPermission('gP1G', ob)
  False

  >>> prinperG.grantPermissionToPrincipal('gP1G', 'g1', True)

  >>> interaction.checkPermission('gP1G', ob)
  True

Grants are, of course, acquired:

  >>> interaction.checkPermission('gP1', ob2)
  True

  >>> interaction.checkPermission('gP1G', ob2)
  True

Inner grants can override outer grants:

  >>> prinper2.denyPermissionToPrincipal('gP1', 'g1')
  >>> interaction.checkPermission('gP1', ob2)
  False

But principal grants always trump group grants:

  >>> prinper2.grantPermissionToPrincipal('gP1', 'bob')
  >>> interaction.checkPermission('gP1', ob2)
  True

Groups can have groups too:

  >>> auth['g2'] = Principal('g2')
  >>> auth['g1'].groups.append('g2')

If we grant to the new group:

  >>> prinper.grantPermissionToPrincipal('gP2', 'g2')

Then we, of course have that permission too:

  >>> interaction.checkPermission('gP2', ob2)
  True

Just as principal grants override group grants, group grants can
override other group grants:

  >>> prinper.denyPermissionToPrincipal('gP2', 'g1')
  >>> interaction.checkPermission('gP2', ob2)
  False

Principals can be in more than one group. Let's define a new group:

  >>> auth['g3'] = Principal('g3')
  >>> principal.groups.append('g3')
  >>> prinper.grantPermissionToPrincipal('gP2', 'g3')

Now, the principal has two groups. In one group, the permission 'gP2'
is denied, but in the other, it is allowed.  In a case like this, the
permission is allowed:

  >>> interaction.checkPermission('gP2', ob2)
  True

In a case where a principal has two or more groups, the group denies
prevent allows from their parents. They don't prevent the principal
from getting an allow from another principal.

Grants can be inherited from ancestor groups through multiple paths.
Let's grant a permission to g2 and deny it to g1:

  >>> prinper.grantPermissionToPrincipal('gP3', 'g2')
  >>> prinper.denyPermissionToPrincipal('gP3', 'g1')

Now, as before, the deny in g1 blocks the grant in g2:

  >>> interaction.checkPermission('gP3', ob2)
  False

Let's make g2 a group of g3:

  >>> auth['g3'].groups.append('g2')

Now, we get g2's grant through g3, and access is allowed:

  >>> interaction.invalidate_cache()
  >>> interaction.checkPermission('gP3', ob2)
  True

We can assign roles to groups:

  >>> prinrole.assignRoleToPrincipal('gR1', 'g2')

and get permissions through the roles:

  >>> roleper.grantPermissionToRole('gP4', 'gR1')
  >>> interaction.checkPermission('gP4', ob2)
  True

we can override role assignments to groups through subgroups:

  >>> prinrole.removeRoleFromPrincipal('gR1', 'g1')
  >>> prinrole.removeRoleFromPrincipal('gR1', 'g3')
  >>> interaction.checkPermission('gP4', ob2)
  False

and through principals:

  >>> prinrole.assignRoleToPrincipal('gR1', 'bob')
  >>> interaction.checkPermission('gP4', ob2)
  True


We clean up the changes we made in these examples:

  >>> zope.security.management.endInteraction()
  >>> ignore = zope.security.management.setSecurityPolicy(oldpolicy)


=========
 Changes
=========

6.0 (2025-09-12)
================

- Replace ``pkg_resources`` namespace with PEP 420 native namespace.


5.1 (2025-02-14)
================

- Add support for Python 3.12, 3.13.

- Drop support for Python 3.7, 3.8.


5.0 (2023-02-24)
================

- Add support for Python 3.9, 3.10, 3.11.

- Drop support for Python 2.7, 3.5, 3.6.


4.3.2 (2021-03-19)
==================

- Add support for Python 3.8.

- Drop support for Python 3.4.

- Fix some test imports to use the proper imports from
  ``zope.interface`` instead of ``zope.component``.

4.3.1 (2018-10-11)
==================

- Use current location for `IRegistered` and `IUnregistered` interface.


4.3.0 (2018-08-27)
==================

- Add support for Python 3.7.

- Drop support for Python 3.3.

- Drop support for ``python setup.py test``.

- Make ``SecurityMap`` and ``AnnotationGrantInfo`` have proper truth
  behaviour on Python 3; previously they were always true.

- Make ``AnnotationGrantInfo`` consistently return lists instead of
  dict views on Python 3.

- Make ``AnnotationSecurityMap`` (and objects derived from it, such as
  ``AnnotationPrincipalPermissionManager`` and the role managers) more
  efficient when adding or removing cells before they have been
  persisted. They now avoid some unnecessary object copying.

4.2.0 (2017-08-24)
==================

- Add ``<zope:deny>`` directive, which is a mirror of the ``<zope:grant>``
  directive.

- Add support for Python 3.6.


4.1.0 (2016-11-05)
==================

- Add support for Python 3.5.

- Drop support for Python 2.6.

- Add support to grant multiple permissions with one ZCML statement. Example::

    <grant
      role="my-role"
      permissions="zope.foo
                   zope.bar" />


4.0.0 (2014-12-24)
==================

- Add support for PyPy.  (PyPy3 is pending release of a fix for:
  https://bitbucket.org/pypy/pypy/issue/1946)

- Add support for Python 3.4.

- Add support for testing on Travis.


4.0.0a1 (2013-02-22)
====================

- Add support for Python 3.3.

- Replace deprecated ``zope.interface.classProvides`` usage with equivalent
  ``zope.interface.provider`` decorator.

- Replace deprecated ``zope.interface.implements`` usage with equivalent
  ``zope.interface.implementer`` decorator.

- Drop support for Python 2.4 and 2.5.


3.7.0 (2010-09-25)
==================

- LP #131115: Clean up inconsistency in ``getSetting`` interface definitions
  and actual usage for the various security maps.

- LP #564525:  fix permission moved from ``zope.app.dublincore`` namespace
  to ``zope.dublincore``.

- Remove unused imports and pep8 cleanup.

- Use doctest module instead of the deprecated zope.testing.doctest.

- AnnotationGrantInfo implements IGrantInfo.

- Add test extra to declare test dependency on ``zope.component [test]``.

- Add an extra named ``dublincore`` to express optional dependency on
  ``zope.dublincore >= 3.7``.

- Add tests for ZCML files making sure they include everything they need.


3.6.1 (2009-07-24)
==================

- Make tests work when the default and Zope vocabulary registry compete in the
  cleanup.

3.6.0 (2009-03-14)
==================

- Change ``zope.app.security`` dependency to the new ``zope.authentication``
  package, dropping a big number of unused dependencies.

- Get rid of ``zope.app.testing`` and other testing dependencices.

- Add ``ZODB3`` to install dependencies, because we use ``Persistent``
  class. We didn't fail before, because it was installed implicitly.

3.5.1 (2009-03-10)
==================

- Don't depend on the ``hook`` extra of zope.component, as we don't need
  it explicitly.

- Import security settings (Allow, Deny, Unset) in the ``interfaces``
  module from the ``zope.securitypolicy.settings``, added in previous
  release instead of old ``zope.app.security.settings``.
  The ``zope.app.security`` will be adapted to import them from
  ``zope.securitypolicy.interfaces``.

- Use ``_z_instances`` instead of ``__instances__`` for storing instances
  for ``zope.securitypolicy.settings.PermissionSetting`` singleton
  implementation, because __*__ name pattern is reserved for special
  names in python.

- Add security protections for the ``PermissionSetting``.

- Improve documentation formatting, add it to the package's long
  description.

- Remove unneeded dependencies.

- Remove old zpkg-related files and zcml slugs.

3.5.0 (2009-01-31)
==================

- Include settings that were previously imported from zope.app.security.

3.4.2 (2009-01-28)
==================

- Change mailing list address to zope-dev at zope.org. Fix package
  homepage to the pypi page.

- Fix test in buildout which still depended on zope.app.securitypolicy
  by mistake.

- Remove explicit dependency on zope.app.form from ``setup.py``; nothing
  in the code directly depends on this.

3.4.1 (2008-06-02)
==================

- Fix reference to deprecated security policy from ZCML.

3.4.0 (2007-09-25)
==================

- Initial documented release

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/zopefoundation/zope.securitypolicy",
    "name": "zope.securitypolicy",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "zope3 security policy",
    "author": "Zope Foundation and Contributors",
    "author_email": "zope-dev@zope.dev",
    "download_url": "https://files.pythonhosted.org/packages/ad/11/ddfa94b773245e0da6ef5a869fd95e7200fe6562780c8f2265f07dd8384e/zope_securitypolicy-6.0.tar.gz",
    "platform": null,
    "description": "=====================\n zope.securitypolicy\n=====================\n\n.. image:: https://img.shields.io/pypi/v/zope.securitypolicy.svg\n   :target: https://pypi.org/project/zope.securitypolicy/\n   :alt: Latest release\n\n.. image:: https://img.shields.io/pypi/pyversions/zope.securitypolicy.svg\n   :target: https://pypi.org/project/zope.securitypolicy/\n   :alt: Supported Python versions\n\n.. image:: https://github.com/zopefoundation/zope.securitypolicy/actions/workflows/tests.yml/badge.svg\n   :target: https://github.com/zopefoundation/zope.securitypolicy/actions/workflows/tests.yml\n\n.. image:: https://coveralls.io/repos/github/zopefoundation/zope.securitypolicy/badge.svg?branch=master\n   :target: https://coveralls.io/github/zopefoundation/zope.securitypolicy?branch=master\n\n\n\nThis package provides an useful security policy for Zope3. It's the\ndefault security policy used in \"zope3 the application\" and many other\nzope-based projects.\n\n\nClassic Zope Security Policy\n============================\n\nThis package implements a role-based security policy similar to the\npolicy found in Zope 2.  The security policy is responsible for\ndeciding whether an interaction has a permission on an object.  This\nsecurity policy does this using grant and denial information.  Managers\ncan grant or deny:\n\n  - roles to principals,\n\n  - permissions to principals, and\n\n  - permissions to roles\n\nGrants and denials are stored as annotations on objects.  To store\ngrants and denials, objects must be annotatable:\n\n  >>> import zope.interface\n  >>> from zope.annotation.interfaces import IAttributeAnnotatable\n  >>> @zope.interface.implementer(IAttributeAnnotatable)\n  ... class Ob:\n  ...     pass\n\n  >>> ob = Ob()\n\nWe use objects to represent principals.  These objects implement an\ninterface named `IPrincipal`, but the security policy only uses the `id`\nand `groups` attributes:\n\n  >>> class Principal:\n  ...     def __init__(self, id):\n  ...         self.id = id\n  ...         self.groups = []\n\n  >>> principal = Principal('bob')\n\nRoles and permissions are also represented by objects, however, for\nthe purposes of the security policy, only string `ids` are used.\n\nThe security policy provides a factory for creating interactions:\n\n  >>> import zope.securitypolicy.zopepolicy\n  >>> interaction = zope.securitypolicy.zopepolicy.ZopeSecurityPolicy()\n\nAn interaction represents a specific interaction between some\nprincipals (normally users) and the system.  Normally, we are only\nconcerned with the interaction of one principal with the system, although\nwe can have interactions of multiple principals.  Multiple-principal\ninteractions normally occur when untrusted users store code on a\nsystem for later execution.  When untrusted code is executing, the\nauthors of the code participate in the interaction.  An\ninteraction has a permission on an object only if all of the\nprincipals participating in the interaction have access to the object.\n\nThe `checkPermission` method on interactions is used to test whether\nan interaction has a permission for an object.  An interaction without\nparticipants always has every permission:\n\n  >>> interaction.checkPermission('P1', ob)\n  True\n\nIn this example, 'P1' is a permission id.\n\nNormally, interactions have participants:\n\n  >>> class Participation:\n  ...     interaction = None\n  >>> participation = Participation()\n  >>> participation.principal = principal\n  >>> interaction.add(participation)\n\nIf we have participants, then we don't have a permission unless there\nare grants:\n\n  >>> interaction.checkPermission('P1', ob)\n  False\n\nNote, however, that we always have the CheckerPublic permission:\n\n  >>> from zope.security.checker import CheckerPublic\n  >>> interaction.checkPermission(CheckerPublic, ob)\n  True\n\nWe make grants and denials on objects by adapting them to various\ngranting interfaces.  The objects returned from the adaptation are \nobject-specific manager objects:\n\n  >>> from zope.securitypolicy import interfaces\n  >>> roleper  = interfaces.IRolePermissionManager(ob)\n  >>> prinrole = interfaces.IPrincipalRoleManager(ob)\n  >>> prinper  = interfaces.IPrincipalPermissionManager(ob)\n\nThe computations involved in checking permissions can be\nsignificant. To reduce the computational cost, caching is used\nextensively. We could invalidate the cache as we make grants, but the\nadapters for making grants will automatically invalidate the cache of\nthe current interaction.  They use the security-management apis to do\nthis. To take advantage of the cache invalidation, we'll need to let\nthe security-management system manage our interactions.  First, we'll\nset our security policy as the default:\n\n  >>> import zope.security.management\n  >>> oldpolicy = zope.security.management.setSecurityPolicy(\n  ...      zope.securitypolicy.zopepolicy.ZopeSecurityPolicy)\n\nand then we'll create a new interaction:\n\n  >>> participation = Participation()\n  >>> participation.principal = principal\n  >>> zope.security.management.newInteraction(participation)\n  >>> interaction = zope.security.management.getInteraction()\n\nWe normally provide access by granting permissions to roles for an object:\n\n  >>> roleper.grantPermissionToRole('P1', 'R1')\n\nand then granting roles to principals for an object (local roles):\n\n  >>> prinrole.assignRoleToPrincipal('R1', 'bob')\n\nThe combination of these grants, which we call a role-based grant,\nprovides the permission:\n\n  >>> interaction.checkPermission('P1', ob)\n  True\n\nWe can also provide a permission directly:\n\n  >>> prinper.grantPermissionToPrincipal('P2', 'bob')\n  >>> interaction.checkPermission('P2', ob)\n  True\n\nPermission grants or denials override role-based grant or denials.  So\nif we deny P1:\n\n  >>> prinper.denyPermissionToPrincipal('P1', 'bob')\n\nwe cause the interaction to lack the permission, despite the role\ngrants:\n\n  >>> interaction.checkPermission('P1', ob)\n  False\n\nSimilarly, even if we have a role-based denial of P2:\n\n  >>> roleper.denyPermissionToRole('P2', 'R1')\n\nwe still have access, because of the permission-based grant:\n\n  >>> interaction.checkPermission('P2', ob)\n  True\n\nA role-based denial doesn't actually deny a permission; rather it\nprevents the granting of a permission. So, if we have both grants and\ndenials based on roles, we have access:\n\n  >>> roleper.grantPermissionToRole('P3', 'R1')\n  >>> roleper.grantPermissionToRole('P3', 'R2')\n  >>> roleper.denyPermissionToRole('P3', 'R3')\n  >>> prinrole.removeRoleFromPrincipal('R2', 'bob')\n  >>> prinrole.assignRoleToPrincipal('R3', 'bob')\n\n  >>> interaction.checkPermission('P3', ob)\n  True\n\nGlobal grants\n-------------\n\nGrants made to an object are said to be \"local\".  We can also make\nglobal grants:\n\n  >>> from zope.securitypolicy.rolepermission import \\\n  ...     rolePermissionManager as roleperG\n  >>> from zope.securitypolicy.principalpermission import \\\n  ...     principalPermissionManager as prinperG\n  >>> from zope.securitypolicy.principalrole import \\\n  ...     principalRoleManager as prinroleG\n\nAnd the same rules apply to global grants and denials.\n\n  >>> roleperG.grantPermissionToRole('P1G', 'R1G', False)\n\nIn these tests, we aren't bothering to define any roles, permissions,\nor principals, so we pass an extra argument that tells the granting\nroutines not to check the validity of the values.\n\n  >>> prinroleG.assignRoleToPrincipal('R1G', 'bob', False)\n  >>> interaction.checkPermission('P1G', ob)\n  True\n\n  >>> prinperG.grantPermissionToPrincipal('P2G', 'bob', False)\n  >>> interaction.checkPermission('P2G', ob)\n  True\n\n  >>> prinperG.denyPermissionToPrincipal('P1G', 'bob', False)\n  >>> interaction.checkPermission('P1G', ob)\n  False\n\n  >>> roleperG.denyPermissionToRole('P2G', 'R1G', False)\n  >>> interaction.checkPermission('P2G', ob)\n  True\n\n  >>> roleperG.grantPermissionToRole('P3G', 'R1G', False)\n  >>> roleperG.grantPermissionToRole('P3G', 'R2G', False)\n  >>> roleperG.denyPermissionToRole('P3G', 'R3G', False)\n  >>> prinroleG.removeRoleFromPrincipal('R2G', 'bob', False)\n  >>> prinroleG.assignRoleToPrincipal('R3G', 'bob', False)\n  >>> interaction.checkPermission('P3G', ob)\n  True\n\nLocal versus global grants\n--------------------------\n\nWe, of course, acquire global grants by default:\n\n  >>> interaction.checkPermission('P1G', ob)\n  False\n  >>> interaction.checkPermission('P2G', ob)\n  True\n  >>> interaction.checkPermission('P3G', ob)\n  True\n\nLocal role-based grants do not override global principal-specific denials:\n\n  >>> roleper.grantPermissionToRole('P1G', 'R1G')\n  >>> prinrole.assignRoleToPrincipal('R1G', 'bob')\n  >>> interaction.checkPermission('P1G', ob)\n  False\n\nAnd local role-based denials don't override global\nprincipal-grants:\n\n  >>> roleper.denyPermissionToRole('P2G', 'R1G')\n  >>> interaction.checkPermission('P2G', ob)\n  True\n\nA local role-based deny can cancel a global role-based grant:\n\n  >>> roleper.denyPermissionToRole('P3G', 'R1G')\n  >>> interaction.checkPermission('P3G', ob)\n  False\n\nand a local role-based grant can override a global role-based denial:\n\n  >>> roleperG.denyPermissionToRole('P4G', 'R1G', False)\n  >>> prinroleG.assignRoleToPrincipal('R1G', \"bob\", False)\n  >>> interaction.checkPermission('P4G', ob)\n  False\n  >>> roleper.grantPermissionToRole('P4G', 'R1G')\n  >>> interaction.checkPermission('P4G', ob)\n  True\n  >>> prinroleG.removeRoleFromPrincipal('R1G', \"bob\", False)\n  >>> interaction.checkPermission('P4G', ob)\n  True\n\nOf course, a local permission-based grant or denial overrides any\nglobal setting and overrides local role-based grants or denials:\n\n  >>> prinper.grantPermissionToPrincipal('P3G', 'bob')\n  >>> interaction.checkPermission('P3G', ob)\n  True\n\n  >>> prinper.denyPermissionToPrincipal('P2G', 'bob')\n  >>> interaction.checkPermission('P2G', ob)\n  False\n\nSublocations\n------------\n\nWe can have sub-locations. A sublocation of a location is an object\nwhose `__parent__` attribute is the location:\n\n  >>> ob2 = Ob()\n  >>> ob2.__parent__ = ob\n\nBy default, sublocations acquire grants from higher locations:\n\n  >>> interaction.checkPermission('P1', ob2)\n  False\n  >>> interaction.checkPermission('P2', ob2)\n  True\n  >>> interaction.checkPermission('P3', ob2)\n  True\n  >>> interaction.checkPermission('P1G', ob2)\n  False\n  >>> interaction.checkPermission('P2G', ob2)\n  False\n  >>> interaction.checkPermission('P3G', ob2)\n  True\n  >>> interaction.checkPermission('P4G', ob2)\n  True\n\nSublocation role-based grants do not override their parent\nprincipal-specific denials:\n\n  >>> roleper2  = interfaces.IRolePermissionManager(ob2)\n  >>> prinrole2 = interfaces.IPrincipalRoleManager(ob2)\n  >>> prinper2  = interfaces.IPrincipalPermissionManager(ob2)\n\n  >>> roleper2.grantPermissionToRole('P1', 'R1')\n  >>> prinrole2.assignRoleToPrincipal('R1', 'bob')\n  >>> interaction.checkPermission('P1', ob2)\n  False\n\nAnd local role-based denials don't override their parents\nprincipal-grant:\n\n  >>> roleper2.denyPermissionToRole('P2', 'R1')\n  >>> interaction.checkPermission('P2', ob2)\n  True\n\nA local role-based deny can cancel a parent role-based grant:\n\n  >>> roleper2.denyPermissionToRole('P3', 'R1')\n  >>> interaction.checkPermission('P3', ob2)\n  False\n\nand a local role-based grant can override a parent role-based denial:\n\n  >>> roleper.denyPermissionToRole('P4', 'R1')\n  >>> prinrole.assignRoleToPrincipal('R1', 'bob')\n  >>> interaction.checkPermission('P4', ob2)\n  False\n  >>> roleper2.grantPermissionToRole('P4', 'R1')\n  >>> interaction.checkPermission('P4', ob2)\n  True\n  >>> prinrole.removeRoleFromPrincipal('R1', 'bob')\n  >>> interaction.checkPermission('P4', ob2)\n  True\n\n\nOf course, a local permission-based grant or denial overrides any\nglobal setting and overrides local role-based grants or denials:\n\n  >>> prinper.grantPermissionToPrincipal('P3', 'bob')\n  >>> interaction.checkPermission('P3', ob2)\n  True\n\n  >>> prinper.denyPermissionToPrincipal('P2', 'bob')\n  >>> interaction.checkPermission('P2', ob2)\n  False\n\nIf an object is not annotatable, but does have a parent, it will get\nits grants from its parent:\n\n  >>> class C:\n  ...     pass\n\n  >>> ob3 = C()\n  >>> ob3.__parent__ = ob\n\n  >>> interaction.checkPermission('P1', ob3)\n  False\n  >>> interaction.checkPermission('P2', ob3)\n  False\n  >>> interaction.checkPermission('P3', ob3)\n  True\n  >>> interaction.checkPermission('P1G', ob3)\n  False\n  >>> interaction.checkPermission('P2G', ob3)\n  False\n  >>> interaction.checkPermission('P3G', ob3)\n  True\n  >>> interaction.checkPermission('P4G', ob3)\n  True\n\nThe same results will be had if there are multiple non-annotatable\nobjects:\n\n  >>> ob3.__parent__ = C()\n  >>> ob3.__parent__.__parent__ = ob\n\n  >>> interaction.checkPermission('P1', ob3)\n  False\n  >>> interaction.checkPermission('P2', ob3)\n  False\n  >>> interaction.checkPermission('P3', ob3)\n  True\n  >>> interaction.checkPermission('P1G', ob3)\n  False\n  >>> interaction.checkPermission('P2G', ob3)\n  False\n  >>> interaction.checkPermission('P3G', ob3)\n  True\n  >>> interaction.checkPermission('P4G', ob3)\n  True\n\nand if an object doesn't have a parent:\n\n  >>> ob4 = C()\n\nit will have whatever grants were made globally:\n\n  >>> interaction.checkPermission('P1', ob4)\n  False\n  >>> interaction.checkPermission('P2', ob4)\n  False\n  >>> interaction.checkPermission('P3', ob4)\n  False\n  >>> interaction.checkPermission('P1G', ob4)\n  False\n  >>> interaction.checkPermission('P2G', ob4)\n  True\n  >>> interaction.checkPermission('P3G', ob4)\n  False\n  >>> interaction.checkPermission('P4G', ob4)\n  False\n\n  >>> prinroleG.assignRoleToPrincipal('R1G', \"bob\", False)\n  >>> interaction.checkPermission('P3G', ob4)\n  True\n\nWe'll get the same result if we have a non-annotatable parent without a\nparent:\n\n  >>> ob3.__parent__ = C()\n\n  >>> interaction.checkPermission('P1', ob3)\n  False\n  >>> interaction.checkPermission('P2', ob3)\n  False\n  >>> interaction.checkPermission('P3', ob3)\n  False\n  >>> interaction.checkPermission('P1G', ob3)\n  False\n  >>> interaction.checkPermission('P2G', ob3)\n  True\n  >>> interaction.checkPermission('P3G', ob3)\n  True\n  >>> interaction.checkPermission('P4G', ob3)\n  False\n\nThe Anonymous role\n------------------\n\nThe security policy defines a special role named \"zope.Anonymous\".  All\nprincipals have this role and the role cannot be taken away.\n\n  >>> roleperG.grantPermissionToRole('P5', 'zope.Anonymous', False)\n  >>> interaction.checkPermission('P5', ob2)\n  True\n\nProxies\n-------\n\nObjects may be proxied:\n\n  >>> from zope.security.checker import ProxyFactory\n  >>> ob = ProxyFactory(ob)\n  >>> interaction.checkPermission('P1', ob)\n  False\n  >>> interaction.checkPermission('P2', ob)\n  False\n  >>> interaction.checkPermission('P3', ob)\n  True\n  >>> interaction.checkPermission('P1G', ob)\n  False\n  >>> interaction.checkPermission('P2G', ob)\n  False\n  >>> interaction.checkPermission('P3G', ob)\n  True\n  >>> interaction.checkPermission('P4G', ob)\n  True\n\nas may their parents:\n\n  >>> ob3 = C()\n  >>> ob3.__parent__ = ob\n\n  >>> interaction.checkPermission('P1', ob3)\n  False\n  >>> interaction.checkPermission('P2', ob3)\n  False\n  >>> interaction.checkPermission('P3', ob3)\n  True\n  >>> interaction.checkPermission('P1G', ob3)\n  False\n  >>> interaction.checkPermission('P2G', ob3)\n  False\n  >>> interaction.checkPermission('P3G', ob3)\n  True\n  >>> interaction.checkPermission('P4G', ob3)\n  True\n\nGroups\n------\n\nPrincipals may have groups.  Groups are also principals (and, thus,\nmay have groups).\n\nIf a principal has groups, the groups are available as group ids in\nthe principal's `groups` attribute.  The interaction has to convert\nthese group ids to group objects, so that it can tell whether the\ngroups have groups.  It does this by calling the `getPrincipal` method\non the principal authentication service, which is responsible for,\namong other things, converting a principal id to a principal.\nFor our examples here, we'll create and register a stub principal\nauthentication service:\n\n  >>> from zope.authentication.interfaces import IAuthentication\n  >>> @zope.interface.implementer(IAuthentication)\n  ... class FauxPrincipals(object):\n  ...     def __init__(self):\n  ...         self.data = {}\n  ...     def __setitem__(self, key, value):\n  ...         self.data[key] = value\n  ...     def __getitem__(self, key):\n  ...         return self.data[key]\n  ...     def getPrincipal(self, id):\n  ...         return self.data[id]\n\n  >>> auth = FauxPrincipals()\n\n  >>> from zope.component import provideUtility\n  >>> provideUtility(auth, IAuthentication)\n\nLet's define a group:\n\n  >>> auth['g1'] = Principal('g1')\n\nLet's put the principal in our group.  We do that by adding the group id\nto the new principals groups:\n\n  >>> principal.groups.append('g1')\n\nOf course, the principal doesn't have permissions not granted:\n\n  >>> interaction.checkPermission('gP1', ob)\n  False\n\nNow, if we grant a permission to the group:\n\n  >>> prinper.grantPermissionToPrincipal('gP1', 'g1')\n\nWe see that our principal has the permission:\n\n  >>> interaction.checkPermission('gP1', ob)\n  True\n\nThis works even if the group grant is global:\n\n  >>> interaction.checkPermission('gP1G', ob)\n  False\n\n  >>> prinperG.grantPermissionToPrincipal('gP1G', 'g1', True)\n\n  >>> interaction.checkPermission('gP1G', ob)\n  True\n\nGrants are, of course, acquired:\n\n  >>> interaction.checkPermission('gP1', ob2)\n  True\n\n  >>> interaction.checkPermission('gP1G', ob2)\n  True\n\nInner grants can override outer grants:\n\n  >>> prinper2.denyPermissionToPrincipal('gP1', 'g1')\n  >>> interaction.checkPermission('gP1', ob2)\n  False\n\nBut principal grants always trump group grants:\n\n  >>> prinper2.grantPermissionToPrincipal('gP1', 'bob')\n  >>> interaction.checkPermission('gP1', ob2)\n  True\n\nGroups can have groups too:\n\n  >>> auth['g2'] = Principal('g2')\n  >>> auth['g1'].groups.append('g2')\n\nIf we grant to the new group:\n\n  >>> prinper.grantPermissionToPrincipal('gP2', 'g2')\n\nThen we, of course have that permission too:\n\n  >>> interaction.checkPermission('gP2', ob2)\n  True\n\nJust as principal grants override group grants, group grants can\noverride other group grants:\n\n  >>> prinper.denyPermissionToPrincipal('gP2', 'g1')\n  >>> interaction.checkPermission('gP2', ob2)\n  False\n\nPrincipals can be in more than one group. Let's define a new group:\n\n  >>> auth['g3'] = Principal('g3')\n  >>> principal.groups.append('g3')\n  >>> prinper.grantPermissionToPrincipal('gP2', 'g3')\n\nNow, the principal has two groups. In one group, the permission 'gP2'\nis denied, but in the other, it is allowed.  In a case like this, the\npermission is allowed:\n\n  >>> interaction.checkPermission('gP2', ob2)\n  True\n\nIn a case where a principal has two or more groups, the group denies\nprevent allows from their parents. They don't prevent the principal\nfrom getting an allow from another principal.\n\nGrants can be inherited from ancestor groups through multiple paths.\nLet's grant a permission to g2 and deny it to g1:\n\n  >>> prinper.grantPermissionToPrincipal('gP3', 'g2')\n  >>> prinper.denyPermissionToPrincipal('gP3', 'g1')\n\nNow, as before, the deny in g1 blocks the grant in g2:\n\n  >>> interaction.checkPermission('gP3', ob2)\n  False\n\nLet's make g2 a group of g3:\n\n  >>> auth['g3'].groups.append('g2')\n\nNow, we get g2's grant through g3, and access is allowed:\n\n  >>> interaction.invalidate_cache()\n  >>> interaction.checkPermission('gP3', ob2)\n  True\n\nWe can assign roles to groups:\n\n  >>> prinrole.assignRoleToPrincipal('gR1', 'g2')\n\nand get permissions through the roles:\n\n  >>> roleper.grantPermissionToRole('gP4', 'gR1')\n  >>> interaction.checkPermission('gP4', ob2)\n  True\n\nwe can override role assignments to groups through subgroups:\n\n  >>> prinrole.removeRoleFromPrincipal('gR1', 'g1')\n  >>> prinrole.removeRoleFromPrincipal('gR1', 'g3')\n  >>> interaction.checkPermission('gP4', ob2)\n  False\n\nand through principals:\n\n  >>> prinrole.assignRoleToPrincipal('gR1', 'bob')\n  >>> interaction.checkPermission('gP4', ob2)\n  True\n\n\nWe clean up the changes we made in these examples:\n\n  >>> zope.security.management.endInteraction()\n  >>> ignore = zope.security.management.setSecurityPolicy(oldpolicy)\n\n\n=========\n Changes\n=========\n\n6.0 (2025-09-12)\n================\n\n- Replace ``pkg_resources`` namespace with PEP 420 native namespace.\n\n\n5.1 (2025-02-14)\n================\n\n- Add support for Python 3.12, 3.13.\n\n- Drop support for Python 3.7, 3.8.\n\n\n5.0 (2023-02-24)\n================\n\n- Add support for Python 3.9, 3.10, 3.11.\n\n- Drop support for Python 2.7, 3.5, 3.6.\n\n\n4.3.2 (2021-03-19)\n==================\n\n- Add support for Python 3.8.\n\n- Drop support for Python 3.4.\n\n- Fix some test imports to use the proper imports from\n  ``zope.interface`` instead of ``zope.component``.\n\n4.3.1 (2018-10-11)\n==================\n\n- Use current location for `IRegistered` and `IUnregistered` interface.\n\n\n4.3.0 (2018-08-27)\n==================\n\n- Add support for Python 3.7.\n\n- Drop support for Python 3.3.\n\n- Drop support for ``python setup.py test``.\n\n- Make ``SecurityMap`` and ``AnnotationGrantInfo`` have proper truth\n  behaviour on Python 3; previously they were always true.\n\n- Make ``AnnotationGrantInfo`` consistently return lists instead of\n  dict views on Python 3.\n\n- Make ``AnnotationSecurityMap`` (and objects derived from it, such as\n  ``AnnotationPrincipalPermissionManager`` and the role managers) more\n  efficient when adding or removing cells before they have been\n  persisted. They now avoid some unnecessary object copying.\n\n4.2.0 (2017-08-24)\n==================\n\n- Add ``<zope:deny>`` directive, which is a mirror of the ``<zope:grant>``\n  directive.\n\n- Add support for Python 3.6.\n\n\n4.1.0 (2016-11-05)\n==================\n\n- Add support for Python 3.5.\n\n- Drop support for Python 2.6.\n\n- Add support to grant multiple permissions with one ZCML statement. Example::\n\n    <grant\n      role=\"my-role\"\n      permissions=\"zope.foo\n                   zope.bar\" />\n\n\n4.0.0 (2014-12-24)\n==================\n\n- Add support for PyPy.  (PyPy3 is pending release of a fix for:\n  https://bitbucket.org/pypy/pypy/issue/1946)\n\n- Add support for Python 3.4.\n\n- Add support for testing on Travis.\n\n\n4.0.0a1 (2013-02-22)\n====================\n\n- Add support for Python 3.3.\n\n- Replace deprecated ``zope.interface.classProvides`` usage with equivalent\n  ``zope.interface.provider`` decorator.\n\n- Replace deprecated ``zope.interface.implements`` usage with equivalent\n  ``zope.interface.implementer`` decorator.\n\n- Drop support for Python 2.4 and 2.5.\n\n\n3.7.0 (2010-09-25)\n==================\n\n- LP #131115: Clean up inconsistency in ``getSetting`` interface definitions\n  and actual usage for the various security maps.\n\n- LP #564525:  fix permission moved from ``zope.app.dublincore`` namespace\n  to ``zope.dublincore``.\n\n- Remove unused imports and pep8 cleanup.\n\n- Use doctest module instead of the deprecated zope.testing.doctest.\n\n- AnnotationGrantInfo implements IGrantInfo.\n\n- Add test extra to declare test dependency on ``zope.component [test]``.\n\n- Add an extra named ``dublincore`` to express optional dependency on\n  ``zope.dublincore >= 3.7``.\n\n- Add tests for ZCML files making sure they include everything they need.\n\n\n3.6.1 (2009-07-24)\n==================\n\n- Make tests work when the default and Zope vocabulary registry compete in the\n  cleanup.\n\n3.6.0 (2009-03-14)\n==================\n\n- Change ``zope.app.security`` dependency to the new ``zope.authentication``\n  package, dropping a big number of unused dependencies.\n\n- Get rid of ``zope.app.testing`` and other testing dependencices.\n\n- Add ``ZODB3`` to install dependencies, because we use ``Persistent``\n  class. We didn't fail before, because it was installed implicitly.\n\n3.5.1 (2009-03-10)\n==================\n\n- Don't depend on the ``hook`` extra of zope.component, as we don't need\n  it explicitly.\n\n- Import security settings (Allow, Deny, Unset) in the ``interfaces``\n  module from the ``zope.securitypolicy.settings``, added in previous\n  release instead of old ``zope.app.security.settings``.\n  The ``zope.app.security`` will be adapted to import them from\n  ``zope.securitypolicy.interfaces``.\n\n- Use ``_z_instances`` instead of ``__instances__`` for storing instances\n  for ``zope.securitypolicy.settings.PermissionSetting`` singleton\n  implementation, because __*__ name pattern is reserved for special\n  names in python.\n\n- Add security protections for the ``PermissionSetting``.\n\n- Improve documentation formatting, add it to the package's long\n  description.\n\n- Remove unneeded dependencies.\n\n- Remove old zpkg-related files and zcml slugs.\n\n3.5.0 (2009-01-31)\n==================\n\n- Include settings that were previously imported from zope.app.security.\n\n3.4.2 (2009-01-28)\n==================\n\n- Change mailing list address to zope-dev at zope.org. Fix package\n  homepage to the pypi page.\n\n- Fix test in buildout which still depended on zope.app.securitypolicy\n  by mistake.\n\n- Remove explicit dependency on zope.app.form from ``setup.py``; nothing\n  in the code directly depends on this.\n\n3.4.1 (2008-06-02)\n==================\n\n- Fix reference to deprecated security policy from ZCML.\n\n3.4.0 (2007-09-25)\n==================\n\n- Initial documented release\n",
    "bugtrack_url": null,
    "license": "ZPL-2.1",
    "summary": "Default security policy for Zope3",
    "version": "6.0",
    "project_urls": {
        "Homepage": "https://github.com/zopefoundation/zope.securitypolicy"
    },
    "split_keywords": [
        "zope3",
        "security",
        "policy"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "c4183cf5e7e29afffb9dda60f97c0bf870ef3a74ecb5f81c6c0004f752657723",
                "md5": "44e4f36507c561e45222ff03ea7a459e",
                "sha256": "ed8e6df983170dddff9c0f1185c42bcfa39fc2264ec1f7112a6ef38dbc3e6dca"
            },
            "downloads": -1,
            "filename": "zope_securitypolicy-6.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "44e4f36507c561e45222ff03ea7a459e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 54597,
            "upload_time": "2025-09-12T07:40:03",
            "upload_time_iso_8601": "2025-09-12T07:40:03.547320Z",
            "url": "https://files.pythonhosted.org/packages/c4/18/3cf5e7e29afffb9dda60f97c0bf870ef3a74ecb5f81c6c0004f752657723/zope_securitypolicy-6.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "ad11ddfa94b773245e0da6ef5a869fd95e7200fe6562780c8f2265f07dd8384e",
                "md5": "b2b9b13ea0dc195e56c638f4d91b10b9",
                "sha256": "ae02c07f59c6dddcc4ac5b7fca241b81d4b68bc85805332d82e8dc6e777d8c05"
            },
            "downloads": -1,
            "filename": "zope_securitypolicy-6.0.tar.gz",
            "has_sig": false,
            "md5_digest": "b2b9b13ea0dc195e56c638f4d91b10b9",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 39334,
            "upload_time": "2025-09-12T07:40:04",
            "upload_time_iso_8601": "2025-09-12T07:40:04.784009Z",
            "url": "https://files.pythonhosted.org/packages/ad/11/ddfa94b773245e0da6ef5a869fd95e7200fe6562780c8f2265f07dd8384e/zope_securitypolicy-6.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-09-12 07:40:04",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "zopefoundation",
    "github_project": "zope.securitypolicy",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "zope.securitypolicy"
}
        
Elapsed time: 1.25491s