Skip to content

KC-1423: fix validation for passwords and passphrase in record creation and updation - #2314

Open
sshrushanth-ks wants to merge 4 commits into
passphrase-policy-validation-fixfrom
passphrase-policy-validation-fix-int
Open

KC-1423: fix validation for passwords and passphrase in record creation and updation#2314
sshrushanth-ks wants to merge 4 commits into
passphrase-policy-validation-fixfrom
passphrase-policy-validation-fix-int

Conversation

@sshrushanth-ks

@sshrushanth-ks sshrushanth-ks commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

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 legacy add/edit v3 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_password flag on RecordEditMixin, set only when $GEN (legacy or typed field) actually produces a password; added apply_password_policy_warnings(), which now short-circuits to a no-op unless _generated_password is set; record-add/record-update call this instead of running PasswordComplexityEnforcer.validate_record() unconditionally
  • nested_share_folder/record_commands.py: Removed the duplicated _check_password_policy methods from nsf-record-add/nsf-record-update in favor of the shared apply_password_policy_warnings(); resets _generated_password = False at the start of each execute and sets it when $GEN yields a password
  • recordv3.py: In legacy add/edit, complexity validation now only runs when the password came from --generate/--generate-rules/--generate-length and no explicit --password was supplied, instead of always validating
  • test_nested_share_folder.py: Renamed and flipped the weak-password tests (test_add_record_rejects_weak_password_without_forcetest_add_record_allows_manual_weak_password, same for update) to assert the create/update call now succeeds for manual weak passwords
  • test_passphrase_enforcement.py: Added tests for RecordEditMixin.apply_password_policy_warnings confirming manual passwords produce no warnings while generated ones still surface complexity/--force warnings

@sshrushanth-ks sshrushanth-ks self-assigned this Aug 24, 2026
@sshrushanth-ks sshrushanth-ks changed the title fix validation for passwords and passphrase in record creation and updation KC-1423: fix validation for passwords and passphrase in record creation and updation Aug 24, 2026
- 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
sshrushanth-ks marked this pull request as ready for review August 24, 2026 11:02
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).
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.

3 participants