From 298172c58e15dcca3c86f892ca3d4e7345fbec1d Mon Sep 17 00:00:00 2001 From: Saoirse Aronson Date: Thu, 16 Apr 2026 12:57:51 +0200 Subject: [PATCH 1/2] [BREAKING] Fix TrustedOrigins default issue TrustedOrigins implements an inherent constructor called default and also has a derived implementation of Default. **These two constructors have different behavior.** This means that `TrustedOrigins::default()` and `::default()` construct different `TrustedOrigins` types. This is surprising. This PR changes the behavior of the Default trait constructor to match the behavior of the inherent constructor. --- biscuit-auth/src/datalog/origin.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/biscuit-auth/src/datalog/origin.rs b/biscuit-auth/src/datalog/origin.rs index e1ac7eed..43cb1052 100644 --- a/biscuit-auth/src/datalog/origin.rs +++ b/biscuit-auth/src/datalog/origin.rs @@ -83,16 +83,22 @@ impl Display for Origin { } /// This represents the sets of origins trusted by a rule -#[derive(Clone, Debug, Default, Hash, PartialEq, Eq, PartialOrd, Ord)] +#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] pub struct TrustedOrigins(Origin); -impl TrustedOrigins { - pub fn default() -> TrustedOrigins { +impl Default for TrustedOrigins { + fn default() -> TrustedOrigins { let mut origins = Origin::default(); origins.insert(usize::MAX); origins.insert(0); TrustedOrigins(origins) } +} + +impl TrustedOrigins { + pub fn default() -> TrustedOrigins { + ::default() + } pub fn from_scopes( rule_scopes: &[Scope], From e101081f2e2ba3b67b311d25332fb3296549537b Mon Sep 17 00:00:00 2001 From: Saoirse Aronson Date: Fri, 17 Apr 2026 14:09:54 +0200 Subject: [PATCH 2/2] Add changelog --- biscuit-auth/CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/biscuit-auth/CHANGELOG.md b/biscuit-auth/CHANGELOG.md index 9fa4b208..b0e173d3 100644 --- a/biscuit-auth/CHANGELOG.md +++ b/biscuit-auth/CHANGELOG.md @@ -1,3 +1,7 @@ +# `7.0.0` + +- `TrustedOrigin`'s `Default` implementation changed to match its inherent `default` function (#327) + # `6.0.0` - support for `pem` / `der` private and public keys (#212 and #265)