Harden user creation from invite#49521
Conversation
Derive the authentication mode from the invite record instead of client input during invite acceptance.
|
@coderabbitai full review |
✅ Action performedFull review finished. |
WalkthroughSSO-only invitations now derive authentication mode exclusively from invite settings. Password-based acceptance is rejected for SSO invites, including empty password fields, while non-SSO invites require a non-empty password. User creation propagates SSO, SSO invite, and MFA settings from the invitation. Integration tests cover rejected password flows and successful SSO acceptance. A changelog entry documents the fix. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@server/service/integration_core_test.go`:
- Around line 3106-3121: Add a test alongside “password invite rejects sso
payload without password” covering a non-SSO invite with SSOInvite set to true
and a weak password. Submit the user creation request and assert it is rejected
for password complexity, then verify no user was created for the invite email.
In `@server/service/users.go`:
- Around line 445-448: Update the non-SSO branch in VerifyInviteCreate to
validate the supplied password against the existing password-complexity
requirements after confirming it is present, reusing the established validation
helper and error behavior. Keep the missing-password check intact and ensure
weak passwords cannot proceed when SSOInvite was falsely set.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: b011b0b0-b281-43c7-9893-1131fe4b9f36
📒 Files selected for processing (3)
changes/16783-sso-invite-password-acceptanceserver/service/integration_core_test.goserver/service/users.go
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #49521 +/- ##
==========================================
- Coverage 68.07% 67.81% -0.27%
==========================================
Files 3882 3887 +5
Lines 246400 247510 +1110
Branches 13135 13135
==========================================
+ Hits 167746 167853 +107
- Misses 63514 64506 +992
- Partials 15140 15151 +11
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Derive the authentication mode from the invite record instead of client input during invite acceptance.
Checklist for submitter
If some of the following don't apply, delete the relevant line.
changes/,orbit/changes/oree/fleetd-chrome/changes.See Changes files for more information.
Testing
Summary by CodeRabbit