Skip to content

Commit c6ce514

Browse files
committed
test(auth): cover scope-bound object authorization
1 parent 3916486 commit c6ce514

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

objectstore-server/src/auth/context.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -614,6 +614,18 @@ MC4CAQAwBQYDK2VwBCIEIKwVoE4TmTfWoqH3HgLVsEcHs9PHNe+ar/Hp6e4To8pK
614614
Ok(())
615615
}
616616

617+
#[test]
618+
fn test_assert_object_authorized_scope_bound_allows_any_key_in_context() -> Result<(), AuthError>
619+
{
620+
let auth_context =
621+
sample_auth_context("123", "456", HashSet::from([Permission::ObjectRead]));
622+
let object_id = ObjectId::new(sample_object_context("123", "456"), "any-key".into());
623+
624+
auth_context.assert_object_authorized(Permission::ObjectRead, &object_id)?;
625+
626+
Ok(())
627+
}
628+
617629
#[test]
618630
fn test_assert_object_authorized_object_bound_mismatch_fails() -> Result<(), AuthError> {
619631
let object_id = ObjectId::new(sample_object_context("123", "456"), "my-key".into());

0 commit comments

Comments
 (0)