Skip to content

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

Draft
sshrushanth-ks wants to merge 4 commits into
releasefrom
passphrase-policy-validation-fix
Draft

sshrushanth-ks wants to merge 4 commits into
releasefrom
passphrase-policy-validation-fix

Conversation

@sshrushanth-ks

@sshrushanth-ks sshrushanth-ks commented Aug 28, 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

  • Core validation refactor (record_edit.py, recordv3.py, enforcement.py): Added validate_generated_password(password, algorithm) to validate at generation site with correct allow_passphrase_fallback flag. Removed instance flags. Fixed v3 --generate blocker by renaming enforce_generated_password_policy() parameter from password to manual_password. Added allow_passphrase_fallback parameter to enforcement methods so generated random passwords preserve their error messages.

  • nested_share_folder/record_commands.py: Added warning checks after field processing in add/update execute methods. Warnings log and block execution unless --force is used. Removed duplicate validation helpers.

  • Tests (test_nested_share_folder.py, test_passphrase_enforcement.py, test_passphrase_generator.py): Updated 4 NSF tests to expect manual weak passwords to be allowed. Added tests confirming manual passwords skip warnings while generated passwords surface errors. Updated keyPair test to verify validate_generated_password() is called. Fixed patch path in test_add_record.

@sshrushanth-ks sshrushanth-ks self-assigned this Aug 28, 2026
@sshrushanth-ks
sshrushanth-ks marked this pull request as ready for review August 28, 2026 11:17

@craiglurey craiglurey left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don’t agree with this. The whole point of enterprise enforcements is to ensure that users can’t type or generate a weak password. The functionality of Commander needs to be the same as the user on the vault. I'd like to understand where this requirement came from.

@amangalampalli-ks

Copy link
Copy Markdown
Contributor

I don’t agree with this. The whole point of enterprise enforcements is to ensure that users can’t type or generate a weak password. The functionality of Commander needs to be the same as the user on the vault. I'd like to understand where this requirement came from.

We identified a bug in Commander: when both password and passphrase policies were applied, it incorrectly validated constraints across fields - for example, displaying a passphrase policy error while a user was entering a password.
After reviewing the Vault’s behavior, we found that it enforces these policies only in the generator, not during manual field entry. We therefore planned to update Commander to align with the Vault’s current behavior.

…on and updation (#2314)

* fix validation for passwords and passphrase in record creation and updation

* Fix generated password policy validation after review

- 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

* Validate generated passwords at generation site instead of post-hoc via
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).

* updated failing test
@sshrushanth-ks
sshrushanth-ks force-pushed the passphrase-policy-validation-fix branch from ed58f2e to 3321146 Compare October 15, 2026 05:49
@sshrushanth-ks
sshrushanth-ks marked this pull request as draft October 15, 2026 05:50
@sshrushanth-ks
sshrushanth-ks requested review from craiglurey and removed request for craiglurey and sk-keeper October 15, 2026 05:50

This branch has not been deployed

No deployments
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