mirror of
https://github.com/vector-im/element-web.git
synced 2025-09-07 14:51:05 +02:00
Merge pull request #2018 from matrix-org/luke/fix-piwik-path-reporting
Redact pathnames with origin `file://`
This commit is contained in:
commit
4c575bb1ca
@ -39,9 +39,17 @@ 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, hash } = window.location;
|
||||||
|
let { pathname } = 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…
x
Reference in New Issue
Block a user