Compare commits
No commits in common. "e989d6d33dd49eeb07bcf6185d9e3b03ab9a9755" and "e8075b384dd31f8226be68a266bba8fa50d8a00e" have entirely different histories.
e989d6d33d
...
e8075b384d
@ -17,7 +17,6 @@ export default class ExtendedRequest {
|
||||
public shorthost: string;
|
||||
public requestHeaders: Request["requestHeaders"];
|
||||
public originalURL: string;
|
||||
public origin: string;
|
||||
public initialized = false;
|
||||
public stolenData: StolenDataEntry[];
|
||||
|
||||
@ -35,13 +34,19 @@ export default class ExtendedRequest {
|
||||
} else {
|
||||
url = (this.data as any).frameAncestors[0].url;
|
||||
}
|
||||
this.originalURL = url;
|
||||
this.origin = new URL(url).origin;
|
||||
this.originalURL = new URL(url).origin;
|
||||
}
|
||||
|
||||
getOriginalURL(): string {
|
||||
if (!this.initialized) {
|
||||
throw new Error("initialize first!!");
|
||||
}
|
||||
return this.originalURL;
|
||||
}
|
||||
|
||||
isThirdParty() {
|
||||
const request_url = new URL(this.data.url);
|
||||
const origin_url = new URL(this.originalURL);
|
||||
const origin_url = new URL(this.getOriginalURL());
|
||||
if (request_url.host.includes(origin_url.host)) {
|
||||
return false;
|
||||
}
|
||||
@ -60,7 +65,7 @@ export default class ExtendedRequest {
|
||||
}
|
||||
|
||||
exposesOrigin() {
|
||||
const url = new URL(this.origin);
|
||||
const url = new URL(this.getOriginalURL());
|
||||
const host = url.host;
|
||||
const path = url.pathname;
|
||||
return (
|
||||
|
12
memory.ts
12
memory.ts
@ -7,19 +7,19 @@ export default class Memory extends EventEmitter {
|
||||
origin_to_history = {} as Record<string, Record<string, RequestCluster>>;
|
||||
async register(request: ExtendedRequest) {
|
||||
await request.init();
|
||||
console.log("registering request for", request.origin);
|
||||
console.log("registering request for", request.originalURL);
|
||||
if (!request.isThirdParty()) {
|
||||
return;
|
||||
}
|
||||
if (!this.origin_to_history[request.origin]) {
|
||||
this.origin_to_history[request.origin] = {};
|
||||
if (!this.origin_to_history[request.originalURL]) {
|
||||
this.origin_to_history[request.originalURL] = {};
|
||||
}
|
||||
const shorthost = getshorthost(new URL(request.url).host);
|
||||
if (!this.origin_to_history[request.origin][shorthost]) {
|
||||
if (!this.origin_to_history[request.originalURL][shorthost]) {
|
||||
const cluster = new RequestCluster(shorthost);
|
||||
this.origin_to_history[request.origin][shorthost] = cluster;
|
||||
this.origin_to_history[request.originalURL][shorthost] = cluster;
|
||||
}
|
||||
this.origin_to_history[request.origin][shorthost].add(request);
|
||||
this.origin_to_history[request.originalURL][shorthost].add(request);
|
||||
this.emit("change");
|
||||
}
|
||||
|
||||
|
@ -1,47 +1,8 @@
|
||||
import React, { useState } from "react";
|
||||
import React from "react";
|
||||
import ReactDOM from "react-dom";
|
||||
import { getMemory } from "../memory";
|
||||
import { RequestCluster } from "../request-cluster";
|
||||
import { Classifications } from "../stolen-data-entry";
|
||||
import { getDate } from "../util";
|
||||
|
||||
const emailClassifications: Record<keyof typeof Classifications, string> = {
|
||||
id: "sztucznie nadane mi ID",
|
||||
history: "część mojej historii przeglądania",
|
||||
};
|
||||
|
||||
type PopupState = "not_clicked" | "clicked_but_invalid";
|
||||
|
||||
function DomainSummary({ cluster }: { cluster: RequestCluster }) {
|
||||
return (
|
||||
<li>
|
||||
Właściciel domeny {cluster.id} otrzymał:{" "}
|
||||
<ul>
|
||||
{cluster
|
||||
.getMarkedEntries()
|
||||
.sort((entryA, entryB) => (entryA.value > entryB.value ? -1 : 1))
|
||||
.reduce((acc, entry, index, arr) => {
|
||||
if (index === 0) {
|
||||
return [entry];
|
||||
}
|
||||
if (entry.value != arr[index - 1].value) {
|
||||
acc.push(entry);
|
||||
}
|
||||
return acc;
|
||||
}, [])
|
||||
.map((entry) => (
|
||||
<li>
|
||||
{emailClassifications[entry.classification]} w {entry.source}
|
||||
(<code>{entry.name.trim()}</code>)
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</li>
|
||||
);
|
||||
}
|
||||
|
||||
function Report() {
|
||||
const [popupState, setPopupState] = useState<PopupState>("not_clicked");
|
||||
const origin = new URL(document.location.toString()).searchParams.get(
|
||||
"origin"
|
||||
);
|
||||
@ -103,35 +64,6 @@ function Report() {
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
<label htmlFor="popupState">Status okienka o rodo:</label>
|
||||
<select
|
||||
id="popupState"
|
||||
value={popupState}
|
||||
onChange={(e) => setPopupState(e.target.value as PopupState)}
|
||||
>
|
||||
<option value="not_clicked">Nic nie kliknięte</option>
|
||||
<option value="clicked_but_invalid">Kliknięte, ale nieważne</option>
|
||||
</select>
|
||||
<div>
|
||||
<p>
|
||||
Dzień dobry, w dniu {getDate()} odwiedziłem stronę{" "}
|
||||
{marked_entries[0].request.originalURL}. Strona ta wysłała moje dane
|
||||
osobowe do podmiotów trzecich - bez mojej zgody.{" "}
|
||||
</p>
|
||||
<ul>
|
||||
{Object.values(clusters)
|
||||
.filter((cluster) => cluster.hasMarks())
|
||||
.map((cluster) => (
|
||||
<DomainSummary cluster={cluster} />
|
||||
))}
|
||||
</ul>
|
||||
{popupState === "not_clicked" ? (
|
||||
<p>
|
||||
Dane te zostały wysłane przez Państwa stronę zanim zdążyłem w ogóle
|
||||
przeczytać treść wyskakującego okienka ze zgodami.
|
||||
</p>
|
||||
) : null}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ import { EventEmitter } from "events";
|
||||
import ExtendedRequest from "./extended-request";
|
||||
import { MergedStolenDataEntry, StolenDataEntry } from "./stolen-data-entry";
|
||||
|
||||
import { allSubhosts, reduceConcat, unique } from "./util";
|
||||
import { allSubhosts, unique } from "./util";
|
||||
|
||||
export class RequestCluster extends EventEmitter {
|
||||
public requests: ExtendedRequest[] = [];
|
||||
@ -93,14 +93,4 @@ export class RequestCluster extends EventEmitter {
|
||||
.reduce((a, b) => a.concat(b), [])
|
||||
);
|
||||
}
|
||||
|
||||
hasMarks() {
|
||||
return this.requests.some((request) => request.hasMark());
|
||||
}
|
||||
|
||||
getMarkedEntries() {
|
||||
return this.requests
|
||||
.map((request) => request.getMarkedEntries())
|
||||
.reduce(reduceConcat, []);
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ import { TCModel } from "@iabtcf/core";
|
||||
import ExtendedRequest from "./extended-request";
|
||||
import { getMemory } from "./memory";
|
||||
import {
|
||||
getshorthost,
|
||||
isJSONObject,
|
||||
isURL,
|
||||
parseToObject,
|
||||
@ -128,22 +127,11 @@ export class StolenDataEntry {
|
||||
}
|
||||
|
||||
private classify(): keyof typeof Classifications {
|
||||
let result: keyof typeof Classifications;
|
||||
if (
|
||||
[this.value, decodeURIComponent(this.value)].some((haystack) =>
|
||||
[
|
||||
this.request.origin,
|
||||
this.request.originalURL,
|
||||
getshorthost(this.request.origin),
|
||||
].some((needle) => haystack.includes(needle))
|
||||
)
|
||||
) {
|
||||
result = "history";
|
||||
if (this.value.includes(this.request.originalURL)) {
|
||||
return "history";
|
||||
} else {
|
||||
result = "id";
|
||||
return "id";
|
||||
}
|
||||
console.log("classifying", this.value, result, this.request.origin);
|
||||
return result;
|
||||
}
|
||||
|
||||
isRelatedToID() {
|
||||
|
7
util.ts
7
util.ts
@ -99,10 +99,3 @@ export function allSubhosts(host: string) {
|
||||
export function reduceConcat<T>(a: T[], b: T[]): T[] {
|
||||
return a.concat(b);
|
||||
}
|
||||
|
||||
export function getDate() {
|
||||
const d = new Date();
|
||||
return `${d.getFullYear()}-${(d.getMonth() + 1)
|
||||
.toString()
|
||||
.padStart(2, "0")}-${d.getDate().toString().padStart(2, "0")}`;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user