Add option to autoselect only for a given cluster. Improvements in classification

This commit is contained in:
Kuba Orlik 2021-11-24 22:04:47 +01:00
parent da49fe5f42
commit 8d88ba7506
2 changed files with 26 additions and 16 deletions

View File

@ -105,12 +105,22 @@ export default function StolenDataCluster({
<h2> <h2>
<a href={"https://" + cluster.id}>{cluster.id}</a>{" "} <a href={"https://" + cluster.id}>{cluster.id}</a>{" "}
{cluster.hasCookies() ? "🍪" : ""} x{cluster.requests.length}{" "} {cluster.hasCookies() ? "🍪" : ""} x{cluster.requests.length}{" "}
{/* <a
* href="#"
* style={{ fontSize: "10px" }}
* onClick={() => getMemory().removeCookiesFor(origin, shorthost)}
* >
* Wyczyść cookiesy
* </a> */}
<a <a
href="#" href="#"
style={{ fontSize: "10px" }} style={{ fontSize: "10px" }}
onClick={() => getMemory().removeCookiesFor(origin, shorthost)} onClick={(e) => {
cluster.autoMark();
e.preventDefault();
}}
> >
Wyczyść cookiesy Zaznacz auto
</a> </a>
</h2> </h2>
<div> <div>

View File

@ -173,16 +173,7 @@ export class StolenDataEntry extends EventEmitter {
private classify(): keyof typeof Classifications { private classify(): keyof typeof Classifications {
let result: keyof typeof Classifications; let result: keyof typeof Classifications;
if ( if (this.exposesOrigin()) {
[this.value, decodeURIComponent(this.value)].some((haystack) =>
[
this.request.origin,
this.request.originalURL,
this.request.originalPathname,
getshorthost(this.request.origin),
].some((needle) => haystack.includes(needle))
)
) {
result = "history"; result = "history";
} else { } else {
result = "id"; result = "id";
@ -223,10 +214,13 @@ export class StolenDataEntry extends EventEmitter {
} }
exposesOrigin(): boolean { exposesOrigin(): boolean {
return ( const result = [this.value, decodeURIComponent(this.value)].some(
this.value.includes(getshorthost(this.request.origin)) || (haystack) =>
this.value.includes(this.request.originalPathname) haystack.includes(getshorthost(this.request.origin)) ||
(this.request.originalPathname !== "/" &&
haystack.includes(this.request.originalPathname))
); );
return result;
} }
autoMark() { autoMark() {
@ -236,10 +230,16 @@ export class StolenDataEntry extends EventEmitter {
this.name.toLowerCase().includes("id") || this.name.toLowerCase().includes("id") ||
this.name.toLowerCase().includes("cookie") || this.name.toLowerCase().includes("cookie") ||
this.name.toLowerCase().includes("ga") || this.name.toLowerCase().includes("ga") ||
this.name.toLowerCase().includes("ses") ||
this.name.toLowerCase().includes("fb")) && this.name.toLowerCase().includes("fb")) &&
this.value.length > MIN_COOKIE_LENGTH_FOR_AUTO_MARK) this.value.length > MIN_COOKIE_LENGTH_FOR_AUTO_MARK)
) { ) {
if (this.request.shorthost.includes("google") && this.name == "CONSENT") { if (
(this.request.shorthost.includes("google") ||
this.request.shorthost.includes("youtube")) &&
this.name == "CONSENT"
) {
// this cookie contains "YES" and might distract the person looking at it into thinking i gave consent on the reported site
return; return;
} }
this.mark(); this.mark();