testing plone site security policy - is your intranet doing what you think it is?

38
understand, develop, deliver. www.netsight.co.uk Testing Plone Site Security Policy Matt Hamilton Netsight Internet Solutions, UK (Is your intranet doing what you think it is?)

Upload: wooda

Post on 23-Jan-2015

3.382 views

Category:

Technology


0 download

DESCRIPTION

Plone is a powerful system that allows you to create complex sites, with complex workflows and user access control. But how do you know if the site you are building really does what you expect it to do? You have workgroups that can be private, public or secret; you have documents that can be private, draft, pending or published; you have users that can be members, authors, reviewers, contributors, managers... How can you be sure that for every combination your site does what you expect? I will present the experiences of developing a complex intranet with a scenario similar to above, and show the tools we developed and the approach we used to ensure that that policy as defined by the client was what the site eventually conformed to. We built a testing system to allow the policy for a site to be easily defined and the thousands of security permutations to be effectively visualised and problem patterns spotted. The talk will also include a step by step run through of the use of the tools and a simple example of testing site policy.

TRANSCRIPT

Page 1: Testing Plone Site Security Policy - Is Your Intranet Doing What You Think It Is?

understand, develop, deliver. www.netsight.co.uk

Testing Plone Site Security Policy

Matt HamiltonNetsight Internet Solutions, UK

(Is your intranet doing what you think it is?)

Page 2: Testing Plone Site Security Policy - Is Your Intranet Doing What You Think It Is?

understand, develop, deliver. www.netsight.co.uk

What this talk is NOT

• Not talking about security vulnerabilities

• Not talking about code unit testing

• Not talking about penetration testing

Page 3: Testing Plone Site Security Policy - Is Your Intranet Doing What You Think It Is?

understand, develop, deliver. www.netsight.co.uk

So what IS this talk?

It goes something a bit like this:

Page 4: Testing Plone Site Security Policy - Is Your Intranet Doing What You Think It Is?

understand, develop, deliver. www.netsight.co.uk

So what IS this talk?

It goes something a bit like this:

Is our intranet secure?

Boss

Page 5: Testing Plone Site Security Policy - Is Your Intranet Doing What You Think It Is?

understand, develop, deliver. www.netsight.co.uk

So what IS this talk?

It goes something a bit like this:

Is our intranet secure?

Boss

Yes of course!

You

Page 6: Testing Plone Site Security Policy - Is Your Intranet Doing What You Think It Is?

understand, develop, deliver. www.netsight.co.uk

So what IS this talk?

Page 7: Testing Plone Site Security Policy - Is Your Intranet Doing What You Think It Is?

understand, develop, deliver. www.netsight.co.uk

So what IS this talk?

• But is it really?! Lets think about this:

Page 8: Testing Plone Site Security Policy - Is Your Intranet Doing What You Think It Is?

understand, develop, deliver. www.netsight.co.uk

So what IS this talk?

• But is it really?! Lets think about this:

➡ You installed Plone

Page 9: Testing Plone Site Security Policy - Is Your Intranet Doing What You Think It Is?

understand, develop, deliver. www.netsight.co.uk

So what IS this talk?

• But is it really?! Lets think about this:

➡ You installed Plone

➡ You created a set of custom content types

Page 10: Testing Plone Site Security Policy - Is Your Intranet Doing What You Think It Is?

understand, develop, deliver. www.netsight.co.uk

So what IS this talk?

• But is it really?! Lets think about this:

➡ You installed Plone

➡ You created a set of custom content types

➡ You created a custom workflow

Page 11: Testing Plone Site Security Policy - Is Your Intranet Doing What You Think It Is?

understand, develop, deliver. www.netsight.co.uk

So what IS this talk?

• But is it really?! Lets think about this:

➡ You installed Plone

➡ You created a set of custom content types

➡ You created a custom workflow

➡ Users have group memberships, local roles, etc

Page 12: Testing Plone Site Security Policy - Is Your Intranet Doing What You Think It Is?

understand, develop, deliver. www.netsight.co.uk

So what IS this talk?

So our site is now quite complex in terms of who should be allowed to do what and

where

Page 13: Testing Plone Site Security Policy - Is Your Intranet Doing What You Think It Is?

understand, develop, deliver. www.netsight.co.uk

Our use-case

Page 14: Testing Plone Site Security Policy - Is Your Intranet Doing What You Think It Is?

understand, develop, deliver. www.netsight.co.uk

Belron.net

Page 15: Testing Plone Site Security Policy - Is Your Intranet Doing What You Think It Is?

understand, develop, deliver. www.netsight.co.uk

Belron.net

• Belron.net Intranet is based around ‘Projects’ and ‘Groups’

Page 16: Testing Plone Site Security Policy - Is Your Intranet Doing What You Think It Is?

understand, develop, deliver. www.netsight.co.uk

Belron.net

• Belron.net Intranet is based around ‘Projects’ and ‘Groups’

- Users have local membership and roles of individual groups and projects

Page 17: Testing Plone Site Security Policy - Is Your Intranet Doing What You Think It Is?

understand, develop, deliver. www.netsight.co.uk

Belron.net

• Belron.net Intranet is based around ‘Projects’ and ‘Groups’

- Users have local membership and roles of individual groups and projects

- Projects may be in various ‘states’: Public, Private, Secret

Page 18: Testing Plone Site Security Policy - Is Your Intranet Doing What You Think It Is?

understand, develop, deliver. www.netsight.co.uk

Belron.net

• Belron.net Intranet is based around ‘Projects’ and ‘Groups’

- Users have local membership and roles of individual groups and projects

- Projects may be in various ‘states’: Public, Private, Secret

- Users have local roles to their project: Member, Contributor, Reviewer, Owner, Manager

Page 19: Testing Plone Site Security Policy - Is Your Intranet Doing What You Think It Is?

understand, develop, deliver. www.netsight.co.uk

Belron.net

• Belron.net Intranet is based around ‘Projects’ and ‘Groups’

- Users have local membership and roles of individual groups and projects

- Projects may be in various ‘states’: Public, Private, Secret

- Users have local roles to their project: Member, Contributor, Reviewer, Owner, Manager

- Content within a project may be in various states: Private, Draft, Pending, Published

Page 20: Testing Plone Site Security Policy - Is Your Intranet Doing What You Think It Is?

understand, develop, deliver. www.netsight.co.uk

Belron.net

• Belron.net Intranet is based around ‘Projects’ and ‘Groups’

- Users have local membership and roles of individual groups and projects

- Projects may be in various ‘states’: Public, Private, Secret

- Users have local roles to their project: Member, Contributor, Reviewer, Owner, Manager

- Content within a project may be in various states: Private, Draft, Pending, Published

Page 21: Testing Plone Site Security Policy - Is Your Intranet Doing What You Think It Is?

understand, develop, deliver. www.netsight.co.uk

So....

Page 22: Testing Plone Site Security Policy - Is Your Intranet Doing What You Think It Is?

understand, develop, deliver. www.netsight.co.uk

So....

• If a piece of content is in the pending state, in a private project, in which I am a member and contributor, should I be able to edit it?

Page 23: Testing Plone Site Security Policy - Is Your Intranet Doing What You Think It Is?

understand, develop, deliver. www.netsight.co.uk

So....

• If a piece of content is in the pending state, in a private project, in which I am a member and contributor, should I be able to edit it?

• If a project is in the secret state, and I am a non-member should I be able to view the project description?

Page 24: Testing Plone Site Security Policy - Is Your Intranet Doing What You Think It Is?

understand, develop, deliver. www.netsight.co.uk

Policy decisions

Page 25: Testing Plone Site Security Policy - Is Your Intranet Doing What You Think It Is?

understand, develop, deliver. www.netsight.co.uk

Policy decisions

• These are POLICY decisions for the site, not really CODE decisions.

Page 26: Testing Plone Site Security Policy - Is Your Intranet Doing What You Think It Is?

