Skip to content
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

🐛 [RUMF-742] fix cookie creation domain when trackSessionAcrossSubdomains: true #573

Merged
merged 4 commits into from
Oct 19, 2020

Conversation

BenoitZugmeyer
Copy link
Member

Motivation

The function getCurrentSite can yield invalid result when a SDK is initialized multiple times within 1 second.

Changes

  • Cache getCurrentSite result
  • Use an unique cookie name for getCurrentSite

Testing

Setup the RUM SDK on a test page, and print its internal context. Beforehand, clear any cookie on the current domain. Then, refresh the page quickly 2 times: the session should stay the same, and the cookie should be created with a valid domain.


I have gone over the contributing documentation.

@BenoitZugmeyer BenoitZugmeyer requested a review from a team as a code owner October 19, 2020 09:53
Same as `getCurrentSite`, the `areCookiesAuthorized` could return
incorrect results if a SDK is initialized multiple times with different
options, or on multiple domains.  This is a lot less likely to happen
though.
@codecov-io
Copy link

Codecov Report

Merging #573 into master will increase coverage by 0.01%.
The diff coverage is 81.81%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #573      +/-   ##
==========================================
+ Coverage   88.12%   88.13%   +0.01%     
==========================================
  Files          46       46              
  Lines        2357     2359       +2     
  Branches      491      492       +1     
==========================================
+ Hits         2077     2079       +2     
  Misses        280      280              
Impacted Files Coverage Δ
packages/core/src/cookie.ts 90.00% <81.81%> (+0.41%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 618aaa3...1508704. Read the comment docs.

@BenoitZugmeyer BenoitZugmeyer merged commit c225e4f into master Oct 19, 2020
@BenoitZugmeyer BenoitZugmeyer deleted the benoit/fix-get-current-site branch October 19, 2020 15:11
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