Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Fix CSRF token parsing in config export/import (related to #646)

rcourtman8dad0872ae3e
diff --git a/frontend-modern/src/components/Settings/Settings.tsx b/frontend-modern/src/components/Settings/Settings.tsx
index 011cfe4d7d..c678a9d722 100644
--- a/frontend-modern/src/components/Settings/Settings.tsx
+++ b/frontend-modern/src/components/Settings/Settings.tsx
@@ -1924,10 +1924,12 @@ const Settings: Component<SettingsProps> = (props) => {
try {
// Get CSRF token from cookie
- const csrfToken = document.cookie
+ const csrfCookie = document.cookie
.split('; ')
- .find((row) => row.startsWith('pulse_csrf='))
- ?.split('=')[1];
+ .find((row) => row.startsWith('pulse_csrf='));
+ const csrfToken = csrfCookie
+ ? decodeURIComponent(csrfCookie.split('=').slice(1).join('='))
+ : undefined;
const headers: HeadersInit = {
'Content-Type': 'application/json',
@@ -2051,10 +2053,12 @@ const Settings: Component<SettingsProps> = (props) => {
}
// Get CSRF token from cookie
- const csrfToken = document.cookie
+ const csrfCookie = document.cookie
.split('; ')
- .find((row) => row.startsWith('pulse_csrf='))
- ?.split('=')[1];
+ .find((row) => row.startsWith('pulse_csrf='));
+ const csrfToken = csrfCookie
+ ? decodeURIComponent(csrfCookie.split('=').slice(1).join('='))
+ : undefined;
const headers: HeadersInit = {
'Content-Type': 'application/json',