-
Notifications
You must be signed in to change notification settings - Fork 12.9k
regression: fixes undefined user-agent on device login detection #37642
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Looks like this PR is ready to merge! 🎉 |
|
WalkthroughThis PR addresses a regression where Login Detection emails displayed undefined device information. It modifies the user-agent extraction logic in session management to handle both Headers instances and plain object header formats, preventing undefined values from being included in the email notification. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~5–10 minutes
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro Disabled knowledge base sources:
📒 Files selected for processing (2)
🧰 Additional context used📓 Path-based instructions (1)**/*.{ts,tsx,js}📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)
Files:
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
🔇 Additional comments (2)
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 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## release-7.13.0 #37642 +/- ##
=================================================
Coverage ? 68.93%
=================================================
Files ? 3360
Lines ? 114278
Branches ? 20561
=================================================
Hits ? 78780
Misses ? 33405
Partials ? 2093
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
3344f77 to
0e87ff3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR addresses a regression where the Login Detection email was being sent with undefined user-agent data. The issue occurred because connection.httpHeaders has different formats depending on the authentication type: it's a Headers instance during form login (type: "password") but a plain object during session resume (type: "resume"). The fix adds an instance check to handle both cases correctly.
Key Changes:
- Added type checking for
connection.httpHeadersto handle bothHeadersinstance and plain object formats - Uses
.get('user-agent')method forHeadersinstances and bracket notation for plain objects
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| apps/meteor/ee/server/lib/deviceManagement/session.ts | Updated user-agent extraction to handle both Headers instance and plain object formats via instanceof check |
| .changeset/silly-cooks-guess.md | Added changeset documenting the fix for undefined user-agent in Login Detection emails |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
/backport 7.10.6 |
|
Sorry, I couldn't do that backport because of conflicts. Could you please solve them? you can do so by running the following commands: after that just run |
|
/backport 7.10.6 |
|
Pull request #38010 added to Project: "Patch 7.10.6" |
Proposed changes (including videos or screenshots)
This PR aims at fixing a recurring issue, previously thought to be fixed on #36880 and #37493.
The behavior happens because when logging into the application via login form (
type: "password"), the event is emitted passingconnection.httpHeadersas an instance ofHeaders, but when it's reusing the connection from thews(type: "resume"),connection.httpHeadersis aplain object.This difference in the object's format depending on where it's being emitted from caused issues with both previous PR "fixes".
Adding a type/instance check on
httpHeadersbefore accessing it allows us to extractuser-agentin both cases.Issue(s)
CORE-1544
Steps to test or reproduce
Further comments
This is being further investigated in parallel to this quick fix, so we can fix the difference in format behavior without the need for this check.
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.