cp-rotation-skip-feat: Optional rotation and bring-your-own-password for credential-provision#2043
Conversation
E2E verification completeBeyond the 164 unit tests and CI green, this feature was verified against the live kc1035.test AD container. Real-provisioning suite (12 cells, all ✅)
Full Tandem journey (cells 7 & 8 against pre-existing AD accounts)
Dry-run / output=json regression10 dry-run JSON cells + 2 dry-run text cells exercised. The originally-reported Security gate proven at three layers
Mid-run we found and fixed one bug (success-path JSON's |
|
@claude please re-review the changes in
Net: 173 tests passing (+10 new), 3 skipped, CI green. Please verify the fixes are sound and check for any other gaps. |
|
@claude please re-review the changes in
Note on round-2 comments #1 and #3 — those were duplicates of round-1 findings already fixed in Net: 175 tests passing (+2 new structural regression guards). Please verify the fixes and check for any further cascading gaps. |
|
@claude please re-review the changes in
Note: two of your round-3 comments duplicated round-1 findings #1 and #3. I verified both are still fixed in the current code — Net: 178 tests passing (+3 new), 3 skipped, CI re-running. Please look for any further cascading gaps. |
4036aca to
43ceaed
Compare
Change List: - Make rotation: block optional in credential-provision YAML - Add rotation.on_demand flag for manual-trigger rotation mode - Add rotation.rotate_on_provision flag to defer immediate rotation - Add account.existing_password for bring-your-own-password onboarding - Validator INVARIANT-001 rejects push-to-target combinations - Skip _create_ad_user_via_gateway when existing_password is set - Defer AD group-add to after PAM user creation + rotation - Fix NameError in cp --output json --dry-run (absorbs 97dc8893) - Update inline help text; rewrite _dry_run_report
43ceaed to
4b4f41e
Compare
There was a problem hiding this comment.
Code review is billed via overage credits. To resume reviews, an organization admin can raise the monthly limit at claude.ai/admin-settings/claude-code.
Once credits are available, reopen this pull request to trigger a review.
Summary
Extends
credential-provision(aliascp) to support onboarding existing PAM accounts whose passwords must not be rotated at provisioning time. Three new YAML capabilities plus an absorbed bug fix.Customer driver: Tandem.
Tracking
No JIRA ticket — internal tracking via
cp-rotation-skip-feat. Full design docs in.claude-context/Commander/development/cp-rotation-skip-feat/.Changes
YAML schema (all additions are opt-in; existing YAMLs unchanged)
rotation:rotation.on_demandrotation:trueconfigures rotation for manual triggering only (no cron). Mutually exclusive withrotation.schedule.rotation.rotate_on_provisionrotation:true)falsedefers the provisioning-time immediate rotation. Default preserves today's behavior.account.existing_passwordaccount:Behavior matrix (8 supported cells)
See
ARCHITECTURE_AND_DESIGN.md§ Behavior Matrix. The validator rejects the single combination that would push a customer-supplied password to a target (INVARIANT-001).Code touch points
credential_provision.py:DEFAULT_COMPLEXITY = "32,5,5,5,5"constant_determine_password,_should_rotate_on_provision,_should_create_ad_user,_log_existing_password_usehelpers_validate_config—rotation:removed fromrequired_sections; INVARIANT-001 cross-section check added_validate_rotation_section— schedule/on_demand mutex + on_demand + rotate_on_provision type checks_validate_account_section— acceptsexisting_password; keepsinitial_passwordrejection_configure_rotation— branches onon_demandvsschedule_dry_run_report— full rewrite; absorbs commit97dc8893(orphancredential-provision-fixesbranch) which fixed the JSON-mode NameError at line 1027execute()— gate_create_ad_user_via_gatewayonnot existing_password; gate_rotate_immediatelyonrotate_on_provision; emit onelogging.infoline forexisting_passwordusedescriptiontext updatedtest_credential_provision_validation.py,test_credential_provision_execute.py,test_credential_provision_dryrun.py— 71 new testsBreaking Changes
None. Schema relaxation is strict (rotation: becomes optional; new fields are opt-in). Every previously-valid YAML continues to validate and execute identically.
Migration Guide
Not required. The deprecated
pam.rotation:migration error (introduced in a prior commit) is unchanged.Rollback Instructions
Pure code revert (
git revert <merge-commit>). No data migrations, no DB changes, no infrastructure changes. Users with YAMLs that opt into the new fields would see them become invalid validator inputs again — pre-feature behavior.Testing Performed
test_credential_provision_kc1035.pytests pass (regression)cp --output json --dry-runsmoke-tested for all 8 behavior-matrix cells (closes the absorbed NameError fix)_log_existing_password_use)directory_uidresolution)Security Notes
This PR introduces a narrow carve-out from
BLOCKER_KC-1007-2_Password-Generation-Flow_2025-11-17. The previous decision (rejectaccount.initial_passwordbecause it would let YAML dictate the password Commander pushes to a target) is preserved unchanged. The newaccount.existing_passwordfield has deliberately distinct semantics: it represents the password that already exists on the account, and is never pushed to any target.Three enforcement layers:
existing_passwordset._should_create_ad_userskips_create_ad_user_via_gateway(the other push-to-target route) whenexisting_passwordis set.existing_passwordvalue.See
TECHNICAL_DECISIONS.mdADR-001 andSECURITY_ARCHITECTURE.mdfor the full rationale + threat model.Reviewer Guidance
Focus on:
tests/test_credential_provision_validation.py§TestInvariant001.'rotation'fromrequired_sections) doesn't accidentally accept malformed YAMLs. Test file:TestEmptyRotationDict,TestRequiredSectionsRegression.(config: <name>)for the email step. Mention this to anyone tooling against the text format.97dc8893from the orphancredential-provision-fixesbranch is folded into Story 4 here. The customer's reportedcp --output json --dry-runNameError is closed.Checklist