summaryrefslogtreecommitdiff
path: root/test/common
diff options
context:
space:
mode:
Diffstat (limited to 'test/common')
-rw-r--r--test/common/examples_policies/vsomeip/0_0/vsomeip_security.json255
-rw-r--r--test/common/examples_policies/vsomeip/4002200_4002200/vsomeip_security.json1556
-rw-r--r--test/common/examples_policies/vsomeip/4002201_4002201/vsomeip_security.json122
-rw-r--r--test/common/examples_policies/vsomeip/4002205_4002205/vsomeip_security.json54
-rw-r--r--test/common/examples_policies/vsomeip/4003013_4003011/vsomeip_security.json64
-rw-r--r--test/common/examples_policies/vsomeip/4003014_4003014/vsomeip_security.json1306
-rw-r--r--test/common/examples_policies/vsomeip/4003015_4003015/vsomeip_security.json82
-rw-r--r--test/common/examples_policies/vsomeip/4003016_4003016/vsomeip_security.json63
-rw-r--r--test/common/examples_policies/vsomeip/vsomeip_policy_extensions.json1
-rw-r--r--test/common/examples_policies/vsomeip/vsomeip_security.json25
-rw-r--r--test/common/utility.cpp235
-rw-r--r--test/common/utility.hpp77
12 files changed, 3840 insertions, 0 deletions
diff --git a/test/common/examples_policies/vsomeip/0_0/vsomeip_security.json b/test/common/examples_policies/vsomeip/0_0/vsomeip_security.json
new file mode 100644
index 0000000..ab1b06b
--- /dev/null
+++ b/test/common/examples_policies/vsomeip/0_0/vsomeip_security.json
@@ -0,0 +1,255 @@
+{
+ "security": {
+ "policies": [
+ {
+ "credentials": {
+ "gid": "0",
+ "uid": "0"
+ },
+ "deny": {}
+ },
+ {
+ "deny": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0x40"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "9999",
+ "uid": "9999"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf913"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4003015",
+ "uid": "0"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf91b"
+ },
+ {
+ "instance": "any",
+ "service": "0xf913"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4002200",
+ "uid": "4002200"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf913"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4003014",
+ "uid": "4003014"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf913"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4003015",
+ "uid": "4003015"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf913"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "5004",
+ "uid": "4003021"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf91f"
+ },
+ {
+ "instance": "any",
+ "service": "0xf8c7"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4003024",
+ "uid": "4003024"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf913"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4003025",
+ "uid": "4003025"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf913"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4003026",
+ "uid": "4003026"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf91f"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4003029",
+ "uid": "4003029"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf913"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4003031",
+ "uid": "4003031"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xb025"
+ },
+ {
+ "instance": "any",
+ "service": "0xb024"
+ },
+ {
+ "instance": "any",
+ "service": "0xb021"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4004200",
+ "uid": "4004201"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf91f"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4013201",
+ "uid": "4013201"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf91f"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4013210",
+ "uid": "4013210"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf91b"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4017205",
+ "uid": "4017205"
+ }
+ },
+ {
+ "credentials": {
+ "allow": [
+ {
+ "gid": [
+ "4002200",
+ "4003014"
+ ],
+ "uid": [
+ "4002200",
+ "4003014"
+ ]
+ }
+ ]
+ }
+ }
+ ]
+ }
+}
diff --git a/test/common/examples_policies/vsomeip/4002200_4002200/vsomeip_security.json b/test/common/examples_policies/vsomeip/4002200_4002200/vsomeip_security.json
new file mode 100644
index 0000000..221d035
--- /dev/null
+++ b/test/common/examples_policies/vsomeip/4002200_4002200/vsomeip_security.json
@@ -0,0 +1,1556 @@
+{
+ "security": {
+ "policies": [
+ {
+ "allow": {
+ "offers": [
+ {
+ "instance": "any",
+ "service": "0xf8a3"
+ },
+ {
+ "instance": "any",
+ "service": "0xf8ac"
+ },
+ {
+ "instance": "any",
+ "service": "0x102d"
+ },
+ {
+ "instance": "any",
+ "service": "0x102e"
+ },
+ {
+ "instance": "any",
+ "service": "0xf8a5"
+ },
+ {
+ "instance": "any",
+ "service": "0xf8a7"
+ },
+ {
+ "instance": "any",
+ "service": "0xf8a1"
+ },
+ {
+ "instance": "any",
+ "service": "0x1023"
+ },
+ {
+ "instance": "any",
+ "service": "0xf8aa"
+ },
+ {
+ "instance": "any",
+ "service": "0xf8a0"
+ },
+ {
+ "instance": "any",
+ "service": "0xf8a2"
+ },
+ {
+ "instance": "any",
+ "service": "0x1002"
+ },
+ {
+ "instance": "any",
+ "service": "0xf8ab"
+ },
+ {
+ "instance": "any",
+ "service": "0xf8a4"
+ }
+ ],
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf91c"
+ },
+ {
+ "instance": "any",
+ "service": "0xfea8"
+ },
+ {
+ "instance": "any",
+ "service": "0xfe8c"
+ },
+ {
+ "instance": "any",
+ "service": "0xf91b"
+ },
+ {
+ "instance": "any",
+ "service": "0x101c"
+ },
+ {
+ "instance": "any",
+ "service": "0xfe9c"
+ },
+ {
+ "instance": "any",
+ "service": "0xb51a"
+ },
+ {
+ "instance": "any",
+ "service": "0xfeaa"
+ },
+ {
+ "instance": "any",
+ "service": "0xb510"
+ },
+ {
+ "instance": "any",
+ "service": "0xfa60"
+ },
+ {
+ "instance": "any",
+ "service": "0xf917"
+ },
+ {
+ "instance": "any",
+ "service": "0xfeac"
+ },
+ {
+ "instance": "any",
+ "service": "0xfe87"
+ },
+ {
+ "instance": "any",
+ "service": "0xfe8a"
+ },
+ {
+ "instance": "any",
+ "service": "0xfe86"
+ },
+ {
+ "instance": "any",
+ "service": "0xfe88"
+ },
+ {
+ "instance": "any",
+ "service": "0xfeab"
+ },
+ {
+ "instance": "any",
+ "service": "0xfe9d"
+ },
+ {
+ "instance": "any",
+ "service": "0xfea3"
+ },
+ {
+ "instance": "any",
+ "service": "0xfea6"
+ },
+ {
+ "instance": "any",
+ "service": "0xfe8e"
+ },
+ {
+ "instance": "any",
+ "service": "0xfe9f"
+ },
+ {
+ "instance": "any",
+ "service": "0xfe92"
+ },
+ {
+ "instance": "any",
+ "service": "0xb519"
+ },
+ {
+ "instance": "any",
+ "service": "0xfe8d"
+ },
+ {
+ "instance": "any",
+ "service": "0xfe83"
+ },
+ {
+ "instance": "any",
+ "service": "0xfeae"
+ },
+ {
+ "instance": "any",
+ "service": "0xfe81"
+ },
+ {
+ "instance": "any",
+ "service": "0xfe98"
+ },
+ {
+ "instance": "any",
+ "service": "0xfe85"
+ },
+ {
+ "instance": "any",
+ "service": "0xfea7"
+ },
+ {
+ "instance": "any",
+ "service": "0xfea1"
+ },
+ {
+ "instance": "any",
+ "service": "0xfead"
+ },
+ {
+ "instance": "any",
+ "service": "0xfe93"
+ },
+ {
+ "instance": "any",
+ "service": "0xfe8b"
+ },
+ {
+ "instance": "any",
+ "service": "0xfea5"
+ },
+ {
+ "instance": "any",
+ "service": "0x1534"
+ },
+ {
+ "instance": "any",
+ "service": "0xfeaf"
+ },
+ {
+ "instance": "any",
+ "service": "0xf912"
+ },
+ {
+ "instance": "any",
+ "service": "0x1506"
+ },
+ {
+ "instance": "any",
+ "service": "0xfe90"
+ },
+ {
+ "instance": "any",
+ "service": "0x101d"
+ },
+ {
+ "instance": "any",
+ "service": "0xfea9"
+ },
+ {
+ "instance": "any",
+ "service": "0xf911"
+ },
+ {
+ "instance": "any",
+ "service": "0x1001"
+ },
+ {
+ "instance": "any",
+ "service": "0xfe9a"
+ },
+ {
+ "instance": "any",
+ "service": "0xfe97"
+ },
+ {
+ "instance": "any",
+ "service": "0x9001"
+ },
+ {
+ "instance": "any",
+ "service": "0xf913"
+ },
+ {
+ "instance": "any",
+ "service": "0xfe9e"
+ },
+ {
+ "instance": "any",
+ "service": "0xb513"
+ },
+ {
+ "instance": "any",
+ "service": "0xfeb0"
+ },
+ {
+ "instance": "any",
+ "service": "0xf901"
+ },
+ {
+ "instance": "any",
+ "service": "0xf902"
+ },
+ {
+ "instance": "any",
+ "service": "0xfe89"
+ },
+ {
+ "instance": "any",
+ "service": "0xfe82"
+ },
+ {
+ "instance": "any",
+ "service": "0x1536"
+ },
+ {
+ "instance": "any",
+ "service": "0x1531"
+ },
+ {
+ "instance": "any",
+ "service": "0xfea4"
+ },
+ {
+ "instance": "any",
+ "service": "0xfe9b"
+ },
+ {
+ "instance": "any",
+ "service": "0xfe99"
+ },
+ {
+ "instance": "any",
+ "service": "0xfe95"
+ },
+ {
+ "instance": "any",
+ "service": "0xfe84"
+ },
+ {
+ "instance": "any",
+ "service": "0xfea2"
+ },
+ {
+ "instance": "any",
+ "service": "0xfe91"
+ },
+ {
+ "instance": "any",
+ "service": "0xfe94"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4002200",
+ "uid": "4002200"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8a0"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "0",
+ "uid": "0"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8a4"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4003015",
+ "uid": "0"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8a1"
+ },
+ {
+ "instance": "any",
+ "service": "0xf8a4"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4003011",
+ "uid": "4003013"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8a0"
+ },
+ {
+ "instance": "any",
+ "service": "0xf8a2"
+ },
+ {
+ "instance": "any",
+ "service": "0xf8a4"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4003014",
+ "uid": "4003014"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8a4"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4003015",
+ "uid": "4003015"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8a1"
+ },
+ {
+ "instance": "any",
+ "service": "0xf8a0"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4003025",
+ "uid": "4003025"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8a1"
+ },
+ {
+ "instance": "any",
+ "service": "0xf8a0"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4003026",
+ "uid": "4003026"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8a0"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4003029",
+ "uid": "4003029"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8a0"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4003031",
+ "uid": "4003031"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8a3"
+ },
+ {
+ "instance": "any",
+ "service": "0xf8a0"
+ },
+ {
+ "instance": "any",
+ "service": "0xf8a4"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4003205",
+ "uid": "4003205"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8a0"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4004200",
+ "uid": "4004201"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8a0"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4005300",
+ "uid": "4005204"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8a1"
+ },
+ {
+ "instance": "any",
+ "service": "0xf8a0"
+ },
+ {
+ "instance": "any",
+ "service": "0xf8a4"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4006200",
+ "uid": "4006200"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8a1"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4006201",
+ "uid": "4006201"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8a0"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4006202",
+ "uid": "4006202"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8a1"
+ },
+ {
+ "instance": "any",
+ "service": "0xf8a0"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4006220",
+ "uid": "4006220"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8a1"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4006221",
+ "uid": "4006221"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8a1"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4006241",
+ "uid": "4006241"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8a0"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4007200",
+ "uid": "4007200"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8a3"
+ },
+ {
+ "instance": "any",
+ "service": "0xf8a0"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4007210",
+ "uid": "4007210"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8a0"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4007211",
+ "uid": "4007211"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8a0"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4007212",
+ "uid": "4007212"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8a0"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4008300",
+ "uid": "4008200"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8a0"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4008300",
+ "uid": "4008203"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8a3"
+ },
+ {
+ "instance": "any",
+ "service": "0xf8a1"
+ },
+ {
+ "instance": "any",
+ "service": "0xf8a0"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4008303",
+ "uid": "4008205"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8a0"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4008305",
+ "uid": "4008207"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8a3"
+ },
+ {
+ "instance": "any",
+ "service": "0xf8aa"
+ },
+ {
+ "instance": "any",
+ "service": "0xf8a2"
+ },
+ {
+ "instance": "any",
+ "service": "0xf8a4"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4010200",
+ "uid": "4010200"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8a3"
+ },
+ {
+ "instance": "any",
+ "service": "0xf8a0"
+ },
+ {
+ "instance": "any",
+ "service": "0xf8a4"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4011201",
+ "uid": "4011201"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8a3"
+ },
+ {
+ "instance": "any",
+ "service": "0xf8a1"
+ },
+ {
+ "instance": "any",
+ "service": "0xf8a0"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4012300",
+ "uid": "4012200"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8a3"
+ },
+ {
+ "instance": "any",
+ "service": "0xf8a1"
+ },
+ {
+ "instance": "any",
+ "service": "0xf8ab"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4012300",
+ "uid": "4012201"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8a3"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4012300",
+ "uid": "4012230"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8a0"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4012300",
+ "uid": "4012240"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8a0"
+ },
+ {
+ "instance": "any",
+ "service": "0xf8a4"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4013201",
+ "uid": "4013201"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8a3"
+ },
+ {
+ "instance": "any",
+ "service": "0xf8a0"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4013202",
+ "uid": "4013202"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8a4"
+ },
+ {
+ "instance": "any",
+ "service": "0xf8a4"
+ },
+ {
+ "instance": "any",
+ "service": "0xf8a4"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "5501",
+ "uid": "4013203"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8a0"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "5510",
+ "uid": "4013206"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8a0"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4013209",
+ "uid": "4013209"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8a0"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4013213",
+ "uid": "4013213"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8a0"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4013214",
+ "uid": "4013214"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8a0"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4013215",
+ "uid": "4013215"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8a0"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4013217",
+ "uid": "4013217"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8a0"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4013218",
+ "uid": "4013218"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8a0"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4013219",
+ "uid": "4013219"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8a0"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4013223",
+ "uid": "4013223"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8a0"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4013225",
+ "uid": "4013225"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8a3"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4013229",
+ "uid": "4013229"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8a0"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "5510",
+ "uid": "4013232"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8a1"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4013233",
+ "uid": "4013233"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8a0"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4013234",
+ "uid": "4013234"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8a1"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4013242",
+ "uid": "4013242"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8a4"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4014201",
+ "uid": "4014201"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8a5"
+ },
+ {
+ "instance": "any",
+ "service": "0xf8a0"
+ },
+ {
+ "instance": "any",
+ "service": "0xf8a0"
+ },
+ {
+ "instance": "any",
+ "service": "0xf8a2"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4014300",
+ "uid": "4014300"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0x102d"
+ },
+ {
+ "instance": "any",
+ "service": "0xf8a1"
+ },
+ {
+ "instance": "any",
+ "service": "0xf8a0"
+ },
+ {
+ "instance": "any",
+ "service": "0xf8a2"
+ },
+ {
+ "instance": "any",
+ "service": "0xf8a4"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4014390",
+ "uid": "4014390"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8a1"
+ },
+ {
+ "instance": "any",
+ "service": "0xf8a4"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4015210",
+ "uid": "4015210"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8a0"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "5509",
+ "uid": "4016203"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8a3"
+ },
+ {
+ "instance": "any",
+ "service": "0xf8a1"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "5509",
+ "uid": "4016205"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8a1"
+ },
+ {
+ "instance": "any",
+ "service": "0xf8a2"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4017201",
+ "uid": "4017201"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8a1"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4017202",
+ "uid": "4017202"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8a4"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4017208",
+ "uid": "4017208"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8a1"
+ },
+ {
+ "instance": "any",
+ "service": "0xf8a2"
+ },
+ {
+ "instance": "any",
+ "service": "0xf8a4"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4017209",
+ "uid": "4017209"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8a1"
+ },
+ {
+ "instance": "any",
+ "service": "0xf8a4"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4017210",
+ "uid": "4017210"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8ac"
+ },
+ {
+ "instance": "any",
+ "service": "0xf8a1"
+ },
+ {
+ "instance": "any",
+ "service": "0xf8a0"
+ },
+ {
+ "instance": "any",
+ "service": "0xf8a4"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4017211",
+ "uid": "4017211"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8a1"
+ },
+ {
+ "instance": "any",
+ "service": "0xf8a4"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4017215",
+ "uid": "4017215"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8a1"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4017216",
+ "uid": "4017216"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8a1"
+ },
+ {
+ "instance": "any",
+ "service": "0xf8a2"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4017219",
+ "uid": "4017219"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8a1"
+ },
+ {
+ "instance": "any",
+ "service": "0xf8a2"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4017220",
+ "uid": "4017220"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8a4"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4017221",
+ "uid": "4017221"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8a1"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4018204",
+ "uid": "4018204"
+ }
+ },
+ {
+ "credentials": {
+ "allow": [
+ {
+ "gid": [
+ "4012300",
+ "4013225",
+ "4003031",
+ "4013201",
+ "4017219",
+ "4013202",
+ "4003014",
+ "4017221",
+ "4017201",
+ "4017211",
+ "4006200",
+ "4013213",
+ "4003026",
+ "4011201",
+ "4006220",
+ "4013218",
+ "4013217",
+ "0",
+ "4014300",
+ "4013215",
+ "4003019",
+ "4013207",
+ "4013211",
+ "4013223",
+ "4008303",
+ "4013220",
+ "4005300",
+ "4003205",
+ "4013219",
+ "4007210",
+ "4003024",
+ "4004200",
+ "4007234",
+ "4006202",
+ "5510",
+ "4013200"
+ ],
+ "uid": [
+ "4013232",
+ "4013225",
+ "4003031",
+ "4012201",
+ "4013201",
+ "4005202",
+ "4017219",
+ "4008205",
+ "4013202",
+ "4003014",
+ "4017221",
+ "4017201",
+ "4004201",
+ "4017211",
+ "4006200",
+ "4013213",
+ "4003026",
+ "4011201",
+ "4006220",
+ "4013218",
+ "4013217",
+ "4013206",
+ "0",
+ "4014300",
+ "4013215",
+ "4003019",
+ "4013207",
+ "4013211",
+ "4013223",
+ "4013220",
+ "4003205",
+ "4013219",
+ "4007210",
+ "4012240",
+ "4003024",
+ "4007234",
+ "4006202",
+ "4013200"
+ ]
+ }
+ ]
+ }
+ }
+ ]
+ }
+} \ No newline at end of file
diff --git a/test/common/examples_policies/vsomeip/4002201_4002201/vsomeip_security.json b/test/common/examples_policies/vsomeip/4002201_4002201/vsomeip_security.json
new file mode 100644
index 0000000..e03049d
--- /dev/null
+++ b/test/common/examples_policies/vsomeip/4002201_4002201/vsomeip_security.json
@@ -0,0 +1,122 @@
+{
+ "security": {
+ "policies": [
+ {
+ "allow": {
+ "offers": [
+ {
+ "instance": "any",
+ "service": "0x1501"
+ },
+ {
+ "instance": "any",
+ "service": "0xf8a8"
+ }
+ ],
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf901"
+ },
+ {
+ "instance": "any",
+ "service": "0xf902"
+ },
+ {
+ "instance": "any",
+ "service": "0x1532"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4002201",
+ "uid": "4002201"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8a8"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4003024",
+ "uid": "4003024"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8a8"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4004200",
+ "uid": "4004201"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0x1501"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4006202",
+ "uid": "4006202"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8a8"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4011201",
+ "uid": "4011201"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8a8"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "5509",
+ "uid": "4016203"
+ }
+ },
+ {
+ "credentials": {
+ "allow": [
+ {
+ "gid": [
+ "4003014"
+ ],
+ "uid": [
+ "4003014"
+ ]
+ }
+ ]
+ }
+ }
+ ]
+ }
+} \ No newline at end of file
diff --git a/test/common/examples_policies/vsomeip/4002205_4002205/vsomeip_security.json b/test/common/examples_policies/vsomeip/4002205_4002205/vsomeip_security.json
new file mode 100644
index 0000000..9512f8d
--- /dev/null
+++ b/test/common/examples_policies/vsomeip/4002205_4002205/vsomeip_security.json
@@ -0,0 +1,54 @@
+{
+ "security": {
+ "policies": [
+ {
+ "allow": {
+ "offers": [
+ {
+ "instance": "any",
+ "service": "0xf8a6"
+ }
+ ],
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8c1"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4002205",
+ "uid": "4002205"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8a6"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4014300",
+ "uid": "4014300"
+ }
+ },
+ {
+ "credentials": {
+ "allow": [
+ {
+ "gid": [
+ "4003024"
+ ],
+ "uid": [
+ "4003024"
+ ]
+ }
+ ]
+ }
+ }
+ ]
+ }
+} \ No newline at end of file
diff --git a/test/common/examples_policies/vsomeip/4003013_4003011/vsomeip_security.json b/test/common/examples_policies/vsomeip/4003013_4003011/vsomeip_security.json
new file mode 100644
index 0000000..da35eb4
--- /dev/null
+++ b/test/common/examples_policies/vsomeip/4003013_4003011/vsomeip_security.json
@@ -0,0 +1,64 @@
+{
+ "security": {
+ "policies": [
+ {
+ "allow": {
+ "offers": [
+ {
+ "instance": "any",
+ "service": "0xf8d0"
+ }
+ ],
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf901"
+ },
+ {
+ "instance": "any",
+ "service": "0xf8a4"
+ },
+ {
+ "instance": "any",
+ "service": "0xf8a1"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4003011",
+ "uid": "4003013"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8d0"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4003025",
+ "uid": "4003025"
+ }
+ },
+ {
+ "credentials": {
+ "allow": [
+ {
+ "gid": [
+ "4002200",
+ "4003014"
+ ],
+ "uid": [
+ "4002200",
+ "4003014"
+ ]
+ }
+ ]
+ }
+ }
+ ]
+ }
+} \ No newline at end of file
diff --git a/test/common/examples_policies/vsomeip/4003014_4003014/vsomeip_security.json b/test/common/examples_policies/vsomeip/4003014_4003014/vsomeip_security.json
new file mode 100644
index 0000000..0de3d03
--- /dev/null
+++ b/test/common/examples_policies/vsomeip/4003014_4003014/vsomeip_security.json
@@ -0,0 +1,1306 @@
+{
+ "security": {
+ "policies": [
+ {
+ "allow": {
+ "offers": [
+ {
+ "instance": "any",
+ "service": "0xf91c"
+ },
+ {
+ "instance": "any",
+ "service": "0xb067"
+ },
+ {
+ "instance": "any",
+ "service": "0xf8c4"
+ },
+ {
+ "instance": "any",
+ "service": "0xfe85"
+ },
+ {
+ "instance": "any",
+ "service": "0xb0a7"
+ },
+ {
+ "instance": "any",
+ "service": "0xb0a8"
+ },
+ {
+ "instance": "any",
+ "service": "0xf901"
+ },
+ {
+ "instance": "any",
+ "service": "0xf902"
+ }
+ ],
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0x1531"
+ },
+ {
+ "instance": "any",
+ "service": "0xb519"
+ },
+ {
+ "instance": "any",
+ "service": "0xf8c2"
+ },
+ {
+ "instance": "any",
+ "service": "0x1024"
+ },
+ {
+ "instance": "any",
+ "service": "0x1397"
+ },
+ {
+ "instance": "any",
+ "service": "0xb504"
+ },
+ {
+ "instance": "any",
+ "service": "0xf8a0"
+ },
+ {
+ "instance": "any",
+ "service": "0xf913"
+ },
+ {
+ "instance": "any",
+ "service": "0xb020"
+ },
+ {
+ "instance": "any",
+ "service": "0xb0a7"
+ },
+ {
+ "instance": "any",
+ "service": "0xf8a2"
+ },
+ {
+ "instance": "any",
+ "service": "0xb0a8"
+ },
+ {
+ "instance": "any",
+ "service": "0xf918"
+ },
+ {
+ "instance": "any",
+ "service": "0x1032"
+ },
+ {
+ "instance": "any",
+ "service": "0xf8a4"
+ },
+ {
+ "instance": "any",
+ "service": "0x1533"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4003014",
+ "uid": "4003014"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf901"
+ },
+ {
+ "instance": "any",
+ "service": "0xf901"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "0",
+ "uid": "0"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8c4"
+ },
+ {
+ "instance": "any",
+ "service": "0xf901"
+ },
+ {
+ "instance": "any",
+ "service": "0xf902"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4003015",
+ "uid": "0"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf901"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4004200",
+ "uid": "1041"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf91c"
+ },
+ {
+ "instance": "any",
+ "service": "0xfe85"
+ },
+ {
+ "instance": "any",
+ "service": "0xf901"
+ },
+ {
+ "instance": "any",
+ "service": "0xf902"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4002200",
+ "uid": "4002200"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf901"
+ },
+ {
+ "instance": "any",
+ "service": "0xf902"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4002201",
+ "uid": "4002201"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf901"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4003011",
+ "uid": "4003013"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8c4"
+ },
+ {
+ "instance": "any",
+ "service": "0xf901"
+ },
+ {
+ "instance": "any",
+ "service": "0xf902"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4003015",
+ "uid": "4003015"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf901"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4003019",
+ "uid": "4003019"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf901"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4003022",
+ "uid": "4003022"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf91c"
+ },
+ {
+ "instance": "any",
+ "service": "0xf901"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4003024",
+ "uid": "4003024"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8c4"
+ },
+ {
+ "instance": "any",
+ "service": "0xf901"
+ },
+ {
+ "instance": "any",
+ "service": "0xf902"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4003025",
+ "uid": "4003025"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf901"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4003026",
+ "uid": "4003026"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf901"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4003027",
+ "uid": "4003027"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf901"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4003028",
+ "uid": "4003028"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf901"
+ },
+ {
+ "instance": "any",
+ "service": "0xf902"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4003031",
+ "uid": "4003031"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf901"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4003036",
+ "uid": "4003036"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf901"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4003203",
+ "uid": "4003203"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf901"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4003205",
+ "uid": "4003205"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf901"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4003207",
+ "uid": "4003207"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf91c"
+ },
+ {
+ "instance": "any",
+ "service": "0xf901"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4004200",
+ "uid": "4004201"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf91c"
+ },
+ {
+ "instance": "any",
+ "service": "0xf901"
+ },
+ {
+ "instance": "any",
+ "service": "0xf902"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4006200",
+ "uid": "4006200"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf91c"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4006202",
+ "uid": "4006202"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf91c"
+ },
+ {
+ "instance": "any",
+ "service": "0xf901"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4006220",
+ "uid": "4006220"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf901"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4006221",
+ "uid": "4006221"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf901"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4006222",
+ "uid": "4006222"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf91c"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4006241",
+ "uid": "4006241"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf901"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4007200",
+ "uid": "4007200"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf91c"
+ },
+ {
+ "instance": "any",
+ "service": "0xb0a7"
+ },
+ {
+ "instance": "any",
+ "service": "0xf901"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4007210",
+ "uid": "4007210"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf91c"
+ },
+ {
+ "instance": "any",
+ "service": "0xb0a7"
+ },
+ {
+ "instance": "any",
+ "service": "0xf901"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4007211",
+ "uid": "4007211"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf901"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4007234",
+ "uid": "4007234"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf901"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4008300",
+ "uid": "4008202"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf901"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4008300",
+ "uid": "4008204"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf91c"
+ },
+ {
+ "instance": "any",
+ "service": "0xb067"
+ },
+ {
+ "instance": "any",
+ "service": "0xb0a7"
+ },
+ {
+ "instance": "any",
+ "service": "0xf901"
+ },
+ {
+ "instance": "any",
+ "service": "0xf902"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4010200",
+ "uid": "4010200"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf91c"
+ },
+ {
+ "instance": "any",
+ "service": "0xf901"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4011201",
+ "uid": "4011201"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf91c"
+ },
+ {
+ "instance": "any",
+ "service": "0xf901"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4012300",
+ "uid": "4012200"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf901"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4012300",
+ "uid": "4012201"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf901"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4012300",
+ "uid": "4012202"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf901"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4012300",
+ "uid": "4012203"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf901"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4012300",
+ "uid": "4012220"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf901"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4012300",
+ "uid": "4012230"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf901"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4012300",
+ "uid": "4012232"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf901"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4012300",
+ "uid": "4012240"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf901"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4013200",
+ "uid": "4013200"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf901"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4013201",
+ "uid": "4013201"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf901"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "5510",
+ "uid": "4013206"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf901"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4013211",
+ "uid": "4013211"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf901"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4013212",
+ "uid": "4013212"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf901"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4013213",
+ "uid": "4013213"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf901"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4013214",
+ "uid": "4013214"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf901"
+ },
+ {
+ "instance": "any",
+ "service": "0xf902"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4013218",
+ "uid": "4013218"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf902"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4013219",
+ "uid": "4013219"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xb067"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4013220",
+ "uid": "4013220"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf901"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "5510",
+ "uid": "4013232"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf901"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4014201",
+ "uid": "4014201"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf91c"
+ },
+ {
+ "instance": "any",
+ "service": "0xf91c"
+ },
+ {
+ "instance": "any",
+ "service": "0xf901"
+ },
+ {
+ "instance": "any",
+ "service": "0xf901"
+ },
+ {
+ "instance": "any",
+ "service": "0xf902"
+ },
+ {
+ "instance": "any",
+ "service": "0xf902"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4014300",
+ "uid": "4014300"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf91c"
+ },
+ {
+ "instance": "any",
+ "service": "0xf901"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4014390",
+ "uid": "4014390"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf901"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4015200",
+ "uid": "4015200"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf901"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4015201",
+ "uid": "4015201"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf901"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "5509",
+ "uid": "4016203"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf901"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "5509",
+ "uid": "4016204"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf901"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "5509",
+ "uid": "4016205"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf901"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4017200",
+ "uid": "4017200"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf901"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4017201",
+ "uid": "4017201"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf901"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4017208",
+ "uid": "4017208"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf901"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4017209",
+ "uid": "4017209"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf901"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4017210",
+ "uid": "4017210"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf91c"
+ },
+ {
+ "instance": "any",
+ "service": "0xf901"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4017211",
+ "uid": "4017211"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf901"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4017215",
+ "uid": "4017215"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf901"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4017216",
+ "uid": "4017216"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf91c"
+ },
+ {
+ "instance": "any",
+ "service": "0xf901"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4017218",
+ "uid": "4017218"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf901"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4017219",
+ "uid": "4017219"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf901"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4017220",
+ "uid": "4017220"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf901"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4017221",
+ "uid": "4017221"
+ }
+ },
+ {
+ "credentials": {
+ "allow": [
+ {
+ "gid": [
+ "0",
+ "4003016",
+ "4004200",
+ "4013207",
+ "4003015",
+ "4002200",
+ "4013200"
+ ],
+ "uid": [
+ "0",
+ "4003016",
+ "4004201",
+ "4013207",
+ "4003015",
+ "4002200",
+ "4013200"
+ ]
+ }
+ ]
+ }
+ }
+ ]
+ }
+} \ No newline at end of file
diff --git a/test/common/examples_policies/vsomeip/4003015_4003015/vsomeip_security.json b/test/common/examples_policies/vsomeip/4003015_4003015/vsomeip_security.json
new file mode 100644
index 0000000..20f0b47
--- /dev/null
+++ b/test/common/examples_policies/vsomeip/4003015_4003015/vsomeip_security.json
@@ -0,0 +1,82 @@
+{
+ "security": {
+ "policies": [
+ {
+ "allow": {
+ "offers": [
+ {
+ "instance": "any",
+ "service": "0xf918"
+ }
+ ],
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8c4"
+ },
+ {
+ "instance": "any",
+ "service": "0xf90c"
+ },
+ {
+ "instance": "any",
+ "service": "0xf913"
+ },
+ {
+ "instance": "any",
+ "service": "0xf901"
+ },
+ {
+ "instance": "any",
+ "service": "0xf8a4"
+ },
+ {
+ "instance": "any",
+ "service": "0xf902"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4003015",
+ "uid": "4003015"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf918"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4003014",
+ "uid": "4003014"
+ }
+ },
+ {
+ "credentials": {
+ "allow": [
+ {
+ "gid": [
+ "4003014",
+ "0",
+ "4013207",
+ "4003203",
+ "4002200"
+ ],
+ "uid": [
+ "4003014",
+ "0",
+ "4013207",
+ "4003203",
+ "4002200"
+ ]
+ }
+ ]
+ }
+ }
+ ]
+ }
+} \ No newline at end of file
diff --git a/test/common/examples_policies/vsomeip/4003016_4003016/vsomeip_security.json b/test/common/examples_policies/vsomeip/4003016_4003016/vsomeip_security.json
new file mode 100644
index 0000000..eedb124
--- /dev/null
+++ b/test/common/examples_policies/vsomeip/4003016_4003016/vsomeip_security.json
@@ -0,0 +1,63 @@
+{
+ "security": {
+ "policies": [
+ {
+ "allow": {
+ "offers": [
+ {
+ "instance": "any",
+ "service": "0xf8c2"
+ }
+ ],
+ "requests": []
+ },
+ "credentials": {
+ "gid": "4003016",
+ "uid": "4003016"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8c2"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4003014",
+ "uid": "4003014"
+ }
+ },
+ {
+ "allow": {
+ "requests": [
+ {
+ "instance": "any",
+ "service": "0xf8c2"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "4013202",
+ "uid": "4013202"
+ }
+ },
+ {
+ "deny": {
+ "offers": [
+ {
+ "instance": "any",
+ "service": "0x40"
+ }
+ ]
+ },
+ "credentials": {
+ "gid": "9000",
+ "uid": "9000"
+ }
+ }
+ ]
+ }
+}
diff --git a/test/common/examples_policies/vsomeip/vsomeip_policy_extensions.json b/test/common/examples_policies/vsomeip/vsomeip_policy_extensions.json
new file mode 100644
index 0000000..5199326
--- /dev/null
+++ b/test/common/examples_policies/vsomeip/vsomeip_policy_extensions.json
@@ -0,0 +1 @@
+{"container_policy_extensions": [{"container": "android-rse", "path": "../vsomeip_ext/android"}, {"container": "android-idc", "path": "../vsomeip_ext/android"}, {"container": "android-idc-base", "path": "../vsomeip_ext/android"}]}
diff --git a/test/common/examples_policies/vsomeip/vsomeip_security.json b/test/common/examples_policies/vsomeip/vsomeip_security.json
new file mode 100644
index 0000000..d278ea8
--- /dev/null
+++ b/test/common/examples_policies/vsomeip/vsomeip_security.json
@@ -0,0 +1,25 @@
+{
+ "routing-credentials": {
+ "gid": "5002",
+ "uid": "4003017"
+ },
+ "security": {
+ "check_credentials": "true",
+ "policies": [
+ {
+ "allow": {},
+ "credentials": {
+ "gid": "5002",
+ "uid": "4003017"
+ }
+ },
+ {
+ "credentials": {
+ "gid": "0",
+ "uid": "0"
+ },
+ "deny": {}
+ }
+ ]
+ }
+}
diff --git a/test/common/utility.cpp b/test/common/utility.cpp
new file mode 100644
index 0000000..478deeb
--- /dev/null
+++ b/test/common/utility.cpp
@@ -0,0 +1,235 @@
+// Copyright (C) 2022 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#include "utility.hpp"
+
+void
+utility::load_policy_data(std::string _input,
+ std::vector<vsomeip_v3::configuration_element> &_elements,
+ std::set<std::string> &_failed) {
+
+ boost::property_tree::ptree its_tree;
+ try {
+ boost::property_tree::json_parser::read_json(_input, its_tree);
+ _elements.push_back({ _input, its_tree });
+ }
+ catch (boost::property_tree::json_parser_error &e) {
+ _failed.insert(_input);
+ }
+}
+
+void
+utility::read_data(const std::set<std::string> &_input,
+ std::vector<vsomeip_v3::configuration_element> &_elements,
+ std::set<std::string> &_failed) {
+
+ for (auto i : _input) {
+ if (vsomeip_v3::utility::is_file(i)) {
+ load_policy_data(i, _elements, _failed);
+ } else if (vsomeip_v3::utility::is_folder(i)) {
+ std::map<std::string, bool> its_names;
+ boost::filesystem::path its_path(i);
+ for (auto j = boost::filesystem::directory_iterator(its_path);
+ j != boost::filesystem::directory_iterator();
+ j++) {
+ std::string name = j->path().string() + "/vsomeip_security.json";
+ if (vsomeip_v3::utility::is_file(name))
+ its_names[name] = true;
+ }
+
+ for (const auto& n : its_names)
+ load_policy_data(n.first, _elements, _failed);
+ }
+ }
+}
+
+std::set<std::string>
+utility::get_all_files_in_dir(const std::string &_dir_path,
+ const std::vector<std::string> &_dir_skip_list) {
+
+ // Create a vector of string
+ std::set<std::string> list_of_files;
+ try {
+ // Check if given path exists and points to a directory
+ if (boost::filesystem::exists(_dir_path)
+ && boost::filesystem::is_directory(_dir_path)) {
+ // Create a Recursive Directory Iterator object and points to the
+ // starting of directory
+ boost::filesystem::recursive_directory_iterator iter(_dir_path);
+ // Create a Recursive Directory Iterator object pointing to end.
+ boost::filesystem::recursive_directory_iterator end;
+ // Iterate till end
+ while (iter != end) {
+ // Check if current entry is a directory and if exists in
+ // skip list
+ if (boost::filesystem::is_directory(iter->path())
+ && (std::find(_dir_skip_list.begin(),
+ _dir_skip_list.end(), iter->path().filename())
+ != _dir_skip_list.end())) {
+ // Boost Filesystem API to skip current directory iteration
+#if VSOMEIP_BOOST_VERSION < 108100
+ iter.no_push();
+#else
+ iter.disable_recursion_pending();
+#endif
+ } else {
+ // Add the name in vector
+ list_of_files.insert(iter->path().string());
+ }
+ boost::system::error_code ec;
+ // Increment the iterator to point to next entry in recursive iteration
+ iter.increment(ec);
+ if (ec) {
+ std::cerr << "Error While Accessing : " << iter->path().string() << " :: " << ec.message() << '\n';
+ }
+ }
+ }
+ }
+ catch (std::system_error & e) {
+ std::cerr << "Exception :: " << e.what();
+ }
+ return list_of_files;
+}
+
+std::string
+utility::get_policies_path() {
+
+ return boost::filesystem::canonical(
+ boost::filesystem::current_path()).string()
+ + "/../test/common/examples_policies";
+}
+
+vsomeip_sec_client_t
+utility::create_uds_client(uid_t user, gid_t group) {
+ vsomeip_sec_client_t result;
+ result.client_type = VSOMEIP_CLIENT_UDS;
+ result.client.uds_client = { user, group };
+ return result;
+}
+
+void
+utility::force_check_credentials(
+ std::vector<vsomeip_v3::configuration_element> &_policy_elements,
+ std::string _value) {
+
+ for(auto &i : _policy_elements) {
+ try {
+ boost::property_tree::ptree &security
+ = i.tree_.get_child("security");
+ boost::property_tree::ptree &credentials
+ = security.get_child("check_credentials");
+ if (credentials.get_value<std::string>().compare(_value)) {
+ security.erase("check_credentials");
+ credentials.put("check_credentials", _value);
+ }
+ }
+ catch(...) {}
+ }
+ }
+
+void utility::get_policy_uids(vsomeip_v3::configuration_element &_policy_element,
+ std::vector<vsomeip_v3::uid_t> &_out_uids)
+{
+ try {
+ std::vector<std::string> user_ids;
+ auto policy_tree = _policy_element.tree_.get_child("security.policies");
+ for (auto policy_node : policy_tree) {
+ auto optional_credential_node =
+ policy_node.second.get_child_optional("credentials.uid");
+ if (optional_credential_node) {
+ auto optional_user_id =
+ optional_credential_node.get().get_value_optional<std::string>();
+ if (optional_user_id) {
+ user_ids.push_back(optional_user_id.get());
+ }
+ }
+ }
+ for (const std::string &uid_string : user_ids) {
+ _out_uids.push_back((vsomeip_v3::uid_t)std::strtoul(uid_string.c_str(), NULL, 0));
+ }
+ } catch (...) {
+ std::cerr << "Caught exception while reading user ids in policy element \""
+ << _policy_element.name_ << "\"!" << std::endl;
+ }
+}
+
+void utility::get_policy_services(vsomeip_v3::configuration_element &_policy_element,
+ std::vector<vsomeip_v3::service_t> &_out_services)
+{
+ try {
+ std::vector<std::string> services;
+ auto policy_tree = _policy_element.tree_.get_child("security.policies");
+ for (auto policy_node : policy_tree) {
+ // Get allowed request services.
+ auto allow_requests = policy_node.second.get_child_optional("allow.requests");
+ if (allow_requests) {
+ for (auto &request_node : allow_requests.get()) {
+ auto optional_service = request_node.second.get_child("service")
+ .get_value_optional<std::string>();
+ if (optional_service) {
+ services.push_back(optional_service.get());
+ }
+ }
+ }
+ // Get denied request services.
+ auto deny_requests = policy_node.second.get_child_optional("deny.requests");
+ if (deny_requests) {
+ for (auto &request_node : deny_requests.get()) {
+ auto optional_service = request_node.second.get_child("service")
+ .get_value_optional<std::string>();
+ if (optional_service) {
+ services.push_back(optional_service.get());
+ }
+ }
+ }
+ }
+ for (const std::string &service_str : services) {
+ _out_services.push_back(
+ (vsomeip_v3::service_t)std::strtoul(service_str.c_str(), NULL, 0));
+ }
+ } catch (...) {
+ std::cerr << "Caught exception while reading services in policy element \""
+ << _policy_element.name_ << "\"!" << std::endl;
+ }
+}
+
+void utility::add_security_whitelist(vsomeip_v3::configuration_element &_policy_element,
+ const bool _check_whitelist)
+{
+ std::vector<vsomeip_v3::uid_t> user_ids;
+ get_policy_uids(_policy_element, user_ids);
+
+ std::vector<vsomeip_v3::service_t> services;
+ get_policy_services(_policy_element, services);
+
+ add_security_whitelist(_policy_element, user_ids, services, _check_whitelist);
+}
+
+void utility::add_security_whitelist(vsomeip_v3::configuration_element &_policy_element,
+ const std::vector<vsomeip_v3::uid_t> &_user_ids,
+ const std::vector<vsomeip_v3::service_t> &_services,
+ const bool _check_whitelist)
+{
+ // Add the user ids to the whitelist.
+ boost::property_tree::ptree id_array_node;
+ for (auto user_id : _user_ids) {
+ boost::property_tree::ptree id_node;
+ id_node.put("", user_id);
+ id_array_node.push_back(std::make_pair("", id_node));
+ }
+ _policy_element.tree_.add_child("security-update-whitelist.uids", id_array_node);
+
+ // Add the services to the whitelist.
+ boost::property_tree::ptree service_array_node;
+ for (auto service : _services) {
+ boost::property_tree::ptree service_node;
+ service_node.put("", service);
+ service_array_node.push_back(std::make_pair("", service_node));
+ }
+ _policy_element.tree_.add_child("security-update-whitelist.services", service_array_node);
+
+ // Update the 'check_whitelist' flag.
+ _policy_element.tree_.add<bool>("security-update-whitelist.check-whitelist", _check_whitelist);
+}
diff --git a/test/common/utility.hpp b/test/common/utility.hpp
new file mode 100644
index 0000000..b4f1100
--- /dev/null
+++ b/test/common/utility.hpp
@@ -0,0 +1,77 @@
+// Copyright (C) 2022 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#include <vsomeip/vsomeip.hpp>
+#include "../../implementation/security/include/policy_manager_impl.hpp"
+#include "../../implementation/configuration/include/configuration_impl.hpp"
+#include "../../implementation/utility/include/utility.hpp"
+
+// This is needed to silence internal warnings in boost, when e.g. including <boost/property_tree/json_parser.hpp>
+#define BOOST_BIND_GLOBAL_PLACEHOLDERS
+
+#include <boost/filesystem.hpp>
+#include <boost/property_tree/ptree.hpp>
+#include <boost/property_tree/json_parser.hpp>
+
+#include <iostream>
+
+class utility {
+public:
+ static void load_policy_data(std::string _input,
+ std::vector<vsomeip_v3::configuration_element> &_elements,
+ std::set<std::string> &_failed);
+
+ static void read_data(const std::set<std::string> &_input,
+ std::vector<vsomeip_v3::configuration_element> &_elements, std::set<std::string> &_failed);
+
+ static std::set<std::string> get_all_files_in_dir(const std::string &_dir_path,
+ const std::vector<std::string> &_dir_skip_list);
+
+ static std::string get_policies_path();
+
+ static vsomeip_sec_client_t create_uds_client(uid_t user, gid_t group);
+
+ static void force_check_credentials(std::vector<vsomeip_v3::configuration_element> &_policy_elements, std::string _value);
+ /**
+ * @brief Get all of the user ids in the given policy element.
+ *
+ * @param _policy_element
+ * @param _out_uids
+ */
+ static void get_policy_uids(vsomeip_v3::configuration_element &_policy_element,
+ std::vector<vsomeip_v3::uid_t> &_out_uids);
+
+ /**
+ * @brief Get all of the services in the given policy element.
+ *
+ * @param _policy_element
+ * @param _out_services
+ */
+ static void get_policy_services(vsomeip_v3::configuration_element &_policy_element,
+ std::vector<vsomeip_v3::service_t> &_out_services);
+
+ /**
+ * @brief Add a security whitelist to the given policy element. Uses all user ids and
+ * services mentioned in the policy.
+ *
+ * @param _policy_element
+ * @param _check_whitelist
+ */
+ static void add_security_whitelist(vsomeip_v3::configuration_element &_policy_element,
+ const bool _check_whitelist);
+
+ /**
+ * @brief Add a security whitelist with the given ids and services to the policy element.
+ *
+ * @param _policy_element
+ * @param _user_ids
+ * @param _services
+ * @param _check_whitelist
+ */
+ static void add_security_whitelist(vsomeip_v3::configuration_element &_policy_element,
+ const std::vector<vsomeip_v3::uid_t> &_user_ids,
+ const std::vector<vsomeip_v3::service_t> &_services,
+ const bool _check_whitelist);
+};