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

Lenient shield builder #315

Merged
merged 76 commits into from
Dec 20, 2024
Merged

Lenient shield builder #315

merged 76 commits into from
Dec 20, 2024

Conversation

CyonAlexRDX
Copy link
Contributor

@CyonAlexRDX CyonAlexRDX commented Dec 20, 2024

Allows for more lenient SecurityShieldBuilder, by passing SecurityShieldBuilderMode::Lenient as mode to SecurityShieldBuilder.

Changes

The RoleBuilder and MatrixBuilder have got a new variant of almost all their methods, having the suffix _with_mode which takes a mode: SecurityShieldBuilderMode. The reason why this is not a field on the MatrixBuilder and role_builder is because it requires bigger changes to AbstractRoleBuilderOrBuilt and AbstractMatrixBuilderOrBuilt - which we can do but a bit more intrusive change. We could potentially add a serde_skipped extra field which we set to () for Built but to SecurityShieldBuilderMode (which we might rename to FactorBuilderMode to fit more into RoleBuilder) for non-Built (i.e. builders).

The SecurityShield builder than pass self.mode to all required methods.

The RoleBuilder has been updated to make use of mode passed as method argument to be more lenient - when applicable.

@CyonAlexRDX CyonAlexRDX marked this pull request as ready for review December 20, 2024 14:49
{
return duplicates_err;
}
// but if threshold contains it, we're good (since mode is lenient)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With Lenient, we allow a factor which is in override to be added to threshold (and vice versa)

}
}
SecurityShieldBuilderMode::Lenient => {}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for Lenient we do not count the number of Device FactorSource, we allow many.

@@ -707,6 +829,10 @@ impl<const ROLE: u8> RoleBuilder<ROLE> {
);
}

if mode == SecurityShieldBuilderMode::Lenient {
return Ok(());
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For Lenient we allow password by itself.

Copy link
Contributor

@danvleju-rdx danvleju-rdx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice!
You can merge it, and I'll handle the conflicts on my branch when I’m back.

@CyonAlexRDX
Copy link
Contributor Author

pushing a fix for swift tests now

Copy link
Contributor

@sergiupuhalschi-rdx sergiupuhalschi-rdx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect!

@CyonAlexRDX CyonAlexRDX merged commit 4870dd8 into main Dec 20, 2024
11 checks passed
@CyonAlexRDX CyonAlexRDX deleted the ac/lenient_shield_builder branch December 20, 2024 16:58
Copy link

codecov bot commented Dec 20, 2024

Codecov Report

Attention: Patch coverage is 95.62044% with 6 lines in your changes missing coverage. Please review.

Project coverage is 93.3%. Comparing base (191f729) to head (f2e85f6).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...security_structures/roles/builder/roles_builder.rs 92.1% 6 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##            main    #315     +/-   ##
=======================================
- Coverage   93.3%   93.3%   -0.1%     
=======================================
  Files       1111    1111             
  Lines      24064   24182    +118     
  Branches      79      79             
=======================================
+ Hits       22464   22570    +106     
- Misses      1585    1597     +12     
  Partials      15      15             
Flag Coverage Δ
kotlin 97.1% <ø> (ø)
rust 92.8% <95.6%> (-0.1%) ⬇️
swift 94.8% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...tomatic_shield_builder/automatic_shield_builder.rs 95.1% <ø> (ø)
...rity_structures/matrices/builder/matrix_builder.rs 100.0% <100.0%> (ø)
...mfa/security_structures/security_shield_builder.rs 94.0% <100.0%> (+0.2%) ⬆️
...security_structures/roles/builder/roles_builder.rs 92.2% <92.1%> (-3.2%) ⬇️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants