-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathpath_enforced_authz.robot
128 lines (108 loc) · 4.73 KB
/
path_enforced_authz.robot
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
*** Settings ***
Resource common/endpoint.robot
Resource common/curl.robot
Resource common/oidc-agent.robot
Variables test/variables.yaml
Force Tags path-enforced-authz-checks
*** Test cases ***
Path authorization enforced on storage.read
[Tags] critical
${token} Get token scope=-s storage.read:/wlcg-jwt-compliance
${endpoint} GET SE endpoint ${se_alias}
${uuid} Generate UUID
${url} Set Variable ${endpoint}/not-found-${uuid}
${rc} ${out} Curl Error ${url}
Should Contain ${out} 403
${url} SE URL not-found-${uuid}
${rc} ${out} Curl Error ${url}
Should Contain ${out} 404
Path authorization enforced on storage.modify
[Tags] critical
${token} Get token scope=-s storage.modify:/wlcg-jwt-compliance
${endpoint} GET SE endpoint ${se_alias}
${uuid} Generate UUID
${url} Set Variable ${endpoint}/not-found-${uuid}
${rc} ${out} Curl Put Error /etc/services ${url}
Should Contain ${out} 403
${url} SE URL not-found-${uuid}
${rc} ${out} Curl Put Success /etc/services ${url}
Should Match Regexp ${out} 20[01]
storage.read:/foobar allows to read into the /foobar directory
[Tags] critical
[Setup] Create foobar directory and file
${token} Get token scope=-s storage.read:/wlcg-jwt-compliance/${SUITE_UUID}/foobar
${rc} ${out} Curl Auth Success ${URL}
Should Contain ${out} ${file.content}
[Teardown] Delete foobar directory and file
storage.read:/foo does not allow to read into the /foobar directory
[Tags] not-critical
[Setup] Create foobar directory and file
${token} Get token scope=-s storage.read:/wlcg-jwt-compliance/${SUITE_UUID}/foo
${rc} ${out} Curl Error ${URL}
Should Contain ${out} 403
[Teardown] Delete foobar directory and file
Create directory allowed with storage.create scope
[Tags] critical
${token} Get token
${uuid} Generate UUID
${basename} Set Variable create-dir-${uuid}
${url} SE URL ${basename}
${rc} ${out} Curl MKCOL Success ${url}
Should Match Regexp ${out} 20[01]
${token} Get token scope=-s storage.create:/wlcg-jwt-compliance/${SUITE_UUID}/${basename}
${rc} ${out} Curl MKCOL Success ${url}/foobar
Should Match Regexp ${out} 20[01]
Create directory not allowed with storage.create scope and partial path
[Tags] not-critical
${token} Get token
${uuid} Generate UUID
${basename} Set Variable create-dir-${uuid}
${url} SE URL ${basename}
${rc} ${out} Curl MKCOL Success ${url}
Should Match Regexp ${out} 20[01]
${partial.basename} Get Substring ${basename} 0 -1
${token} Get token scope=-s storage.create:/wlcg-jwt-compliance/${SUITE_UUID}/${partial.basename}
${rc} ${out} Curl MKCOL Error ${url}/foobar
Should Contain ${out} 403
storage.read scope with path not compliant with RFC3986 is rejected
[Tags] critical
[Setup] Create foobar directory and file
${token} Get token scope=-s storage.read:/foobar
${rc} ${out} Curl Error ${URL}
Should Contain ${out} 403
${token} Get token scope=-s storage.read:/foo
${rc} ${out} Curl Error ${URL}
Should Contain ${out} 403
[Teardown] Delete foobar directory and file
Trailing slash allows to read into a directory
[Tags] TBD not-critical
[Setup] Create foobar directory and file
${token} Get token scope=-s storage.read:/wlcg-jwt-compliance/${SUITE_UUID}/foobar/
${rc} ${out} Curl Auth Success ${URL}
Should Contain ${out} ${file.content}
${token} Get token scope=-s storage.read:/wlcg-jwt-compliance/${SUITE_UUID}/foo/
${rc} ${out} Curl Error ${URL}
Should Contain ${out} 403
${token} Get token scope=-s storage.read:/wlcg-jwt-compliance/${SUITE_UUID}/foobar
${rc} ${out} Curl Error ${URL}
Should Contain ${out} 403
[Teardown] Delete foobar directory and file
*** Variables ***
${file.content} wlcg-suite-content-file
${file.name} file
*** Keywords ***
Create foobar directory and file
${token} Get token
${url} SE URL foobar
${rc} ${out} Curl MKCOL Success ${url}
Should Match Regexp ${out} 20[01]
${tmp.file} Set Variable /tmp/${file.name}
Create File ${tmp.file} ${file.content}
Set Test Variable ${URL} ${url}/${file.name}
${rc} ${out} Curl PUT Success ${tmp.file} ${URL}
Should Match Regexp ${out} 20[01]
Delete foobar directory and file
${token} Get token
${url} SE URL foobar
Curl DELETE Success ${url}/${file.name}
Curl DELETE Success ${url}