Better origin exposure recognition

This commit is contained in:
Kuba Orlik 2021-11-07 19:15:40 +01:00
parent c9bc0c3a41
commit e989d6d33d

View File

@ -2,6 +2,7 @@ import { TCModel } from "@iabtcf/core";
import ExtendedRequest from "./extended-request"; import ExtendedRequest from "./extended-request";
import { getMemory } from "./memory"; import { getMemory } from "./memory";
import { import {
getshorthost,
isJSONObject, isJSONObject,
isURL, isURL,
parseToObject, parseToObject,
@ -127,11 +128,22 @@ export class StolenDataEntry {
} }
private classify(): keyof typeof Classifications { private classify(): keyof typeof Classifications {
if (this.value.includes(this.request.originalURL)) { let result: keyof typeof Classifications;
return "history"; 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";
} else { } else {
return "id"; result = "id";
} }
console.log("classifying", this.value, result, this.request.origin);
return result;
} }
isRelatedToID() { isRelatedToID() {