-
Notifications
You must be signed in to change notification settings - Fork 15
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
[PM-11894] update password generator policy #948
base: main
Are you sure you want to change the base?
Conversation
…to follow overridePasswordType
No New Or Fixed Issues Found |
@@ -10,7 +10,7 @@ enum PolicyOptionType: String { | |||
case capitalize | |||
|
|||
/// A policy option for the default type of the password generator. | |||
case defaultType | |||
case overridePasswordType |
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.
⛏️ The documentation comment should probably be updated as well
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.
updated!
@@ -48,6 +48,9 @@ struct PasswordGenerationOptions: Codable, Equatable { | |||
|
|||
/// The separator to put between words in the passphrase. | |||
var wordSeparator: String? | |||
|
|||
/// Whether the password type should be enforced or not | |||
var overridePasswordType: Bool? |
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 is this boolean optional? What does a nil value represent as different from a false value?
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.
should never be nil actually, removed the optional
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.
Actually, this is making the test_decode_empty on PasswordGenerationOptionsTests
to fail.
I'm afraid it might throw an exception when calling the decodePasswordOptions and there is no overridePasswordType
.
Not sure on what scenarios this is used
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.
This model is persisted to UserDefaults to maintain the user's options between app runs. The optional bool allows decoding to succeed even if it doesn't exist in the previously persisted model.
} | ||
// if the stringValue is NOT emptu or null, overridePasswordType should be true | ||
options.overridePasswordType = !(policy[.overridePasswordType]?.stringValue?.isEmpty ?? true) |
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.
🤔 Maybe I'm misunderstanding the logic, but doesn't putting this here mean that the options.overridePasswordType != true
on line 187 will always be true for the first policy?
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.
you are right I messed up here.
It would work for most of the scenario but would fail on some edge cases. Fixed it and changed tests in order to catch this.
…wiftformat changes on PolicyService
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.
Seems reasonable so far, but we'll want to make a change so we don't have failing tests.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #948 +/- ##
=======================================
Coverage 88.68% 88.68%
=======================================
Files 622 622
Lines 39374 39374
=======================================
Hits 34918 34918
Misses 4456 4456 ☔ View full report in Codecov by Sentry. |
🎟️ Tracking
https://bitwarden.atlassian.net/browse/PM-11894
📔 Objective
Renaming property
defaultValue
tooverridePasswordType
as it is the name used on the other clientsUpdating the behaviour so that it forces the user to use the
overridePasswordType
on the password generator📸 Screenshots
Screen.Recording.2024-09-18.at.17.39.41.mov
⏰ Reminders before review
🦮 Reviewer guidelines
:+1:
) or similar for great changes:memo:
) or ℹ️ (:information_source:
) for notes or general info:question:
) for questions:thinking:
) or 💭 (:thought_balloon:
) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion:art:
) for suggestions / improvements:x:
) or:warning:
) for more significant problems or concerns needing attention:seedling:
) or ♻️ (:recycle:
) for future improvements or indications of technical debt:pick:
) for minor or nitpick changes