mirror of
https://github.com/DI0IK/homepage-plus.git
synced 2025-07-11 23:58:46 +00:00
Strip sensitive information contained in URLs from frontend API calls
This commit is contained in:
parent
a25606cfe9
commit
e1176e9e3b
3 changed files with 20 additions and 5 deletions
|
@ -53,3 +53,12 @@ export function jsonArrayTransform(data, transform) {
|
|||
export function jsonArrayFilter(data, filter) {
|
||||
return jsonArrayTransform(data, (items) => items.filter(filter));
|
||||
}
|
||||
|
||||
export function sanitizeErrorURL(errorURL) {
|
||||
// Dont display sensitive params on frontend
|
||||
const url = new URL(errorURL);
|
||||
["apikey", "api_key", "token", "t"].forEach(key => {
|
||||
if (url.searchParams.has(key)) url.searchParams.set(key, "***")
|
||||
});
|
||||
return url.toString();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue