Track source on detected storage trackers
The cookie detector tags every detection with a source (script, pre-existing, http) but the storage detector did not, so storage rows always landed in detected_trackers with source NULL even though the SDK already distinguishes wrapper writes from pre-load scans. Plumb a "script"/"pre-existing" source from the storage detector through the report endpoint into DetectedStorageItem, so the column gets populated for localStorage, sessionStorage, indexedDB and cacheStorage entries. No schema change is needed: detected_trackers already accepts CookieSource values regardless of tracker_type, and the existing row renders the badge as soon as it is non-null. Signed-off-by: Émile Ré <emile@probo.com>
This commit is contained in:
@@ -383,6 +383,7 @@ type detectedStorageEntry struct {
|
||||
Key string `json:"key"`
|
||||
StorageType string `json:"storage_type"`
|
||||
ValueSize *int `json:"value_size"`
|
||||
Source string `json:"source"`
|
||||
InitiatorURL *string `json:"initiator_url,omitempty"`
|
||||
}
|
||||
|
||||
@@ -474,12 +475,22 @@ func (h *Handler) handleReportDetectedTrackers(w http.ResponseWriter, r *http.Re
|
||||
continue
|
||||
}
|
||||
|
||||
var source coredata.CookieSource
|
||||
|
||||
switch strings.TrimSpace(s.Source) {
|
||||
case "pre-existing":
|
||||
source = coredata.CookieSourcePreExisting
|
||||
default:
|
||||
source = coredata.CookieSourceScript
|
||||
}
|
||||
|
||||
req.Storage = append(
|
||||
req.Storage,
|
||||
cookiebanner.DetectedStorageItem{
|
||||
Key: key,
|
||||
StorageType: storageType,
|
||||
ValueSize: s.ValueSize,
|
||||
Source: &source,
|
||||
InitiatorURL: sanitizeInitiatorURL(s.InitiatorURL),
|
||||
},
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user