= IND^2^UCE Policy Language Documentation - Version 3.2.46 Fraunhofer IESE :doctype: book :icons: font :source-highlighter: highlightjs :toc: left :toclevels: 4 :sectlinks: :stylesdir: ./css :stylesheet: ind2uce.css :linkcss: [[introduction]] = Introduction This documentation is about the definition of *privacy policies* regulating security-relevant system events. Currently, our policy language supports the declaration of the following features: * Inhibition of system events * Modification of system events * Execution of compensating actions * Time interval based executions of mechanisms (cron jobs) Policies are based on Boolean logic and can make use of: * Data contained in the monitored event * External data sources (e.g. LDAP) * The history of events A *policy* consists of one or more *mechanisms*. Mechanisms are based on the *Event-Condition-Action* (ECA) schema: If a system *event E* (<<>>) is fetched and *condition C* (< , >>) is satisfied, then *action A* (<, >>) is performed. The IND^2^UCE framework follows a blacklisting approach. Events that are not covered by policies are allowed by default. .Example IND^2^UCE security policy: The following policy translates to "Inhibit event getTransactions if the external information source getCurrentHour returns a value below or equal to 15" [source,xml] ---- ---- [[language-elements]] = Language Elements [[policy]] == policy The ** tag is the root element of an IND²UCE security policy. It has the following attributes: [options='header'] |====================================================================================================================================== |Attribute |Type |Required |Meaning |id |URN |yes |The id of the policy, which must be unique. The id syntax is urn:policy::. The matches your solution ID and defines the range of effect. The uniquely identifies the policy within the scope. |name |String |no |A short name for the policy. |description |String |no |A natural language description of the security policy. |====================================================================================================================================== The ** tag must have at least one <>> child and can optionally contain <> children. .Example: The following policy describes the basic policy structure [source,xml] ---- ... ... ---- [[mechanism]] == mechanism The ** describes a rule of a policy based on a monitored or intercepted event. Depending on the policy specification and evaluation, the intercepted event can be allowed (event is released and executed normally), modified (the event is changed according to the modifiers specified in the mechanism before it is executed) or inhibited (the event is dropped and will not be executed). If an event that is matching the event declaration is intercepted by a PEP, the event is sent to the PDP. The PDP checks whether the condition is satisfied. If it is satisfied, the specified action is the decision of the PDP and will be enforced by the corresponding PEP. An action of a non-satisfied condition will never be executed. The ** element has the following attributes: [options='header'] |====================================================================================================================================== |Attribute |Type |Required |Meaning |event |PepEvent |Yes |Specifies the event by which the mechanism is triggered and for which the mechanism provides a security rule. The event id follows this pattern: urn:action:: |id |String |no |A unique id for the mechanism, used for logging purposes only. |description |String |no |A natural language description of the mechanism. |====================================================================================================================================== A ** can have the following child elements: * <>>: A condition that leads to an authorization decision if it matches * <>>: A condition that leads to an authorization decision if it matches and the previous if's did not match * <>>: A condition that leads to an authorization decision if none of the previous if's matched * <>>: The unconditional execution of an action .Policy Specification Rules [CAUTION] =============================== * The child element <>> is mandatory and only allowed to be used once within a <>>. * The child element <>> is optional but only allowed to be used once within a <>> also. * The child elements <>> and <>> may be used multiple times. =============================== .Policy Evaluation Rules [IMPORTANT] =============================== * A specified <>> inside the <>> tag is triggered by the event, independently from the satisfaction of a condition. =============================== .Example: The following policy inhibits access to accounts and loggs the action [source,xml] ---- ---- [[if_elseif]] == if, elseif The ** and the ** elements declare the condition that is evaluated each time the mechanism fires. A condition can have the following child elements: * A boolean-function (e.g. <>>, <>>) * <>>: An authorization decision that the mechanism evaluates to if the condition matches .Policy Specification Rules [CAUTION] =============================== * The and the must have exactly two child elements. One of these is the <>>. For more complex conditions, the Boolean operators (<>>, <>>, etc.) need to be used. =============================== .Policy Evaluation Rules [IMPORTANT] =============================== * If the condition is not satisfied, then the first condition will be evaluated. * Only the one action specified in the element of the *first* satisfied or condition will be executed. * If no condition is satisfied, then the action defined in the element will be executed. * If no condition is satisfied and no element is specified, then the default action will be executed, which is . =============================== .Example: Prohibits access to transactions after 3pm and loggs access to transactions between 2pm and 3pm [source,xml] ---- ---- [[then_else]] == then, else If the condition ( or ) is satisfied, the authorization decision has to be defined. Therefore you can use the <>> element. The two elements can have the following child elements: * <>>: The event will be allowed and executed * <>>: The event will be inhibited and not executed * <>>: The event is modified before execution * <>>: Independent of the event allowance, additional actions are executed .Policy Specification Rules [CAUTION] =============================== * The and the elements must have at least one child element. * Only one from the elements , and must be chosen. * If none of the elements , and is specified, an implicit is executed. =============================== .Example: If role is banker *then* allow the event "get transactions" *else* inhibit [source,xml] ---- ---- [[allow, inhibit]] === allow, inhibit The ** tag is part of a positive authorization decision. It informs the PEP that the intercepted event can be released for reaching its destination. The ** tag is part of a negative authorization decision. It informs the PEP that the intercepted event must be dropped so that it never reaches its destination. A reason can be added to both elements: [options='header'] |====================================================================================================================================== |Attribute |Type |Required |Meaning |reason |String |no |The description of the authorisation reason. |====================================================================================================================================== .Example: If role is banker then *allow* the event "get transactions" else *inhibit* [source,xml] ---- ---- [[modify]] === modify The ** element is used to specify event modifications that the PEP must enforce before releasing the intercepted event. It has the following attributes: [options='header'] |====================================================================================================================================== |Attribute |Type |Required |Meaning |eventParameter |String |yes |The name of the parameter that should be modified. |method |String |yes |The name of the modification that should be applied (e.g., delete, anonymize). This depends on the capabilities of the PEP. Available modifier methods can be checked in your component overview and proposed by the policy editor. |jsonPathQuery |String |no |If the parameter contains a complex object, modifications can be applied to specific parts of the data structure. For example a query "$firstName" of a parameter "user" will result in the modification of the first name of the user object only. Please refer to http://goessner.net/articles/JsonPath/ for more information about JsonPath. |reason |String |no |The description why the event is modified. |====================================================================================================================================== Child elements can be all elements of the <>. The mandatory and optional parameters depend on the selected modifier method. .Example: Replace the bank code number before showing it [source,xml] ---- ---- .JSONPath [TIP] =============================== * JSONPath is an instrument to query JSON structures. JSONPath uses special notation to represent nodes and their connections to adjacent nodes in a JsonPath path. * Notation to get the value of a transaction: $.transactions.amount.value =============================== [[execute]] == execute Execute Actions are compensating actions that security policies can trigger in the system. They are specified using the ** tag. Execute actions return a Boolean value indicating the execution success. [options='header'] |====================================================================================================================================== |Attribute |Type |Required |Meaning |action |String |yes | The action to be executed. |====================================================================================================================================== Child elements can be all elements of the <>. They serve as input parameters for the corresponding execution function. The mandatory and optional parameters depend on the selected execute action. .Example: Replace the account information before showing it and log the event [source,xml] ---- ---- [[number-functions]] == number functions The following elements process numbers: * * * * * // * The functions *, , * and ** are used to perform the arithmetical operations (addition, subtraction, multiplication, division). These four functions don't have any attributes. Every element which has a number as return value or is a number function can be used as a child element (e.g. , , ). .Policy Specification Rules [CAUTION] =============================== * , , and must have at least two child elements. =============================== The ** function is used to count the number of elements in a list or the number of characters in a string. It doesn't have any attributes, either. You can assign all child elements with a list return value or a <>> or <>> element. .Policy Specification Rules [CAUTION] =============================== * must have at least one child element. =============================== //// The ** function is used to count the number of event occurrences in a certain time or time range. A detailed description is written under the section <>. .Example: Inhibits access to transactions if the event get-transactions and get-money was fired more than 20 times today ---- ---- //// [[boolean-functions]] == boolean functions The boolean functions are needed to process boolean values or compare and evaluate other values. The functions can be divided into three different groups: The following elements are used to compare numbers, strings, objects, lists and boolean: * (number, string, object, list, boolean) * (number) * (number) * (number) * (number) These elements are used to aggregate boolean expressions: * * * * * Further boolean functions are: // * : evaluates if a value has changed to true or false // * : return true if value is unchanged * : evaluates whether the value of the child elements match a given regular expression * : evaluates whether the declared values are contained in e.g a list * : evaluates whether the event contains a specified parameter * : triggers an action in the system and returns a boolean value indicating the execution success // * : evaluates if an event occurs more than one time in a certain time frame === less, lessEqual, greater, greaterEqual, equals The functions *, , * and ** are used to compare different numbers. For instance if you want to compare the current time with a constant number. These functions don't have attributes and child elements can be elements with a number return value (like <>>) and the <>. The function ** is different, because besides numbers other values can be compared with each other. For example, it is possible to compare strings like a constant string and a user name. ** doesn't have an attribute, either. And besides child elements with a number return value, also elements with string, object, list and boolean return value as well as boolean-functions can be added to . .Policy Specification Rules [CAUTION] =============================== * The elements , , , and must have at least two child elements. * The order is essential, e.g. for the child elements values A, B and C specified in this order, the ** element evaluates A < B < C. * In all child values have to be the same. (It is only possible to compare number with number, string with string,...). =============================== //// .Example: Inhibit the event "get transactions" if the event already occurred more than 10 times today ---- ---- //// === and, or, xor, implies, not The elements *, , , * and ** aggregate the values of the child elements according to Boolean logic. The following attribute can be added, if it's not added the evaluation is only done, when it's necessary. [options='header'] |====================================================================================================================================== |Attribute |Type |Default Value |Required |Meaning |mode |String |LAZY |no | It is possible to choose the mode lazy or eager. Lazy means that an evaluation is executed if it is needed. Eager means that the evaluation is executed also if it isn't needed. |====================================================================================================================================== Child elements can be all elements with boolean return value (e.g. , ) or elements of the <,boolean-functions>>. .Policy Specification Rules [CAUTION] =============================== * The *, , * and ** elements must have at least one child element. * The ** element must have exactly one child element. =============================== .Example: Inhibit transaction if user has id 1 *and* the transaction amount value is greater than 10.000 ---- ---- //// === valueChanged, valueUnchanged When using the ** and ** function, the system checks if the return value of the child has changed between the last evaluation cycle and this evaluation cycle to the value defined in the attribute. The ** element only returns true if the value is changed. However, the ** element only returns true if the value didn't change between the last evaluation cycle and the current cycle. The *valueChanged* and *valueUnchanged*'s child element can be <> and elements with boolean return value. ** doesn't have an attribute, because it's expected that the value didn't change to another value. However, ** has the following required attribute: [options='header'] |====================================================================================================================================== |Attribute |Type |Required |Meaning |to |Boolean |yes | Defines if the value of the child element changed to true or false. |====================================================================================================================================== Child elements can be all elements with boolean return value (e.g. , ) or elements of the <,boolean-functions>>. .Policy Specification Rules [CAUTION] =============================== * The and element must have exactly one child. =============================== .Example: As soon as the event don't have the parameter simpleusers (the value changed to false) inhibit the event ---- ---- //// === regex A regular expression (regex) is a formal language to describe a certain pattern or a sequence of characters. If the regex pattern matches to the child-elements value the element returns true otherwise it would return false. The ** element has the following attributes: [options='header'] |====================================================================================================================================== |Attribute |Type |Default Value |Required |Meaning |regex |String |- |yes |The String defines the regex that is applied for matching the values of child elements. |mode |enum |ALL |no |The mode declares how many child element must match. Possible modes are ALL, EXACTLY_ONE, AT_LEAST_ONE, NONE. |====================================================================================================================================== A ** can have the child elements with string return value and elements from the <>. .Policy Specification Rules [CAUTION] =============================== * The element must have at least one child. =============================== .Policy Evaluation Rules [IMPORTANT] =============================== * The ** element has four evaluation modes: ** ALL: Regex must match all of the child element values. ** EXACTLY_ONE: Regex must match exactly one of the child element values, but not more than one. ** AT_LEAST_ONE: Regex must at least match one of the child element values. ** NONE: Regex must not match any of the child element values. =============================== .Example: If the transaction prupose matches to "Gehalt", "Lohn", "salary" or "pay" than replace the amount ---- ---- === contains The element can be used to verify if one or several element values contain another value. For instance, to verify if the string "Policy Language" contains the string "Policy". A element has the following attribute: [options='header'] |====================================================================================================================================== |Attribute |Type |Default Value |Required |Meaning |mode |enum |ALL |no |The mode declares how many child element must match. Possible modes are ALL, EXACTLY_ONE, AT_LEAST_ONE, NONE. |====================================================================================================================================== Because ** evaluates strings, numbers, lists, objects and booleans every element which returns these values can be added as child elements. Additionally all elements of <>, <> and <> can be added. .Policy Specification Rules [CAUTION] =============================== * The ** element must have at least two child elements * The order is essential, e.g. for the child elements values A, B and C specified in this order, the ** element evaluates if A contains B and C. * In all child values have to be the same. (It is only possible to compare number with number, string with string,...). =============================== .Policy Evaluation Rules [IMPORTANT] =============================== * The ** element has four evaluation modes: ** ALL: The first value must match all of the following element values. ** EXACTLY_ONE: The first value must match exactly one of the following element values, but not more than one. ** AT_LEAST_ONE: The first value must at least match one of the following element values. ** NONE: The first value must not match any of the following element values. =============================== .Example: If the iban contains a "GB" or "FR" (iban from France or Great Britain) than replace the account owner ---- ---- === eventHasParameter To check if an event has a certain parameter the ** element can be used. Like the and the element the has the following mode attribute: options='header'] |====================================================================================================================================== |Attribute |Type |Default Value |Required |Meaning |mode |enum |ALL |no |The mode declares how many child element must match. Possible modes are ALL, EXACTLY_ONE, AT_LEAST_ONE, NONE. |====================================================================================================================================== Because only evaluates strings it can only have child elements which return string values. .Policy Specification Rules [CAUTION] =============================== * The ** element must have at least one child element =============================== .Policy Evaluation Rules [IMPORTANT] =============================== * The ** element has four evaluation modes: ** ALL: All child element values have to be an event parameter. ** EXACTLY_ONE: Exactly one child element value has to be an event parameter, but not more than one. ** AT_LEAST_ONE: At least one child element value has to be an event parameter. ** NONE: No child element value has to be a event parameter. =============================== .Example: Log event if user id is empty (event has no parameter $.id) ---- ---- //// === continuousOccurrence With the ** element it is possible to evaluate if an event occurred during a certain time interval or since a certain time for example. Because the return value is a boolean value it is assigned to the boolean-functions. However, a detailed documentation about can be found under the <>. //// [[string-functions]] == string functions The following element processes strings: * ** concatenates all values of child elements to a string. The concat-function doesn't have an attribute. It is possible to add all child elements which return a string, number, object, list or boolean or belong to the <>, <> or <>. .Policy Specification Rules [CAUTION] =============================== * The ** element must have at least one child element =============================== .Example: This policy prevents showing data if complete employee name is not on the list of priviledged employees ---- ---- //// [[time-elements]] == time-elements For the evaluation of system events in a certain time interval, it is necessary to be able to express different time specifications. The time-elements are used to express these time specifications. The elements *, * and **, on the other hand, are used to evaluate these times. The following elements are used to express times (specific times): * thisMinute * lastMinute * thisHour * lastHour * today * yesterday * thisWeek (this week from Monday to Sunday) * lastWeek (last week from Monday to Sunday) * thisSunWeek (this week from Sunday to Saturday) * lastSunWeek (last week from Sunday to Saturday) * thisMonth * lastMonth * thisYear * lastYear Special cases are: * start * end === specific times For evaluations for specific period of time the time-elements can be used. For example if you want to evaluate the amount of fired events within the last hour, the element can be used. .Policy Specification Rules [CAUTION] =============================== * The time-elements doesn't have child elements nor attributes (except for the and ). =============================== .Example: Inhibit action if event get-money was already fired more than 15 times in this minute ---- ---- === start and end To execute an evaluation which only considers events which were fired starting at or before a certain point of time the ** and ** can be used. The and elements have the following attribute: [options='header'] |====================================================================================================================================== |Attribute |Type |Required |Meaning |time |cron |yes |Declares the point in time for start or end. |====================================================================================================================================== and doesn't need to have a child element, although it is possible to add one <>> element. If or has a child element it means that the system evaluates the time interval since the first or the last event occurrence. .Policy Specification Rules [CAUTION] =============================== * The and elements can have at maximum one child element. =============================== .Example: Inhibit action if event get-money was already fired more than 15 times since 01.01.2018 ---- ---- == count The ** function is used to count the number of event Occurrences in a certain time or time interval. With it is possible to express the cardinal and temporal aspects of the policy language. For instance, if you need to count the number of eventOccurrences within the last minute you can use the element . Therefore, it is necessary to specify the event with the eventOccurrence child element and the time with one of the <>. .Policy Specification Rules [CAUTION] =============================== * The elements must have exactly one eventOccurrence and one of the <> (or two if they are and ) as child elements. =============================== .Example: Inhibit action if event get-money was already fired more than 15 times since 01.01.2018 ---- ---- == continuousOccurrence With the ** element it is possible to evaluate, if an event occurred during a certain time interval or since a certain time for example. As well as it covers the cardinal and temporal aspects of the policy language. But unlike it checks if the event occurred continuously (once or more than once) and returns a boolean. is needed to express 'during', 'always' or 'since' for example. These are the attributes: options='header'] |====================================================================================================================================== |Attribute |Type |Required |Meaning |interval |String |yes |The interval declares the time interval in which an event has to occur to fulfill the condition. |minOccurrences |number |no |Declares the minimum number of occurrences until the condition is fulfilled. |maxOccurrences |number |no |Declares the maximum number of Occurrences that the condition is fulfilled. |====================================================================================================================================== Child elements can be all elements of the <> and the element. With the child the evaluated event is determined. .Policy Specification Rules [CAUTION] =============================== * The elements must have exactly one eventOccurrence and one of the <> (or two if they are and ) as child elements. =============================== .Example: If the user was not notified at least one time every day since thisWeek the event has to be inhibited ---- ---- [[eventOccurrence]] == eventOccurrence The element is used to evaluate how many times a event was fired. is needed to specify the event. For example is needed if a system event should be inhibited if an event already occurred several times this week. The element has the following attributes: [options='header'] |====================================================================================================================================== |Attribute |Type |Required |Meaning |event |String |yes |Declares the event. The event id follows this pattern: urn:action:_scope_:_identifier_ |mode |String |no |Possible values are "FIRST" or "LAST", to get the first or last eventOccurrence. |====================================================================================================================================== The can have the elements from the <>. .Example: If the event occured more than 100 times this month than the event has to be inhibited ---- ---- //// [[parameter-group]] == parameter-group The parameter elements are used for parameterizing PIP's of type string, number, object, list or boolean and for modifying and executing actions. Each element returns its value. The following parameter-elements are available: * * * * * The elements have the following attributes: [options='header'] |====================================================================================================================================== |Attribute |Type |Required |Meaning |name |String |yes |The name of the parameter. |value |String |no, unless the parameter element doesn't have a child element |The value of the parameter. |====================================================================================================================================== Depending on the return value there can be added diverse child elements. For ** and ** you can add the following elements: * all elements of <> * all elements of <> * all elements of <> * all elements of <> * all elements of <> For ** you can add the following elements: * all elements with number return value (, , ) * all elements of <> For ** you can add the following elements: * all elements with list return value ( , , ) For ** you can add the following elements: * all elements with boolean return value (e.g. ,,) * all elements of <> .Example: When Role of User is Manager, then allow event ---- ---- [[pip-group]] == pip-group The pip elements are used to request information from a PIP. Each element returns their value (String, number, object, list, boolean). The parameters that can be added as child elements are sent to the PIP as request parameters. The following pip elements are available: * * * * * The elements have the following attributes: [options='header'] |====================================================================================================================================== |Attribute |Type |Default Value |Required |Meaning |method |String |- |yes |The name of a PIP method. |default |depends on pip type (string, number, boolean) |- |yes |The value that is returned if the PIP is not reachable. |ttl |time interval notation |- |no |The "time to live" value sets the time interval that the response value of the PIP is cached. The ttl has a special notation, for example if the pip value should be cached for 1 week, 4 days and 2 hours it would look like "1w4d2h". |====================================================================================================================================== All elements of the <> can be child elements. .Policy Evaluation Rules [CAUTION] =============================== * During the "time to live" caching time interval, the pip-elements only returns the cached value. When the time to live has elapsed, the cache is refreshed by the current value retrieved by the PIP for the next interval. * If the "time to live" caching time interval is not set, then the PIP is requested on each PIP element evaluation. =============================== .Example: If logged User has Role Banker then replace transactions with XXX ---- ---- [[event-group]] == event-group The event elements are used to get parameter values from the event. The following event elements are available: * * * * * The elements have the following attributes: [options='header'] |====================================================================================================================================== |Attribute |Type |Required |Meaning |eventParameter |String |yes |The name of an event parameter. |default |depends on pip type (string, number, boolean) |yes |The value that is returned if the event is not reachable. |jsonPathQuery |String |no |The JSONPath expression to be executed on the parameter value, if the value is a complex object. Please refer to http://goessner.net/articles/JsonPath/ for more information about JsonPath. |====================================================================================================================================== .Example: If customerId is 1 then replace transactions with XXX ---- ---- .JSONPath [TIP] =============================== * JSONPath is an instrument to query JSON structures. JSONPath uses special notation to represent nodes and their connections to adjacent nodes in a JsonPath path. * Notation to get the value of a transaction: $.transactions.amount.value =============================== [[constant-group]] == constant-group The constant elements are used for defining a string, number, object, list or boolean constant that returns the specified value. The following constant elements are available: * * * * * * * The constant elements (except true and false) have the following attributes: [options='header'] |====================================================================================================================================== |Attribute |Type |Required |Meaning |value |depends on constant type (string, number, boolean) |yes |The value of the constant. |====================================================================================================================================== .Example: If Role is Banker, then inhibit action ---- ---- [[variableDeclaration-group]] == variableDeclaration-group A element can have an unlimited number of variableDeclaration elements. These tags define a variable, which might be used several times in a policy. The following variableDeclaration-elements can be used: * * * * * Every element returns the specific value (e.g. string, number). The declaration elements have the following attributes: [options='header'] |====================================================================================================================================== |Attribute |Type |Required |Meaning |name |String |yes |The reference name to use the declaration. |====================================================================================================================================== The following child elements can be added for **: * all elements from <> * all elements from <> * all elements from <>> * all elements from <> * all elements from <> * all elements from <> * all elements from <> The following child elements can be added for **: * all elements with number return value (eg. , ) * all elements from <> The following child elements can be added for **: * all elements with boolean return value (eg. , , ) * all elements from <> The following child elements can be added for **: * all elements with object return value (eg. , ) The following child elements can be added for **: * all elements with list return value (eg. , ) .Example: If event 'get-bankusers' is fired and logeed user is a customer then inhibit action, if event 'getTransactions' is fired and logged user is a banker then modify the values ---- ---- [[variable-group]] == variable-group The variable elements are used as references to the variableDeclaration elements. They return their specific value: * * * * * Every element has the reference attribute: [options='header'] |====================================================================================================================================== |Attribute |Type |Required |Meaning |reference |String |yes |The reference name to the <>>. |====================================================================================================================================== .Example: If logeed user is a customer then inhibit action ---- ---- //// [[timer]] == timer With a it is possible to fire events in a specified interval, independent from an actual event occurrence. A must contain at least one <>> element. A can have the following attributes: [options='header'] |====================================================================================================================================== |Attribute |Type |Required |Meaning |cron |cron |yes |Describes the time interval to fire an event. |description |String |no |Description of the timer. |====================================================================================================================================== [[timeEvent]] == timeEvent A declares the event which should be fired from PMP to PDP in a specified time interval. Child elements can be elements from <>. The has the following attribute: [options='header'] |====================================================================================================================================== |Attribute |Type |Required |Meaning |action |String |yes |Defines the event id. |====================================================================================================================================== ////