| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
name: "restricted_destinations" |
| 16 |
rule: |
| 17 |
variables: |
| 18 |
- name: matches_origin_ip |
| 19 |
expression: > |
| 20 |
locationCode(origin.ip) == spec.origin |
| 21 |
- name: has_nationality |
| 22 |
expression: > |
| 23 |
has(request.auth.claims.nationality) |
| 24 |
- name: matches_nationality |
| 25 |
expression: > |
| 26 |
variables.has_nationality && request.auth.claims.nationality == spec.origin |
| 27 |
- name: matches_dest_ip |
| 28 |
expression: > |
| 29 |
locationCode(destination.ip) in spec.restricted_destinations |
| 30 |
- name: matches_dest_label |
| 31 |
expression: > |
| 32 |
resource.labels.location in spec.restricted_destinations |
| 33 |
- name: matches_dest |
| 34 |
expression: > |
| 35 |
variables.matches_dest_ip || variables.matches_dest_label |
| 36 |
match: |
| 37 |
- condition: variables.matches_nationality && variables.matches_dest |
| 38 |
output: "true" |
| 39 |
- condition: > |
| 40 |
!variables.has_nationality && variables.matches_origin_ip && variables.matches_dest |
| 41 |
output: "true" |
| 42 |
- output: "false" |