fix(KNO-13317): Remove js-cookie #1450
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This stack of pull requests is managed by Graphite. Learn more about stacking. |
There was a problem hiding this comment.
Stale comment
Risk HIGH: Upgrades
js-cookiefrom 3.0.5 to 3.0.7 to address a security vulnerability.Reasons
package.jsonis modified, which is an automatic HIGH risk trigger per classification rulesyarn.lockis modified with updated dependency resolution- The change itself is a minimal semver patch bump (3.0.5 → 3.0.7) for a single dependency
- The diff is very small (5 additions, 5 deletions across 2 files) with no functional code changes
- No application code, components, or content files are affected
Notes
- Despite the HIGH classification (triggered by
package.json/yarn.lockmodification), the actual risk profile of this change is low — it is a straightforward minor version bump of a single dependency for a security fix- Reviewer should verify the js-cookie 3.0.7 changelog to confirm there are no breaking changes
- Confirm the Vercel preview deployment builds and functions correctly with the updated dependency
- Consider running a quick smoke test on any cookie-dependent functionality (e.g., analytics or consent tracking)
Sent by Cursor Automation: Docs PR classifier
kylemcd
left a comment
There was a problem hiding this comment.
this honestly feels like a complete unnecessary dependency. only used in one place too. might just be better to remove it and refactor the one place it's used.
Won't merge this quite yet, Let me audit the usages across our codebase |
5539139 to
2ffb8b2
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 1ddbb79. Configure here.
c3bbd44 to
efcaa1b
Compare
There was a problem hiding this comment.
Risk HIGH: Removes the js-cookie dependency entirely and replaces it with native document.cookie helpers in lib/attribution.ts.
Reasons
lib/attribution.tsis modified — a.tsfile inlib/triggers HIGH risk per classification rulespackage.jsonis modified (removesjs-cookiefrom dependencies and@types/js-cookiefrom devDependencies), which is an automatic HIGH risk triggeryarn.lockis modified with dependency removals, and contains unresolved merge conflict markers (<<<<<<< HEAD,=======,>>>>>>>) that will break installs- The refactor replaces a well-tested library with custom cookie read/write functions (38 new lines of utility code), which introduces functional risk around cookie encoding, expiry handling, and edge cases
- Total diff is small (46+/21- across 3 files), limiting blast radius despite the HIGH classification
Notes
- Critical: The
yarn.lockfile contains unresolved git merge conflict markers (lines with<<<<<<< HEAD,=======, and>>>>>>>) — this must be resolved before merging oryarn installwill fail - Reviewer should verify the custom
getCookieregex handles all cookie name characters correctly (the regex escapes special chars, but edge cases with encoded values should be considered) - The
setCookiefunction acceptsexpiresas either anumber(days) or aDate— verify the864e5constant (86,400,000 ms = 1 day) produces correct expiry behavior - The
CookieOptions.sameSiteis typed asstringrather than a union type ("Strict" | "Lax" | "None") — consider tightening this for type safety - Confirm the Vercel preview deployment builds and the UTM cookie attribution flow works end-to-end per the author's test steps
Sent by Cursor Automation: Docs PR classifier
| resolved "https://registry.yarnpkg.com/js-cookie/-/js-cookie-3.0.7.tgz#0a53abfc459c8e89c85d7a38eb6cb68714965b8c" | ||
| integrity sha512-z/wZZgDrkNV1eA0ULjM/F9/50Ya8fbzgKneSpoPsXSGd0KnpdtHfOZWK+GcwLk+EZbS4F9RBhU+K2RgzuDaItw== | ||
|
|
||
| ======= |
There was a problem hiding this comment.
Merge conflict markers detected. This file contains unresolved git conflict markers (<<<<<<< HEAD, =======, >>>>>>>) which will cause yarn install to fail. This needs to be resolved before merging.
kylemcd
left a comment
There was a problem hiding this comment.
just need to remove the merge conflict markers and good to go 👍
efcaa1b to
2031800
Compare
2031800 to
b0684e2
Compare
b0684e2 to
5ac8b42
Compare




Description
https://linear.app/knock/issue/KNO-13317/control-marketing-site-docs-small-upgrade-for-js-cookie
@kylemcd pointed out our usage is pretty trivial.
I rewrote the code to remove the dependency entirely instead of maintaining it
Test steps:
Open
http://localhost:3002?utm_source=test&utm_medium=manualVerify that cookies are set correctly
Refresh page without utm headers, verify cookies persist