Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Esl2 #253

Merged
merged 3 commits into from
Nov 30, 2024
Merged

Esl2 #253

Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
bump runtime limits due to slow github actions workers
  • Loading branch information
divarvel committed Nov 29, 2024
commit a1cdb6b47f6506736abfeeb95faf8fc64e25922b
12 changes: 11 additions & 1 deletion biscuit-auth/examples/third_party.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
use std::time::Duration;

use biscuit_auth::{
builder::{Algorithm, AuthorizerBuilder, BlockBuilder},
builder_ext::AuthorizerExt,
datalog::SymbolTable,
datalog::{RunLimits, SymbolTable},
Biscuit, KeyPair,
};
use rand::{prelude::StdRng, SeedableRng};
Expand Down Expand Up @@ -36,6 +38,10 @@ fn main() {

let mut authorizer = AuthorizerBuilder::new()
.allow_all()
.limits(RunLimits {
max_time: Duration::from_secs(10),
..Default::default()
})
.build(&biscuit1)
.unwrap();

Expand All @@ -44,6 +50,10 @@ fn main() {

let mut authorizer = AuthorizerBuilder::new()
.allow_all()
.limits(RunLimits {
max_time: Duration::from_secs(10),
..Default::default()
})
.build(&biscuit2)
.unwrap();

Expand Down
2 changes: 1 addition & 1 deletion biscuit-auth/src/token/authorizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1093,7 +1093,7 @@ mod tests {
)
.unwrap()
.limits(AuthorizerLimits {
max_time: Duration::from_millis(10), //Set 10 milliseconds as the maximum time allowed for the authorization due to "cheap" worker on GitHub Actions
max_time: Duration::from_secs(10), //Set 10 seconds as the maximum time allowed for the authorization due to "cheap" worker on GitHub Actions
..Default::default()
})
.build(&biscuit2)
Expand Down
4 changes: 4 additions & 0 deletions biscuit-auth/src/token/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1384,6 +1384,10 @@ mod tests {
.check("check if bytes($0), { hex:00000000, hex:0102AB }.contains($0)")
.unwrap()
.allow_all()
.limits(AuthorizerLimits {
max_time: Duration::from_secs(10),
..Default::default()
})
.build(&biscuit2)
.unwrap();

Expand Down
16 changes: 15 additions & 1 deletion biscuit-auth/tests/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,13 @@ fn authorizer_macro() {
"#
);

let authorizer = b.build_unauthenticated().unwrap();
let authorizer = b
.limits(RunLimits {
max_time: Duration::from_secs(10),
..Default::default()
})
.build_unauthenticated()
.unwrap();
assert_eq!(
authorizer.dump_code(),
r#"appended(true);
Expand All @@ -95,6 +101,10 @@ allow if true;
#[test]
fn authorizer_macro_trailing_comma() {
let a = authorizer!(r#"fact("test", {my_key});"#, my_key = "my_value",)
.limits(RunLimits {
max_time: Duration::from_secs(10),
..Default::default()
})
.build_unauthenticated()
.unwrap();
assert_eq!(
Expand Down Expand Up @@ -261,6 +271,10 @@ fn json() {
$value.get("id") == $id,
$value.get("roles").contains("admin");"#
)
.limits(RunLimits {
max_time: Duration::from_secs(10),
..Default::default()
})
.build(&biscuit)
.unwrap();
assert_eq!(
Expand Down
Loading