From da1789503bc70f0291a5a306bdbf4a82ce0981cc Mon Sep 17 00:00:00 2001 From: Kuba Orlik Date: Fri, 26 Nov 2021 19:15:43 +0100 Subject: [PATCH] Better HAR sorting, option to mention pop-up being closed --- extended-request.ts | 24 +++++++++++++++++++-- report-window/email-template-2-controls.tsx | 22 +++++++++++++++++++ report-window/email-template-2.tsx | 21 +++++++++++++----- report-window/har-converter.tsx | 18 +++++----------- stolen-data-entry.ts | 23 ++++++++++++++------ 5 files changed, 81 insertions(+), 27 deletions(-) diff --git a/extended-request.ts b/extended-request.ts index 5914b24..1202e2d 100644 --- a/extended-request.ts +++ b/extended-request.ts @@ -279,7 +279,7 @@ export default class ExtendedRequest { cookies: [], content: { mimeType: "text/plain", - size: 15, + size: this.getBalancedPriority(), encoding: "base64", text: "ZG9lc24ndCBtYXR0ZXIK", }, @@ -304,7 +304,27 @@ export default class ExtendedRequest { }; } - getMaxPriority() { + getMaxPriority(): number { return Math.max(...this.stolenData.map((entry) => entry.getPriority())); } + + getBalancedPriority(): number { + let result = 0; + if (this.stolenData.some((e) => e.exposesPath())) { + result += 50; + } + if (this.stolenData.some((e) => e.exposesHost())) { + result += 50; + } + if (this.hasCookie()) { + result += 50; + } + if (this.stolenData.some((e) => e.classification === "location")) { + result += 300; + } + if (this.url.includes("facebook")) { + result += 50; + } + return result; + } } diff --git a/report-window/email-template-2-controls.tsx b/report-window/email-template-2-controls.tsx index ac790e9..23b1e09 100644 --- a/report-window/email-template-2-controls.tsx +++ b/report-window/email-template-2-controls.tsx @@ -92,8 +92,30 @@ export default function EmailTemplate2Controls({ + + {config.popup_action === "closed" ? ( +
+ + + setConfig((v) => ({ ...v, popup_closed_how: e.target.value })) + } + /> +
+ ) : ( + "" + )} {config.popup_type !== "none" ? (
- ) : ( + ) : config.popup_action === "accepted" ? ( <> o ile po wejściu na stronę wcisnąłem w wyskakującym okienku przycisk „{config.popup_accept_all_text}”, o tyle nie stanowi to według mnie @@ -206,10 +208,20 @@ export default function EmailTemplate2({ osobowych, gdyż nie spełnia warunku dobrowolności wspomnianego w Art. 4. pkt 11. RODO. + ) : config.popup_action === "closed" ? ( + <> + zamknąłem okienko pytające o zgodę poprzez {config.popup_closed_how} + . Nie może być to uznane za zgodę, bo nie spełnia to warunku + jednoznaczności opisanego w motywie (32) Rozporządzenia 2016/679.{" "} + + ) : ( + "" )}{" "} Za zgodę nie można też uznać posiadania włączonej obsługi cookies w - przeglądarce, jakichkolwiek innych ustawień przeglądarki, ani pasywnych - działań z mojej strony (np. „kontynuowanie korzystania ze strony”) + przeglądarce (gdyż aby zgoda była ważna, musi być szczegółowa dla + każdego celów z osobna), jakichkolwiek innych ustawień przeglądarki, ani + pasywnych działań z mojej strony (np. „kontynuowanie korzystania ze + strony”) {config.popup_mentions_passive_consent ? ( <> {" "} @@ -382,5 +394,4 @@ export default function EmailTemplate2({

); - return result; } diff --git a/report-window/har-converter.tsx b/report-window/har-converter.tsx index 58ca4ae..f79e7cb 100644 --- a/report-window/har-converter.tsx +++ b/report-window/har-converter.tsx @@ -29,29 +29,21 @@ function generateFakeHAR(entries: StolenDataEntry[]) { } else if (request1.shorthost > request2.shorthost) { return 1; } else { - return request2.getMaxPriority() - request1.getMaxPriority(); + return request2.getBalancedPriority() - request1.getBalancedPriority(); } }) .filter((_, index, array) => { - if (index !== 0 && array[index].shorthost == array[index - 1].shorthost) { + if (index == 0) return true; + if (array[index].shorthost == array[index - 1].shorthost) { return false; } return true; }) .sort( - (entry1, entry2) => entry2.getMaxPriority() - entry1.getMaxPriority() + (entry1, entry2) => + entry2.getBalancedPriority() - entry1.getBalancedPriority() ); - console.log( - "GENERATEHAR! Got", - entries.length, - "entries, ", - unique(entries.map((e) => e.request)), - "requests. Filtered down to", - requests.length, - "requests" - ); - return { log: { version: "1.2", diff --git a/stolen-data-entry.ts b/stolen-data-entry.ts index feebc1e..b405285 100644 --- a/stolen-data-entry.ts +++ b/stolen-data-entry.ts @@ -214,13 +214,7 @@ export class StolenDataEntry extends EventEmitter { } exposesOrigin(): boolean { - const result = [this.value, decodeURIComponent(this.value)].some( - (haystack) => - haystack.includes(getshorthost(this.request.origin)) || - (this.request.originalPathname !== "/" && - haystack.includes(this.request.originalPathname)) - ); - return result; + return this.exposesHost() || this.exposesPath(); } autoMark() { @@ -245,4 +239,19 @@ export class StolenDataEntry extends EventEmitter { this.mark(); } } + + exposesPath() { + return ( + this.request.originalPathname !== "/" && + [this.value, decodeURIComponent(this.value)].some((haystack) => + haystack.includes(this.request.originalPathname) + ) + ); + } + + exposesHost() { + return [this.value, decodeURIComponent(this.value)].some((haystack) => + haystack.includes(getshorthost(this.request.origin)) + ); + } }