Repository navigation
Fix isSet() substring matching in ignoreCookie - #409
Merged
electerious merged 1 commit intoOct 2, 2026
Merged
Conversation
isSet() detected the ackee_ignore cookie with String.includes(), so any cookie header containing "ackee_ignore=1" counted as an opt-out - including unrelated cookies such as "x=ackee_ignore=1", "not_ackee_ignore=1" or "ackee_ignore=10". Since isSet() gates the ignore path in createRecord, updateRecord and createAction, that silently discarded visitor data. Parse cookie name/value boundaries instead, and add coverage for test/utils/ignoreCookie.js, which had none. Fixes electerious#408
|
@Davidowi2 is attempting to deploy a commit to the Tobias Reich's projects Team on Vercel. A member of the Team first needs to authorize it. |
Owner
|
Thanks a lot for the fix and help! :) |
electerious
added a commit
that referenced
this pull request
Oct 2, 2026
Contributor
Author
|
No probs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #408
Problem
isSet()insrc/utils/ignoreCookie.jsdetected theackee_ignorecookie with a plain substring match:That returns
truefor any cookie header containingackee_ignore=1, regardless of where the text appears.isSetruns once per request insrc/utils/createContext.js:22, andisIgnoredgates the ignore path increateRecord(src/resolvers/records.js:50),updateRecord(src/resolvers/records.js:92) andcreateAction(src/resolvers/actions.js:21) — so an unrelated cookie silently discards visitor data.Running the current implementation:
isSet()ackee_ignore=1truetruea=1; ackee_ignore=1; b=2truetrueackee_ignore=10truefalsenot_ackee_ignore=1truefalsex=ackee_ignore=1truefalsefoo=bar; baz=ackee_ignore=1truefalseackee_ignore=0falsefalsefalsefalseChange
Parse cookie name/value boundaries rather than matching a substring:
Adds
test/utils/ignoreCookie.js.15 of 30modules insrc/utilshad no test, including this one — the new test fails against the previous implementation and passes with this change.npm run lintandnpm run test(41 unit tests) pass locally. Happy to adjust the approach if you'd prefer something different — this is a small correctness fix, so please treat it as a starting point for discussion rather than a finished contribution.