Skip to content

[PM-39454] feat(km): record the user key id on key-establishing flows - #8110

Draft
quexten wants to merge 2 commits into
km/user-key-id-04-repository-methodsfrom
km/user-key-id-05-write-path
Draft

[PM-39454] feat(km): record the user key id on key-establishing flows#8110
quexten wants to merge 2 commits into
km/user-key-id-04-repository-methodsfrom
km/user-key-id-05-write-path

Conversation

@quexten

@quexten quexten commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

This PR plumbs through key ids on flows that set the key id.

  • TDE
  • Register Password
  • Key Connector
  • Key rotations
    should all gain the user key id and set it during the flow.

It also adds rejections for password changes and kdf changes that supply the wrong key id.

@codecov

codecov Bot commented Jul 31, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 62.90%. Comparing base (5c08749) to head (dc7519e).

Files with missing lines Patch % Lines
...gement/Models/Requests/SetUserKeyIdRequestModel.cs 0.00% 2 Missing ⚠️
...ey/Implementations/RotateUserAccountKeysCommand.cs 50.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@                           Coverage Diff                            @@
##           km/user-key-id-04-repository-methods    #8110      +/-   ##
========================================================================
- Coverage                                 67.38%   62.90%   -4.49%     
========================================================================
  Files                                      2303     2304       +1     
  Lines                                    100349   100400      +51     
  Branches                                   9034     9041       +7     
========================================================================
- Hits                                      67622    63152    -4470     
- Misses                                    30445    35062    +4617     
+ Partials                                   2282     2186      -96     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@quexten
quexten force-pushed the km/user-key-id-05-write-path branch from cd4e688 to 4c3dd87 Compare July 31, 2026 13:33
@quexten
quexten force-pushed the km/user-key-id-05-write-path branch from 4c3dd87 to 86ae77d Compare July 31, 2026 15:20
@quexten quexten added ai-review Request a Claude code review t:feature Change Type - Feature Development labels Jul 31, 2026
@github-actions

github-actions Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Claude Code is reviewing this pull request...

If this comment does not update with results, check the Actions log.

Comment thread src/Core/Auth/UserFeatures/UserMasterPassword/MasterPasswordService.cs Outdated
quexten added 2 commits August 1, 2026 02:21
Lets clients report which user key they wrapped their unlock data under, on the flows that
establish a user key: registration, setting or changing a master password, setting a Key
Connector key, submitting account keys, and key rotation.

The field is optional everywhere — a client that predates it sends nothing and the request
stays valid. It is deliberately excluded from SetKeyConnectorKeyRequestModel.IsV2Request()
for the same reason. UserKeyIdAttribute rejects a malformed value at the model-binding
boundary so a bad string fails as a 400 rather than as an exception deeper in the flow.

Rotation assigns the key id unconditionally: a rotation replaces the user key, so a client
that supplies no key id leaves the server with none rather than one that names a key that
no longer exists.

The key ids are recorded but not yet checked against what the server has stored; that
validation is the next commit.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-review Request a Claude code review t:feature Change Type - Feature Development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant