Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 48 additions & 3 deletions samples/current/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2108,6 +2108,49 @@ World {
}
```

result: `Err(FailedLogic(Unauthorized { policy: Allow(0), checks: [Block(FailedBlockCheck { block_id: 0, check_id: 0, rule: "check all operation($op), allowed_operations($allowed), $allowed.contains($op)" })] }))`
### validation for "no matches"

authorizer code:
```
allow if true;
```

revocation ids:
- `c456817012e1d523c6d145b6d6a3475d9f7dd4383c535454ff3f745ecf4234984ce09b9dec0551f3d783abe850f826ce43b12f1fd91999a4753a56ecf4c56d0d`

authorizer world:
```
World {
facts: [
Facts {
origin: {
Some(
0,
),
},
facts: [
"allowed_operations({\"A\", \"B\"})",
],
},
]
rules: []
checks: [
Checks {
origin: Some(
0,
),
checks: [
"check all operation($op), allowed_operations($allowed), $allowed.contains($op)",
],
},
]
policies: [
"allow if true",
]
}
```

result: `Err(FailedLogic(Unauthorized { policy: Allow(0), checks: [Block(FailedBlockCheck { block_id: 0, check_id: 0, rule: "check all operation($op), allowed_operations($allowed), $allowed.contains($op)" })] }))`


Expand Down Expand Up @@ -2417,6 +2460,7 @@ public keys: []
block version: 4

```
check if true !== false;
check if 1 !== 3;
check if 1 | 2 ^ 3 === 0;
check if "abcD12x" !== "abcD12";
Expand All @@ -2433,7 +2477,7 @@ allow if true;
```

revocation ids:
- `117fa653744c859561555e6a6f5990e3a8e7817f91b87aa6991b6d64297158b4e884c92d10f49f74c96069df722aa676839b72751ca9d1fe83a7025b591de00b`
- `9402c07923aa33bc911de80e61f388f5c4533e6b36e45317dc1db1e6bcc7664ed0c1c504d0ca8925208008961d95bbdbc36f6e3d91b3173369cc19ed625e9a0c`

authorizer world:
```
Expand All @@ -2451,6 +2495,7 @@ World {
"check if 1 | 2 ^ 3 === 0",
"check if 2022-12-04T09:46:41Z !== 2020-12-04T09:46:41Z",
"check if hex:12abcd !== hex:12ab",
"check if true !== false",
"check if {1, 4} !== {1, 2}",
],
},
Expand Down Expand Up @@ -3011,7 +3056,7 @@ result: `Ok(0)`

authorizer code:
```
allow if [true].any($p -> [true].all($p -> $p));
allow if {"true"}.any($p -> {"true"}.all($p -> $p));
```

revocation ids:
Expand Down Expand Up @@ -3042,7 +3087,7 @@ World {
},
]
policies: [
"allow if [true].any($p -> [true].all($p -> $p))",
"allow if {\"true\"}.any($p -> {\"true\"}.all($p -> $p))",
]
}
```
Expand Down
59 changes: 55 additions & 4 deletions samples/current/samples.json
Original file line number Diff line number Diff line change
Expand Up @@ -1965,6 +1965,56 @@
"revocation_ids": [
"c456817012e1d523c6d145b6d6a3475d9f7dd4383c535454ff3f745ecf4234984ce09b9dec0551f3d783abe850f826ce43b12f1fd91999a4753a56ecf4c56d0d"
]
},
"no matches": {
"world": {
"facts": [
{
"origin": [
0
],
"facts": [
"allowed_operations({\"A\", \"B\"})"
]
}
],
"rules": [],
"checks": [
{
"origin": 0,
"checks": [
"check all operation($op), allowed_operations($allowed), $allowed.contains($op)"
]
}
],
"policies": [
"allow if true"
]
},
"result": {
"Err": {
"FailedLogic": {
"Unauthorized": {
"policy": {
"Allow": 0
},
"checks": [
{
"Block": {
"block_id": 0,
"check_id": 0,
"rule": "check all operation($op), allowed_operations($allowed), $allowed.contains($op)"
}
}
]
}
}
}
},
"authorizer_code": "allow if true;\n",
"revocation_ids": [
"c456817012e1d523c6d145b6d6a3475d9f7dd4383c535454ff3f745ecf4234984ce09b9dec0551f3d783abe850f826ce43b12f1fd91999a4753a56ecf4c56d0d"
]
}
}
},
Expand Down Expand Up @@ -2201,7 +2251,7 @@
],
"public_keys": [],
"external_key": null,
"code": "check if 1 !== 3;\ncheck if 1 | 2 ^ 3 === 0;\ncheck if \"abcD12x\" !== \"abcD12\";\ncheck if 2022-12-04T09:46:41Z !== 2020-12-04T09:46:41Z;\ncheck if hex:12abcd !== hex:12ab;\ncheck if {1, 4} !== {1, 2};\n",
"code": "check if true !== false;\ncheck if 1 !== 3;\ncheck if 1 | 2 ^ 3 === 0;\ncheck if \"abcD12x\" !== \"abcD12\";\ncheck if 2022-12-04T09:46:41Z !== 2020-12-04T09:46:41Z;\ncheck if hex:12abcd !== hex:12ab;\ncheck if {1, 4} !== {1, 2};\n",
"version": 4
}
],
Expand All @@ -2219,6 +2269,7 @@
"check if 1 | 2 ^ 3 === 0",
"check if 2022-12-04T09:46:41Z !== 2020-12-04T09:46:41Z",
"check if hex:12abcd !== hex:12ab",
"check if true !== false",
"check if {1, 4} !== {1, 2}"
]
}
Expand All @@ -2232,7 +2283,7 @@
},
"authorizer_code": "allow if true;\n",
"revocation_ids": [
"117fa653744c859561555e6a6f5990e3a8e7817f91b87aa6991b6d64297158b4e884c92d10f49f74c96069df722aa676839b72751ca9d1fe83a7025b591de00b"
"9402c07923aa33bc911de80e61f388f5c4533e6b36e45317dc1db1e6bcc7664ed0c1c504d0ca8925208008961d95bbdbc36f6e3d91b3173369cc19ed625e9a0c"
]
}
}
Expand Down Expand Up @@ -2800,15 +2851,15 @@
}
],
"policies": [
"allow if [true].any($p -> [true].all($p -> $p))"
"allow if {\"true\"}.any($p -> {\"true\"}.all($p -> $p))"
]
},
"result": {
"Err": {
"Execution": "ShadowedVariable"
}
},
"authorizer_code": "allow if [true].any($p -> [true].all($p -> $p));\n",
"authorizer_code": "allow if {\"true\"}.any($p -> {\"true\"}.all($p -> $p));\n",
"revocation_ids": [
"2cd348b6df5f08b900903fd8d3fbea0bb89b665c331a2aa2131e0b8ecb38b3550275d4ccd8db35da6c4433eed1d456cfb761e3fcc7845894d891e986ca044b02"
]
Expand Down
Binary file modified samples/current/test028_expressions_v4.bc
Binary file not shown.