KC-1423: fix validation for passwords and passphrase in record creation and updation - #2314
Open
sshrushanth-ks wants to merge 4 commits into
Open
Conversation
- Track generated key-pair passphrases - Centralize v3 add/edit policy validation - Preserve random-password diagnostics - Keep manual passwords exempt from generated-password policy - Add regression coverage across record and NSF commands
sshrushanth-ks
marked this pull request as ready for review
August 24, 2026 11:02
sshrushanth-ks
requested review from
amangalampalli-ks,
pvagare-ks and
sali-ks
August 24, 2026 11:02
sali-ks
approved these changes
Aug 27, 2026
amangalampalli-ks
approved these changes
Aug 27, 2026
instance flags. This fixes two issues: 1. v3 add/edit --generate now validates (was silently bypassed) 2. No cross-field contamination in multi-field records Manual passwords remain unvalidated (handled by BreachWatch).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Password/passphrase complexity policy checks were being applied even to manually typed passwords, so a weak password entered by hand on
record-add,record-update,nsf-record-add,nsf-record-update, and the legacyadd/editv3 commands could get blocked by the enterprise complexity policy. Enforcement is now scoped to passwords produced by$GEN/--generate— manual entries are saved as-is, while generated passwords still get validated and warned on as before.Changes
record_edit.py: Added a_generated_passwordflag onRecordEditMixin, set only when$GEN(legacy or typed field) actually produces a password; addedapply_password_policy_warnings(), which now short-circuits to a no-op unless_generated_passwordis set;record-add/record-updatecall this instead of runningPasswordComplexityEnforcer.validate_record()unconditionallynested_share_folder/record_commands.py: Removed the duplicated_check_password_policymethods fromnsf-record-add/nsf-record-updatein favor of the sharedapply_password_policy_warnings(); resets_generated_password = Falseat the start of each execute and sets it when$GENyields a passwordrecordv3.py: In legacyadd/edit, complexity validation now only runs when the password came from--generate/--generate-rules/--generate-lengthand no explicit--passwordwas supplied, instead of always validatingtest_nested_share_folder.py: Renamed and flipped the weak-password tests (test_add_record_rejects_weak_password_without_force→test_add_record_allows_manual_weak_password, same for update) to assert the create/update call now succeeds for manual weak passwordstest_passphrase_enforcement.py: Added tests forRecordEditMixin.apply_password_policy_warningsconfirming manual passwords produce no warnings while generated ones still surface complexity/--forcewarnings