-
Notifications
You must be signed in to change notification settings - Fork 1
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
Security structures setup changes #336
Security structures setup changes #336
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #336 +/- ##
==========================================
+ Coverage 92.54% 92.59% +0.04%
==========================================
Files 1152 1155 +3
Lines 25623 25688 +65
Branches 85 85
==========================================
+ Hits 23713 23785 +72
+ Misses 1899 1892 -7
Partials 11 11
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
self.primary_role | ||
.validate_threshold_factors() | ||
.into_matrix_err(RoleKind::Primary)?; | ||
Ok(()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just:
self.primary_role
.validate_threshold_factors()
.into_matrix_err(RoleKind::Primary)
@@ -0,0 +1,55 @@ | |||
use crate::prelude::*; | |||
|
|||
/// Represents the status of selected threshold factor sources in the Security Shield building process. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Represents the status of selected threshold factor source
Specifically for Primary Treshold
* Update security structure threshold * Update api and tests * Update default threshold. Add tests * Add test * Fix swift tests * Fix fs removing from primary threshold. Add test * Update naming. Add Threshold ctor
self.threshold.value(self.threshold_factors.len()) | ||
} | ||
|
||
/// How many threshold factors that must be used to perform some function with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably needs a different doc compared to above
return Some( | ||
NotYetValidReason::ThresholdHigherThanThresholdFactorsLen, | ||
); | ||
} | ||
if self.get_threshold() == 0 && !self.get_threshold_factors().is_empty() | ||
{ | ||
if threshold_value == 0 && !self.get_threshold_factors().is_empty() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
threshold_value cannot be zero, but I guess can be a paranoia check.
...file/models/security-structures/src/roles_matrices_structures/roles/builder/roles_builder.rs
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
This PR slightly changes the existing API around security structures to conform to the UI requirements:
SecurityStructureOfFactorSourceIDs
into the profile to make it possible to save a security structure right after it's been built;selected_factor_sources_for_role_status
intoselected_primary_threshold_factors_status
to validate only the threshold factors of the primary role in isolation. This solves an issue in the hosts when the user selects some threshold factors, proceeds to the next screen, makes the primary role invalid by adding a override factor that breaks the combination rules, and returns to the threshold factors selection at which point the invalid combination error shouldn't be presented if the threshold factors selection is still valid.SelectedPrimaryThresholdFactorsStatus::Invalid
with some error details required in the UI. This makes it possible to display a warning specific to aFactorListKind
like a "Cannot use by itself" warning for the Password section.FactorListKind
parameter to theremove_factor_from_primary
to make it possible to remove either from threshold or override list only. Also, it's possible to have the security structure in an invalid state, specifically now a factor can be both in the threshold and override lists, that's why the removal could no longer be based on the fact that it cannot.