understand, develop, deliver. www.netsight.co.uk

Policy decisions

• These are POLICY decisions for the site, not really CODE decisions.

- ie. these are high level objectives set by analysts/managers not coders

Page 27: Testing Plone Site Security Policy - Is Your Intranet Doing What You Think It Is?

understand, develop, deliver. www.netsight.co.uk

Policy decisions

• These are POLICY decisions for the site, not really CODE decisions.

- ie. these are high level objectives set by analysts/managers not coders

- But they will catch errors in the code or customisation

Page 28: Testing Plone Site Security Policy - Is Your Intranet Doing What You Think It Is?

understand, develop, deliver. www.netsight.co.uk

Coverage

Page 29: Testing Plone Site Security Policy - Is Your Intranet Doing What You Think It Is?

understand, develop, deliver. www.netsight.co.uk

Coverage

• So, we have 3 project states x 5 local roles x 4 content states = 60 permutations

Page 30: Testing Plone Site Security Policy - Is Your Intranet Doing What You Think It Is?

understand, develop, deliver. www.netsight.co.uk

Coverage

• So, we have 3 project states x 5 local roles x 4 content states = 60 permutations

• oh... and in Plone Owner has special meaning on a piece of content... so 120 permutations

Page 31: Testing Plone Site Security Policy - Is Your Intranet Doing What You Think It Is?

understand, develop, deliver. www.netsight.co.uk

Coverage

• So, we have 3 project states x 5 local roles x 4 content states = 60 permutations

• oh... and in Plone Owner has special meaning on a piece of content... so 120 permutations

• And for each one we want to test: can I View, Edit, List, Delete, Add....

Page 32: Testing Plone Site Security Policy - Is Your Intranet Doing What You Think It Is?

understand, develop, deliver. www.netsight.co.uk

Coverage

• So, we have 3 project states x 5 local roles x 4 content states = 60 permutations

• oh... and in Plone Owner has special meaning on a piece of content... so 120 permutations

• And for each one we want to test: can I View, Edit, List, Delete, Add....

• For Belron.net we had approx 1,300 tests needed

Page 33: Testing Plone Site Security Policy - Is Your Intranet Doing What You Think It Is?

understand, develop, deliver. www.netsight.co.uk

An idea...

• What if there was a nice easy way to test all these different permutations in an automated way and drive it all from a manager-friendly spreadsheet and be able to visually see the results?

Page 34: Testing Plone Site Security Policy - Is Your Intranet Doing What You Think It Is?

understand, develop, deliver. www.netsight.co.uk

PolicyTestCase

• Similar to PloneTestCase

• Write a bunch of tests

• Export a spreadsheet as CSV

• Run the tests

• See the results in a table

Page 35: Testing Plone Site Security Policy - Is Your Intranet Doing What You Think It Is?

understand, develop, deliver. www.netsight.co.uk

PolicyTestCaseclass TestDefaultPlone(PolicyTestCase):

def afterSetUp(self):

# Setup the state, eg workflow etc

def ViewContent(self):

# Test we can view the content

def NoViewContent(self):

# Test we can NOT view the content

Page 36: Testing Plone Site Security Policy - Is Your Intranet Doing What You Think It Is?

understand, develop, deliver. www.netsight.co.uk

PolicyTestCase

def test_suite():

from unittest import TestSuite

suite = TestSuite()

csv = open('%s/test_scenarios_simple2.csv' % PACKAGE_HOME)

suite.addTest(makeSuiteFromCSV(TestDefaultPlone, csv))

return suite

Page 37: Testing Plone Site Security Policy - Is Your Intranet Doing What You Think It Is?

understand, develop, deliver. www.netsight.co.uk

Demo

Demo and walkthrough of the code

Page 38: Testing Plone Site Security Policy - Is Your Intranet Doing What You Think It Is?

understand, develop, deliver. www.netsight.co.uk

Questions?

Any questions?

Matt [email protected]

PolicyTestCase: in collective, will do a release real soon now ;)