<expression>
<privileges>
<runAsRef oid="..." type="UserType"/> (1)
<runPrivileged>true</runPrivileged> (2)
</privileges>
<script>
<code>
// here we could execute actions that require elevated privileges
... midpoint.getObject(...) ...
... midpoint.searchObjects(...) ...
</code>
</script>
</expression>
Privilege Elevation (runAsRef, runPrivileged)
Since 4.8
This functionality is available since version 4.8.
|
Introduction
Sometimes we need a given expression (e.g., in mappings) to run under elevated privileges and/or a specific principal.
Implementation
1 | Switches the identity of the principal |
2 | Keeps the identity, elevates only the privileges |
The <runAsRef>
directive has been present since 3.6.
It works well but takes some time as it requires the login of the specified principal.
The new <runPrivileged>
property is much faster: it simply adds #all
authorization to the current principal.
Usually, either one of these should be used. However, it is possible to use both: first, a specified principal is logged in, and then their privileges are elevated.
Auditing
The audit event record was enhanced by the following information:
Item | Meaning |
---|---|
|
The effective principal that was used to execute the action.
This is the subject whose authorizations were evaluated to determine whether the action is allowed or not.
Usually, it is the same as the initiator.
But, e.g., when |
|
Present if the effective privileges used to execute the operation differ or may differ from the regular (declared) privileges of the |
Value | Meaning |
---|---|
|
Privileges were elevated to some degree. It may or may not be the maximum degree (full authorization). Only if we are really sure, the "fullElevation" value is set. |
|
Privileges were elevated to the maximum degree, i.e. to full authorization. |
|
Privileges were reduced to some degree. |
|
Privileges were changed in a different way (maybe some reduced, others elevated). |
Limitations
-
The improved auditing works only with the native repository implementation.
-
If the
effectivePrivilegesModification
property is present, it does not mean that the effective privileges certainly differ from the declared ones. It just means that the elevation/reduction took place; and, as a result, there may be a difference. For example, it a user already has privileges equivalent to full privileges, and "run privileged" expression is evaluated, the result still may be marked withfullElevation
value. What is guaranteed, however, is that if this value is not present, then the action was executed with regular (declared) privileges of the principal.