Filter browser-extension cookies from detection
Cookies set by browser extensions are not the website operator's compliance responsibility. This adds stack-trace inspection to filter out extension-originated document.cookie writes, and annotates pre-existing cookies with a source field so operators can triage them separately. Introduces a CookieSource enum (SCRIPT / PRE_EXISTING) across the full stack: PostgreSQL, coredata, service, HTTP handler, and GraphQL schema. On conflict, source is upgraded from PRE_EXISTING to SCRIPT when a page script is later observed setting the cookie. Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
@@ -189,6 +189,7 @@ func (h *Handler) handlePostConsent(w http.ResponseWriter, r *http.Request) {
|
||||
type detectedCookieEntry struct {
|
||||
Name string `json:"name"`
|
||||
Duration string `json:"duration"`
|
||||
Source string `json:"source"`
|
||||
}
|
||||
|
||||
type reportDetectedCookiesBody struct {
|
||||
@@ -227,11 +228,20 @@ func (h *Handler) handleReportDetectedCookies(w http.ResponseWriter, r *http.Req
|
||||
continue
|
||||
}
|
||||
|
||||
var source coredata.CookieSource
|
||||
switch strings.TrimSpace(c.Source) {
|
||||
case "pre-existing":
|
||||
source = coredata.CookieSourcePreExisting
|
||||
default:
|
||||
source = coredata.CookieSourceScript
|
||||
}
|
||||
|
||||
detected = append(
|
||||
detected,
|
||||
cookiebanner.DetectedCookie{
|
||||
Name: name,
|
||||
Duration: strings.TrimSpace(c.Duration),
|
||||
Source: source,
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user