Redact pathnames with origin file://
This commit is contained in:
parent
e67e1e8c0d
commit
19e948155c
1 changed files with 8 additions and 1 deletions
|
@ -39,9 +39,16 @@ function getRedactedHash(hash) {
|
||||||
return hash.replace(hashRegex, "#/$1");
|
return hash.replace(hashRegex, "#/$1");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return the current origin and hash separated with a `/`. This does not include query parameters.
|
// Return the current origin, path and hash separated with a `/`. This does
|
||||||
|
// not include query parameters.
|
||||||
function getRedactedUrl() {
|
function getRedactedUrl() {
|
||||||
const { origin, pathname, hash } = window.location;
|
const { origin, pathname, hash } = window.location;
|
||||||
|
|
||||||
|
// Redact paths which could contain unexpected PII
|
||||||
|
if (origin.startsWith('file://')) {
|
||||||
|
pathname = "/<redacted>/";
|
||||||
|
}
|
||||||
|
|
||||||
return origin + pathname + getRedactedHash(hash);
|
return origin + pathname + getRedactedHash(hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue