Skip to content

Commit

Permalink
fixup! fix heterogeneous testcase and rebuild samples
Browse files Browse the repository at this point in the history
  • Loading branch information
divarvel committed Nov 12, 2024
1 parent 48aad3b commit 9b5d810
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 0 deletions.
4 changes: 4 additions & 0 deletions biscuit-auth/examples/testcases.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2075,6 +2075,10 @@ fn heterogeneous_equal(target: &str, root: &KeyPair, test: bool) -> TestResult {
"".to_string(),
validate_token(root, &data[..], "allow if true"),
);
validations.insert(
"evaluate to false".to_string(),
validate_token(root, &data[..], "allow if false != false"),
);

TestResult {
title,
Expand Down
50 changes: 50 additions & 0 deletions biscuit-auth/samples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2733,6 +2733,56 @@ World {
```

result: `Ok(0)`
### validation for "evaluate to false"

authorizer code:
```
allow if false != false;
```

revocation ids:
- `10242885d535e2e665512c710510dbf99e450108cb0183f1bfd35266a13453163059f41960d3459514e7bebd85a1997969aa993c9fc66aa7e74e1ddadee1c40f`

authorizer world:
```
World {
facts: []
rules: []
checks: [
Checks {
origin: Some(
0,
),
checks: [
"check if \"abcD12\" == \"abcD12\"",
"check if \"abcD12x\" != \"abcD12\"",
"check if \"abcD12x\" != true",
"check if 1 != 3",
"check if 1 != true",
"check if 1 != true",
"check if 1 == 1",
"check if 2022-12-04T09:46:41Z != 2020-12-04T09:46:41Z",
"check if 2022-12-04T09:46:41Z != true",
"check if 2022-12-04T09:46:41Z == 2022-12-04T09:46:41Z",
"check if false != true",
"check if false == false",
"check if hex:12abcd != hex:12ab",
"check if hex:12abcd != true",
"check if hex:12abcd == hex:12abcd",
"check if true == true",
"check if {1, 2} == {1, 2}",
"check if {1, 4} != true",
"check if {1, 4} != {1, 2}",
],
},
]
policies: [
"allow if false != false",
]
}
```

result: `Err(FailedLogic(NoMatchingPolicy { checks: [] }))`


------------------------------
Expand Down
48 changes: 48 additions & 0 deletions biscuit-auth/samples/samples.json
Original file line number Diff line number Diff line change
Expand Up @@ -2563,6 +2563,54 @@
"revocation_ids": [
"10242885d535e2e665512c710510dbf99e450108cb0183f1bfd35266a13453163059f41960d3459514e7bebd85a1997969aa993c9fc66aa7e74e1ddadee1c40f"
]
},
"evaluate to false": {
"world": {
"facts": [],
"rules": [],
"checks": [
{
"origin": 0,
"checks": [
"check if \"abcD12\" == \"abcD12\"",
"check if \"abcD12x\" != \"abcD12\"",
"check if \"abcD12x\" != true",
"check if 1 != 3",
"check if 1 != true",
"check if 1 != true",
"check if 1 == 1",
"check if 2022-12-04T09:46:41Z != 2020-12-04T09:46:41Z",
"check if 2022-12-04T09:46:41Z != true",
"check if 2022-12-04T09:46:41Z == 2022-12-04T09:46:41Z",
"check if false != true",
"check if false == false",
"check if hex:12abcd != hex:12ab",
"check if hex:12abcd != true",
"check if hex:12abcd == hex:12abcd",
"check if true == true",
"check if {1, 2} == {1, 2}",
"check if {1, 4} != true",
"check if {1, 4} != {1, 2}"
]
}
],
"policies": [
"allow if false != false"
]
},
"result": {
"Err": {
"FailedLogic": {
"NoMatchingPolicy": {
"checks": []
}
}
}
},
"authorizer_code": "allow if false != false;\n",
"revocation_ids": [
"10242885d535e2e665512c710510dbf99e450108cb0183f1bfd35266a13453163059f41960d3459514e7bebd85a1997969aa993c9fc66aa7e74e1ddadee1c40f"
]
}
}
},
Expand Down

0 comments on commit 9b5d810

Please sign in to comment.