Improve tracker source and first-party cleanup
Surface every CookieSource value in the console: the trackers page filter was missing the HTTP option and the source badge helper had no EXTENSION case, so HTTP-sourced rows could not be filtered and extension-sourced rows rendered the raw enum string. On the backend, the mark-first-party verdict now blanks the stale description on both the catalog row and its uncategorised org tracker patterns. A terminal non-third-party row keeps no vendor link, so a description naming the (now-cleared) vendor would be misleading; the mapping worker only copies descriptions into empty rows and never clears them, so clearing is done explicitly here. Signed-off-by: Émile Ré <emile@probo.com>
This commit is contained in:
@@ -44,12 +44,14 @@ func newCmdMarkFirstParty(f *cmdutil.Factory) *cobra.Command {
|
||||
Long: "Record the terminal FIRST_PARTY verdict on selected common tracker " +
|
||||
"patterns: the artifact has no third party (it is the scanned site's own, " +
|
||||
"a generic library/log key, or an extension key embedding the site origin). " +
|
||||
"Any vendor link is cleared, and the uncategorised org tracker patterns " +
|
||||
"linked to them are remapped (org third party cleared, mapping re-armed) so " +
|
||||
"the pipeline drops the stale vendor; because the verdict is terminal the " +
|
||||
"mapping worker leaves them unattributed. User-categorised and excluded org " +
|
||||
"patterns are left untouched. Selection mirrors 'reenrich'. To re-attribute " +
|
||||
"a row later, use 'link' (which returns it to THIRD_PARTY).",
|
||||
"Any vendor link is cleared and the now-stale description - which may name " +
|
||||
"the wrong vendor - is blanked on both the catalog row and the uncategorised " +
|
||||
"org tracker patterns linked to it. Those org patterns are remapped (org " +
|
||||
"third party cleared, mapping re-armed) so the pipeline drops the stale " +
|
||||
"vendor; because the verdict is terminal the mapping worker leaves them " +
|
||||
"unattributed. User-categorised and excluded org patterns are left " +
|
||||
"untouched. Selection mirrors 'reenrich'. To re-attribute a row later, use " +
|
||||
"'link' (which returns it to THIRD_PARTY).",
|
||||
Args: cobra.NoArgs,
|
||||
}
|
||||
|
||||
@@ -109,6 +111,7 @@ func newCmdMarkFirstParty(f *cmdutil.Factory) *cobra.Command {
|
||||
var (
|
||||
marked int64
|
||||
remapped int64
|
||||
cleared int64
|
||||
)
|
||||
|
||||
if err := pgClient.WithTx(
|
||||
@@ -121,6 +124,10 @@ func newCmdMarkFirstParty(f *cmdutil.Factory) *cobra.Command {
|
||||
return err
|
||||
}
|
||||
|
||||
if _, err = ps.ClearDescriptionByIDs(ctx, tx, ids); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
var tps coredata.TrackerPatterns
|
||||
|
||||
remapped, err = tps.RequestMappingForUncategorisedByCommonTrackerPatternIDs(ctx, tx, ids)
|
||||
@@ -128,6 +135,11 @@ func newCmdMarkFirstParty(f *cmdutil.Factory) *cobra.Command {
|
||||
return err
|
||||
}
|
||||
|
||||
cleared, err = tps.ClearDescriptionForUncategorisedByCommonTrackerPatternIDs(ctx, tx, ids)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
},
|
||||
); err != nil {
|
||||
@@ -136,9 +148,10 @@ func newCmdMarkFirstParty(f *cmdutil.Factory) *cobra.Command {
|
||||
|
||||
_, _ = fmt.Fprintf(
|
||||
out,
|
||||
"Marked %d pattern(s) first-party, remapped %d uncategorised org tracker pattern(s).\n",
|
||||
"Marked %d pattern(s) first-party, remapped %d uncategorised org tracker pattern(s), cleared %d stale org description(s).\n",
|
||||
marked,
|
||||
remapped,
|
||||
cleared,
|
||||
)
|
||||
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user