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

fix: Remove existing Tagular cookie with outdated domain metadata #34

Merged
merged 3 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion audit-ci.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"GHSA-9wv6-86v2-598j",
"GHSA-m6fv-jmcg-4jfg",
"GHSA-cm22-4g7w-348p",
"GHSA-c7qv-q95q-8v27"
"GHSA-c7qv-q95q-8v27",
"GHSA-3xgq-45jj-v275"
],
"moderate": true
}
7 changes: 6 additions & 1 deletion src/cohesion/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,14 @@ export const getCorrelationID = () => {
paramId = uuidv4();
}

// If the tagular correlation ID cookie was set before we added the change to
// specify the domain, it was automatically added to the current domain.
// Always delete the cookie with the current domain
new Cookies().remove(COOKIE_NAME, { domain: window.location.hostname, path: '/' });

const expirationDate = new Date();
expirationDate.setMinutes(expirationDate.getMinutes() + 30); // 30 mins expiration from now
new Cookies().set(COOKIE_NAME, paramId, { expires: expirationDate, domain: `.${getDomain()}` });
new Cookies().set(COOKIE_NAME, paramId, { expires: expirationDate, domain: `.${getDomain()}`, path: '/' });

return paramId;
};
Expand Down
4 changes: 4 additions & 0 deletions src/payment/PaymentPage.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ jest.mock('universal-cookie', () => {
set(cookieName) {
return MockCookies.result[cookieName];
}

remove() {
return undefined;
}
}
return MockCookies;
});
Expand Down
Loading