Only write the fbp and fbc cookies when they are useful - #50
Open
loevgaard wants to merge 1 commit into
Open
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## fix/17-pii-in-transport #50 +/- ##
==========================================================
Coverage ? 81.42%
Complexity ? 157
==========================================================
Files ? 33
Lines ? 506
Branches ? 0
==========================================================
Hits ? 412
Misses ? 94
Partials ? 0 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
loevgaard
force-pushed
the
fix/17-pii-in-transport
branch
from
September 7, 2026 12:03
9a99ee8 to
dcbe1cb
Compare
loevgaard
force-pushed
the
fix/28-fbp-cookie
branch
from
September 7, 2026 12:03
eb5e4ab to
4bb3064
Compare
loevgaard
force-pushed
the
fix/17-pii-in-transport
branch
from
September 7, 2026 12:18
dcbe1cb to
af21153
Compare
loevgaard
force-pushed
the
fix/28-fbp-cookie
branch
from
September 7, 2026 12:18
4bb3064 to
0cb43bc
Compare
loevgaard
force-pushed
the
fix/17-pii-in-transport
branch
from
September 7, 2026 12:46
af21153 to
bac5d1e
Compare
loevgaard
force-pushed
the
fix/28-fbp-cookie
branch
from
September 7, 2026 12:46
0cb43bc to
11986eb
Compare
loevgaard
force-pushed
the
fix/17-pii-in-transport
branch
from
September 7, 2026 12:51
bac5d1e to
c9f1d9d
Compare
loevgaard
force-pushed
the
fix/28-fbp-cookie
branch
from
September 7, 2026 12:51
11986eb to
25b8339
Compare
Both cookies were written on every main-request response, including responses of applications with no pixels configured at all. Any Set-Cookie header makes a response uncacheable for shared caches. Skip when no pixels are available and on 4xx/5xx responses, keep redirects because ad clicks land on them, and add cookies.fbp and cookies.fbc switches for sites where the browser pixel writes them. Fixes #28
loevgaard
force-pushed
the
fix/17-pii-in-transport
branch
from
September 7, 2026 12:57
c9f1d9d to
5c3470c
Compare
loevgaard
force-pushed
the
fix/28-fbp-cookie
branch
from
September 7, 2026 12:57
25b8339 to
9040b2c
Compare
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 #28
Problem
StoreFbpSubscriberwrote the_fbpcookie on the response to every main request: JSON and API responses, 404s, 500s, assets served through Symfony, and applications with zero pixels configured. AnySet-Cookieheader makes the response uncacheable for Symfony HttpCache, Varnish and CDNs, so this quietly cost cacheability sitewide for something that may not be used at all.It also never consulted the pixel provider, unlike
AddLibraryToTagBagSubscriberwhich already checksgetPixels().The private
setCookie()method was a predicate whose name read like a command.Change
Both store subscribers now skip when:
fbclidfrom the url;New
cookies.fbpandcookies.fbcoptions (both defaulttrue) remove the corresponding subscriber from the container entirely, for sites where the browser pixel already writes them.setCookie()is renamed toshouldSetCookie(), and the cookie names and the 90 day lifetime move into a sharedCookie\Cookiesclass used by the two contexts that read them and the two subscribers that write them, replacing four magic strings.Tests
Nine unit tests for
StoreFbpSubscriber, its first: cookie set, not http-only so the browser pixel can read it, skipped without pixels, without consent, on a sub request and on a 500, written on a redirect, and the two hour renewal window in both directions. Plus two extension tests for the new switches.