mirror of
https://github.com/gethomepage/homepage.git
synced 2026-01-09 01:44:24 +08:00
Strip sensitive information contained in URLs from frontend API calls
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import getServiceWidget from "utils/config/service-helpers";
|
||||
import { formatApiCall } from "utils/proxy/api-helpers";
|
||||
import { formatApiCall, sanitizeErrorURL } from "utils/proxy/api-helpers";
|
||||
import validateWidgetData from "utils/proxy/validate-widget-data";
|
||||
import { httpProxy } from "utils/proxy/http";
|
||||
import createLogger from "utils/logger";
|
||||
@@ -68,7 +68,10 @@ export default async function credentialedProxyHandler(req, res, map) {
|
||||
}
|
||||
|
||||
if (!validateWidgetData(widget, endpoint, data)) {
|
||||
return res.status(500).json({error: {message: "Invalid data", url, data}});
|
||||
if (data.error && data.error.url) {
|
||||
data.error.url = sanitizeErrorURL(url);
|
||||
}
|
||||
return res.status(500).json({error: {message: "Invalid data", url: sanitizeErrorURL(url), data}});
|
||||
}
|
||||
|
||||
if (status === 200 && map) {
|
||||
|
||||
Reference in New Issue
Block a user