Applying access control lists using wiki hierarchy

How does AccessControlList class work currently?

ACL objects are made from ACL lines in config and page. First acl_rights_before line is copied, then page lines are copied from page, or acl_rights_default if page does not have ACL lines. Last, acl_rights_after line is copied. Then, ACL object is created from the lines. This object contains a list of rights dictionaries and is created for each page and cached.

When accessing a page, user.may method is called, which retrieves the acl object from the page and checks for rights.

Patch Index

Patch

Author/Email

ACL Type

Applicable MoinMoin releases

Comments/Issues

hierachical-acl.diff

??

Traditional

??

hierachical-acl-666.diff

StephanZehrer

Traditional

patch level 666 (Debian)

hierachical-acl-moin--main--1.3-935.diff

AndreaArcangeli

??

1.3 patch 935

MoinMoinPatch/HierarchicalACL

pc2-206?

Traditional

1.5.1, 1.5.2, 1.5.3

port of hierachical-acl-moin--main--1.3-935.diff to 1.5.1

inherit-parent-acl.diff

OliverGraf

inherit at page creation?

1.3 patch 556

Problems

acl_rights_before, acl_rights_default and acl_rights_after are duplicated for every page

Worst case example: in a 1000 pages wiki with no acls, we copy acl_before, acl_default and acl_after to any page acl, then parse the same lines 1000 times, and finally cache 1000 equal acl instances.

With hierarchical acl, we would parse acl_rights_before, acl_rights_after and acl_rights_default once and keep them in memory, then cache None for every other page in the acl cache.

Using ACLs is too much work

You must add acl lines to any page you want to protect with different acl than the default acls. For example, if you would like to create some few pages for one project, you will have to add acl lines to each new page. If you want to change the project acl rights, you have to do it again for all the pages of the project.

One example is the acl rights of the help and system pages. To change these we use a script to edit all those pages text outside the wiki.

Testcases

Please add some test cases and write how your suggestion would catch these.

How hierarchial ACLs should work

before -> default -> parent page -> sub page -> after -> No!

Changes:

Flow of acl checking:

  1. acl_rights_before checked, so the admin can define rights nobody can override.
  2. acl_rights_default, pages and sub pages are checked - the order depending on the implementation
  3. acl_rights_after is checked, so we can add default rights to all pages.
  4. Last, if no acl matches, we deny access.

Benefits

Performance Issues

Changes to current code

The current AccessControlList.may checks a composite acl object, made from all acl_rights* and page rights, and returns True or False. The new .may function will check a single acl object, and return 3 answers: True, False or None, which means "don't know". The basic acl check looks like this:

   1 allowed = acl.may(request, name, what)
   2 if allowed is not None:
   3     return allowed

The complete acl checking will move from AccessControlList.may to the SecurityPolicy.xxx, e.g. SecurityPolicy.read

Checking the page hierarchy can be done in two ways: Posix file system like, or traditional acls.

Posix file system like hierarchy

Traditional ACL hierarchy

Reference

NTFS ACLs

In NTFS' ACLs, it works like this:

Posix ACLs

This should work like file system permissions. Say there are the following pages, TopSecret and !TopSecret/!PasswordFiles . If the user "protects" TopSecret by removing read right to everyone but himself, he would naturally expect everything below TopSecret to be protected.

For example, for the path a/b/c:

  1. check acl_rights_before
  2. check acl_rights_default
  3. check a
  4. check a/b
  5. check a/b/c
  6. check acl_rights_after
  7. return False

Pro:

Contra:

Traditional ACL hierarchy

Check each page acl, starting with the longest path, so each page can override the parent.

For example, for the path a/b/c:

  1. check acl_rights_before
  2. check a/b/c
  3. check a/b
  4. check a
  5. check acl_rights_default
  6. check acl_rights_after
  7. return False

Pro:

Here is a patch for this solution: hierachical-acl.diff

Notes:

Patch update

I was searching for solution to allow my users creating new pages and added this patch. The current version for Debian uses patch level 666 of MoinMoinWiki. So here the corresponding patch: hierachical-acl-666.diff

But after applying this patch i found a bug in wikiacl.py (addDefault is not available anymore):

  154             if entries == ['Default']:
  155                 self.addDefault(cfg)
  156                 continue

My simple fix at the moment is to disable these lines. Maybe somebody can help here. I have no overview over the system classes yet. -- StephanZehrer 2005-06-12 13:11:59

Patch update against moin--main--1.3 patch-935

I diffed the hierachical-acl patch one more time against current stable repository after fixing the addDefault problem pointed out above. I believe hierachical-acl is a much better model than the default one so I recommend inclusion in mainline (at least in the development tree). For example this automatically prevent spam blogging with the example in the Include macro. It works fine for me. hierachical-acl-moin--main--1.3-935.diff

Patch update against 1.5.1

Check wiki:MoinMoinPatch/HierarchicalACL.

Inherit parent pages acl lines

Here when a page acl is created, it copies all lines from parent pages, so the total acl lines per page are acl_before + parents lines + page lines + acl_after

inherit-parent-acl.diff

Updated patch to moin--main--1.3--patch-556

But I think the solution above which splits the acls and and does not need all this cache-mangeling here would be the better way of doing it. -- OliverGraf

Before potential inclusion ...

... tne:


While working the last days with 30 different acl groups I got some ideas how I would prefer that feature solved.

The most difference of this idea is to have the rights of the page visible written on each subpage.

To get that idea working we have to answer the following questions:

Why didnt we just write if hacl in wikiconfig is enabled the rights of the upper page to the new lower page?

I think that could be solved by:

  1. getting from acl_rights_before the user who is able to create the acl line of the page and
  2. splitting the new page creation internally in two actions if hacl is enabled.
    1. first we check if the one who like to create a lower page has write rights on the upper one.
    2. with saving we create the page with the acl line from the upper page changing temporary to the first user in acl_rights_before with admin rights
    3. the content of the page is saved as the user who entered the text

so hacl enabled requires at least one user set in acl_rights_before with admin rights.

What should we do on an existing wiki where one wants to enter now hierarchical acls and has some pages with rights already defined?

I tried to find answers to the following parts related to moving pages.

If later on someone disables in wikiconfig hacl the acl rights are on the pages stay defined. Only new lower pages dont get acl rights added. And if one spreads pages into other wikis the acls on the pages are defined too.

I do prefer this solution because you always see rights written on pages and this makes it in my eyes more comfortable to work with acls.

-- ReimarBauer 2007-10-15 07:05:09

MoinMoin: HierarchicalAccessControlList (last edited 2007-10-29 19:06:13 by localhost)