blob: 113d46173b208894604dd1930c7e2ed932c135ad [file] [log] [blame]
Felipe Monteiroc8ec1f62017-11-15 08:32:56 +00001RBAC Testing Validation
2=======================
3
Felipe Monteiro26b7e092018-07-27 22:15:27 +01004.. _framework-overview:
5
Felipe Monteiroc8ec1f62017-11-15 08:32:56 +00006--------
7Overview
8--------
9
10RBAC testing validation is broken up into 3 stages:
11
Masayuki Igawa80b9aab2018-01-09 17:00:45 +090012#. "Expected" stage. Determine whether the test should be able to succeed
13 or fail based on the test role defined by ``[patrole] rbac_test_role``)
14 and the policy action that the test enforces.
15#. "Actual" stage. Run the test by calling the API endpoint that enforces
16 the expected policy action using the test role.
17#. Comparing the outputs from both stages for consistency. A "consistent"
18 result is treated as a pass and an "inconsistent" result is treated
19 as a failure. "Consistent" (or successful) cases include:
Felipe Monteiroc8ec1f62017-11-15 08:32:56 +000020
Masayuki Igawa80b9aab2018-01-09 17:00:45 +090021 * Expected result is ``True`` and the test passes.
22 * Expected result is ``False`` and the test fails.
Felipe Monteiroc8ec1f62017-11-15 08:32:56 +000023
Masayuki Igawa80b9aab2018-01-09 17:00:45 +090024 For example, a 200 from the API call and a ``True`` result from
25 ``oslo.policy`` or a 403 from the API call and a ``False`` result from
26 ``oslo.policy`` are successful results.
Felipe Monteiroc8ec1f62017-11-15 08:32:56 +000027
Masayuki Igawa80b9aab2018-01-09 17:00:45 +090028 "Inconsistent" (or failing) cases include:
Felipe Monteiroc8ec1f62017-11-15 08:32:56 +000029
Masayuki Igawa80b9aab2018-01-09 17:00:45 +090030 * Expected result is ``False`` and the test passes. This results in an
Felipe Monteirof16b6b32018-06-28 19:32:59 -040031 :class:`~rbac_exceptions.RbacOverPermissionException` exception
32 getting thrown.
Masayuki Igawa80b9aab2018-01-09 17:00:45 +090033 * Expected result is ``True`` and the test fails. This results in a
Felipe Monteirof16b6b32018-06-28 19:32:59 -040034 :class:`~rbac_exceptions.RbacOverPermissionException` exception
35 getting thrown.
Felipe Monteiroc8ec1f62017-11-15 08:32:56 +000036
Masayuki Igawa80b9aab2018-01-09 17:00:45 +090037 For example, a 200 from the API call and a ``False`` result from
38 ``oslo.policy`` or a 403 from the API call and a ``True`` result from
39 ``oslo.policy`` are failing results.
Felipe Monteiroc8ec1f62017-11-15 08:32:56 +000040
41-------------------------------
42The RBAC Rule Validation Module
43-------------------------------
44
45High-level module that provides the decorator that wraps around Tempest tests
46and serves as the entry point for RBAC testing validation. The workflow
47described above is ultimately carried out by the decorator.
48
49For more information about this module, please see :ref:`rbac-validation`.
50
51---------------------------
52The Policy Authority Module
53---------------------------
54
55Module called by :ref:`rbac-validation` to verify whether the test
56role is allowed to execute a policy action by querying ``oslo.policy`` with
57required test data. The result is used by :ref:`rbac-validation` as the
58"Expected" result.
59
60For more information about this module, please see :ref:`policy-authority`.
61
62---------------------
63The RBAC Utils Module
64---------------------
65
66This module is responsible for handling role switching, the mechanism by which
67Patrole is able to set up, tear down and execute APIs using the same set
68of credentials. Every RBAC test must perform a role switch even if the role
69that is being switched to is admin.
70
71For more information about this module, please see :ref:`rbac-utils`.