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.

Stop returning the stored Apprise API key from the notifications API

rcourtmana7f87471f4d0
diff --git a/frontend-modern/browser-verification.json b/frontend-modern/browser-verification.json
index f435b9feff..b801fb4924 100644
--- a/frontend-modern/browser-verification.json
+++ b/frontend-modern/browser-verification.json
@@ -1,23 +1,31 @@
{
"version": 1,
- "base_sha": "567eca25729b0fc826110cd2458e7444aa81718e",
- "verified_at": "2026-08-23T13:17:50Z",
+ "base_sha": "aba7cec747fd008f6053c106af1756b285762380",
+ "verified_at": "2026-08-23T13:37:06Z",
"result": "passed",
"changed_paths": [
- "frontend-modern/src/components/Workloads/useWorkloadViewportSync.ts",
- "frontend-modern/src/features/proxmox/ProxmoxPageSurface.tsx"
+ "frontend-modern/src/api/notifications.ts",
+ "frontend-modern/src/features/alerts/AlertAppriseDestinationsSection.tsx",
+ "frontend-modern/src/features/alerts/alertDestinationsModel.ts",
+ "frontend-modern/src/features/alerts/helpers.ts",
+ "frontend-modern/src/features/alerts/types.ts",
+ "frontend-modern/src/utils/alertDestinationsPresentation.ts"
],
"content_sha256": {
- "frontend-modern/src/components/Workloads/useWorkloadViewportSync.ts": "0e5fb873bfeb18d1a6d2f0f95b0ee5f79af883cc10c7e19cae266fcee651534b",
- "frontend-modern/src/features/proxmox/ProxmoxPageSurface.tsx": "74fe27bf718224199e6f0f63c81246297221d308424fc9aed9cf29ac724b2252"
+ "frontend-modern/src/api/notifications.ts": "facf96ad57bf8839e6138293455788b3ebb5fe3119bf13427cfe77abce3ff257",
+ "frontend-modern/src/features/alerts/AlertAppriseDestinationsSection.tsx": "77776a85389857efc7e87be3111b88bbe7fdd9e373c8c0ba658fd75d32c83cb9",
+ "frontend-modern/src/features/alerts/alertDestinationsModel.ts": "988f1e43f9e27dc2713abdb6c460713ef561c3490e6137ed91fb3c3ef56cb359",
+ "frontend-modern/src/features/alerts/helpers.ts": "c1ba8c32f3f73ab4ea3c6d1f2a657f20cf253c57fc24102e552909727b817268",
+ "frontend-modern/src/features/alerts/types.ts": "99f859d5008771c048f964684c4efbcad57543b91dba23f828e006db84ed982e",
+ "frontend-modern/src/utils/alertDestinationsPresentation.ts": "6c15b3a2c5daa4d5207bb8ed41bb9614bf7d5299f45cce8b814a7aa8efe88f6b"
},
"routes": [
- "/proxmox/overview"
+ "/alerts/notifications"
],
"viewports": [
{
"width": 1280,
- "height": 800
+ "height": 720
},
{
"width": 375,
@@ -25,15 +33,19 @@
}
],
"states": [
- "Desktop overview with Nodes first and the labeled Guests section, filter toolbar, and guest rows visible",
- "Narrow overview with Guests reordered above Nodes and the guest table fitting without horizontal clipping",
- "Large-inventory virtualization window updates from the app scroll container so the bottom spacer does not remain after the visible guest rows",
- "Loading-to-connected overview transition preserves the Guests section and guest inventory once resources arrive"
+ "Apprise HTTP mode with no saved API key shows the 'Optional API key' placeholder",
+ "After saving a key the PUT response body carried hasApiKey:true and no apiKey field; the input re-rendered blank with the 'Saved. Leave blank to keep the current key' placeholder and autocomplete=new-password",
+ "A second save with the key field left blank preserved the stored key server-side (backend parse log reported hasApiKey=true while the request carried an empty key)",
+ "Fresh page reload re-derived the saved-key placeholder purely from the redacted GET response (hasApiKey:true, no apiKey field in the body)",
+ "Mobile 375x812 layout renders the Apprise section with the saved-key placeholder visible and no horizontal overflow (body scrollWidth 375); console error-free at both widths"
],
"interactions": [
- "Reloaded /proxmox/overview at 1280x800 and inspected the rendered desktop pixels and DOM",
- "Reloaded /proxmox/overview at 390x844 and inspected the rendered narrow pixels and DOM",
- "Verified the guest filter controls and mobile table remain visible and usable",
- "Exercised the scroll-container virtualization path with the focused regression test and confirmed listener cleanup"
+ "Logged in against a sidecar-built backend on :17655 with mock data via a second vite instance on :5488",
+ "Navigated to /alerts/notifications and scrolled to Apprise notifications",
+ "Switched delivery mode from Local Apprise CLI to Remote Apprise API",
+ "Entered server URL http://apprise-api.internal:8000 and API key verify-secret-key-123, clicked Save Changes, inspected the PUT /api/notifications/apprise response body",
+ "Changed the config key to 'roundtrip' with the API key field left blank, saved again, confirmed the stored key survived",
+ "Reloaded the page, fetched GET /api/notifications/apprise from the authenticated session, verified the redacted body",
+ "Resized to 375x812, reloaded, scrolled to the Apprise section and re-checked field state and overflow"
]
}
diff --git a/frontend-modern/src/api/notifications.ts b/frontend-modern/src/api/notifications.ts
index 5cba35225d..fa62d42c5f 100644
--- a/frontend-modern/src/api/notifications.ts
+++ b/frontend-modern/src/api/notifications.ts
@@ -84,6 +84,8 @@ export interface AppriseConfig {
apiKey?: string;
apiKeyHeader?: string;
skipTlsVerify?: boolean;
+ // Responses never include the stored apiKey; this reports whether one is saved.
+ hasApiKey?: boolean;
}
export interface NotificationTestRequest {
diff --git a/frontend-modern/src/features/alerts/AlertAppriseDestinationsSection.test.tsx b/frontend-modern/src/features/alerts/AlertAppriseDestinationsSection.test.tsx
index c17a4919c2..7df8b321b7 100644
--- a/frontend-modern/src/features/alerts/AlertAppriseDestinationsSection.test.tsx
+++ b/frontend-modern/src/features/alerts/AlertAppriseDestinationsSection.test.tsx
@@ -15,6 +15,7 @@ function makeConfig(overrides: Partial<UIAppriseConfig> = {}): UIAppriseConfig {
apiKey: '',
apiKeyHeader: 'X-API-KEY',
skipTlsVerify: false,
+ hasApiKey: false,
...overrides,
};
}
@@ -60,4 +61,21 @@ describe('AlertAppriseDestinationsSection', () => {
screen.getByRole('checkbox', { name: 'Allow self-signed certificates' }),
).toBeInTheDocument();
});
+
+ // The API never returns the stored key, so the field renders empty; the
+ // placeholder is the only signal that a key is already saved.
+ it('tells the user a saved API key is kept when the field is left blank', () => {
+ renderSection(makeConfig({ mode: 'http', apiKey: '', hasApiKey: true }));
+
+ expect(screen.getByLabelText('API key')).toHaveAttribute(
+ 'placeholder',
+ 'Saved. Leave blank to keep the current key',
+ );
+ });
+
+ it('offers the optional-key placeholder when no key is saved', () => {
+ renderSection(makeConfig({ mode: 'http', apiKey: '', hasApiKey: false }));
+
+ expect(screen.getByLabelText('API key')).toHaveAttribute('placeholder', 'Optional API key');
+ });
});
diff --git a/frontend-modern/src/features/alerts/AlertAppriseDestinationsSection.tsx b/frontend-modern/src/features/alerts/AlertAppriseDestinationsSection.tsx
index 2b4bfe6ba9..a653618e1e 100644
--- a/frontend-modern/src/features/alerts/AlertAppriseDestinationsSection.tsx
+++ b/frontend-modern/src/features/alerts/AlertAppriseDestinationsSection.tsx
@@ -14,6 +14,7 @@ import {
ALERT_DESTINATIONS_APPRISE_API_KEY_HELP,
ALERT_DESTINATIONS_APPRISE_API_KEY_LABEL,
ALERT_DESTINATIONS_APPRISE_API_KEY_PLACEHOLDER,
+ ALERT_DESTINATIONS_APPRISE_API_KEY_SAVED_PLACEHOLDER,
ALERT_DESTINATIONS_APPRISE_CLI_PATH_HELP,
ALERT_DESTINATIONS_APPRISE_CLI_PATH_LABEL,
ALERT_DESTINATIONS_APPRISE_CLI_PATH_PLACEHOLDER,
@@ -201,7 +202,12 @@ export function AlertAppriseDestinationsSection(props: AlertAppriseDestinationsS
type="password"
value={props.config.apiKey}
class={formControl}
- placeholder={ALERT_DESTINATIONS_APPRISE_API_KEY_PLACEHOLDER}
+ placeholder={
+ props.config.hasApiKey
+ ? ALERT_DESTINATIONS_APPRISE_API_KEY_SAVED_PLACEHOLDER
+ : ALERT_DESTINATIONS_APPRISE_API_KEY_PLACEHOLDER
+ }
+ autocomplete="new-password"
onInput={(event) => {
props.updateApprise({ apiKey: event.currentTarget.value });
props.setHasUnsavedChanges(true);
diff --git a/frontend-modern/src/features/alerts/__tests__/alertDestinationsModel.branchcov0713.test.ts b/frontend-modern/src/features/alerts/__tests__/alertDestinationsModel.branchcov0713.test.ts
index acd35fd099..5a9854eec8 100644
--- a/frontend-modern/src/features/alerts/__tests__/alertDestinationsModel.branchcov0713.test.ts
+++ b/frontend-modern/src/features/alerts/__tests__/alertDestinationsModel.branchcov0713.test.ts
@@ -29,6 +29,7 @@ function makeUIAppriseConfig(overrides: Partial<UIAppriseConfig> = {}): UIAppris
apiKey: '',
apiKeyHeader: 'X-API-KEY',
skipTlsVerify: false,
+ hasApiKey: false,
...overrides,
};
}
@@ -322,6 +323,7 @@ describe('normalizeAppriseConfig — branch coverage (0713)', () => {
apiKey: '',
apiKeyHeader: 'X-API-KEY',
skipTlsVerify: false,
+ hasApiKey: false,
};
it('returns the exact default shape for null input', () => {
diff --git a/frontend-modern/src/features/alerts/__tests__/alertDestinationsModel.test.ts b/frontend-modern/src/features/alerts/__tests__/alertDestinationsModel.test.ts
index d3bc4e8d7c..45baf5d9b6 100644
--- a/frontend-modern/src/features/alerts/__tests__/alertDestinationsModel.test.ts
+++ b/frontend-modern/src/features/alerts/__tests__/alertDestinationsModel.test.ts
@@ -115,6 +115,7 @@ describe('alertDestinationsModel', () => {
apiKey: '',
apiKeyHeader: 'X-API-KEY',
skipTlsVerify: false,
+ hasApiKey: false,
}),
).toEqual(
expect.objectContaining({
diff --git a/frontend-modern/src/features/alerts/__tests__/useAlertDestinationsTabState.test.tsx b/frontend-modern/src/features/alerts/__tests__/useAlertDestinationsTabState.test.tsx
index b1bd0729e4..485836c4f4 100644
--- a/frontend-modern/src/features/alerts/__tests__/useAlertDestinationsTabState.test.tsx
+++ b/frontend-modern/src/features/alerts/__tests__/useAlertDestinationsTabState.test.tsx
@@ -65,6 +65,7 @@ const buildAppriseConfig = (): UIAppriseConfig => ({
cliPath: '/usr/local/bin/apprise',
configKey: '',
enabled: true,
+ hasApiKey: false,
mode: 'cli',
serverUrl: '',
skipTlsVerify: false,
diff --git a/frontend-modern/src/features/alerts/alertDestinationsModel.ts b/frontend-modern/src/features/alerts/alertDestinationsModel.ts
index 8d6fe89ca1..028ec70d80 100644
--- a/frontend-modern/src/features/alerts/alertDestinationsModel.ts
+++ b/frontend-modern/src/features/alerts/alertDestinationsModel.ts
@@ -20,6 +20,7 @@ export function normalizeAppriseConfig(
apiKey: config?.apiKey || '',
apiKeyHeader: config?.apiKeyHeader || 'X-API-KEY',
skipTlsVerify: Boolean(config?.skipTlsVerify),
+ hasApiKey: Boolean(config?.hasApiKey || config?.apiKey),
};
}
diff --git a/frontend-modern/src/features/alerts/helpers.ts b/frontend-modern/src/features/alerts/helpers.ts
index a67b042d0a..add10fc845 100644
--- a/frontend-modern/src/features/alerts/helpers.ts
+++ b/frontend-modern/src/features/alerts/helpers.ts
@@ -85,6 +85,7 @@ export const createDefaultAppriseConfig = (): UIAppriseConfig => ({
apiKey: '',
apiKeyHeader: 'X-API-KEY',
skipTlsVerify: false,
+ hasApiKey: false,
});
export const createDefaultEmailConfig = (): UIEmailConfig => ({
diff --git a/frontend-modern/src/features/alerts/types.ts b/frontend-modern/src/features/alerts/types.ts
index a2c199e8d7..8527873285 100644
--- a/frontend-modern/src/features/alerts/types.ts
+++ b/frontend-modern/src/features/alerts/types.ts
@@ -164,6 +164,7 @@ export interface UIAppriseConfig {
apiKey: string;
apiKeyHeader: string;
skipTlsVerify: boolean;
+ hasApiKey: boolean;
}
export interface QuietHoursConfig {
diff --git a/frontend-modern/src/utils/alertDestinationsPresentation.ts b/frontend-modern/src/utils/alertDestinationsPresentation.ts
index 8198320525..8b9e51c62f 100644
--- a/frontend-modern/src/utils/alertDestinationsPresentation.ts
+++ b/frontend-modern/src/utils/alertDestinationsPresentation.ts
@@ -43,6 +43,8 @@ export const ALERT_DESTINATIONS_APPRISE_CONFIG_KEY_HELP =
'Targets the /notify/<key> endpoint when provided.';
export const ALERT_DESTINATIONS_APPRISE_API_KEY_LABEL = 'API key';
export const ALERT_DESTINATIONS_APPRISE_API_KEY_PLACEHOLDER = 'Optional API key';
+export const ALERT_DESTINATIONS_APPRISE_API_KEY_SAVED_PLACEHOLDER =
+ 'Saved. Leave blank to keep the current key';
export const ALERT_DESTINATIONS_APPRISE_API_KEY_HELP =
'Included with each request when your Apprise API requires authentication.';
export const ALERT_DESTINATIONS_APPRISE_API_KEY_HEADER_LABEL = 'API key header';
diff --git a/internal/api/alerting/notifications.go b/internal/api/alerting/notifications.go
index c2b1f2dbd0..2ea15693b0 100644
--- a/internal/api/alerting/notifications.go
+++ b/internal/api/alerting/notifications.go
@@ -249,12 +249,26 @@ func (h *NotificationHandlers) UpdateEmailConfig(w http.ResponseWriter, r *http.
json.NewEncoder(w).Encode(map[string]string{"status": "success"})
}
+// appriseConfigResponse is the API projection of an AppriseConfig. The stored
+// API key never leaves the server; callers only learn whether one is saved,
+// matching how the email handler blanks the SMTP password.
+type appriseConfigResponse struct {
+ notifications.AppriseConfig
+ HasAPIKey bool `json:"hasApiKey"`
+}
+
+func redactAppriseConfig(config notifications.AppriseConfig) appriseConfigResponse {
+ response := appriseConfigResponse{AppriseConfig: config, HasAPIKey: config.APIKey != ""}
+ response.APIKey = ""
+ return response
+}
+
// GetAppriseConfig returns the current Apprise configuration.
func (h *NotificationHandlers) GetAppriseConfig(w http.ResponseWriter, r *http.Request) {
config := h.getMonitor(r.Context()).GetNotificationManager().GetAppriseConfig()
w.Header().Set("Content-Type", "application/json")
- if err := json.NewEncoder(w).Encode(config); err != nil {
+ if err := json.NewEncoder(w).Encode(redactAppriseConfig(config)); err != nil {
log.Error().Err(err).Msg("Failed to encode Apprise configuration response")
}
}
@@ -276,6 +290,13 @@ func (h *NotificationHandlers) UpdateAppriseConfig(w http.ResponseWriter, r *htt
return
}
+ // An empty API key means "keep the saved key": responses never include the
+ // stored value, so the settings form cannot round-trip it.
+ if config.APIKey == "" {
+ existingConfig := h.getMonitor(r.Context()).GetNotificationManager().GetAppriseConfig()
+ config.APIKey = existingConfig.APIKey
+ }
+
log.Info().
Bool("enabled", config.Enabled).
Str("mode", string(config.Mode)).
@@ -298,7 +319,7 @@ func (h *NotificationHandlers) UpdateAppriseConfig(w http.ResponseWriter, r *htt
normalized := h.getMonitor(r.Context()).GetNotificationManager().GetAppriseConfig()
w.Header().Set("Content-Type", "application/json")
- if err := json.NewEncoder(w).Encode(normalized); err != nil {
+ if err := json.NewEncoder(w).Encode(redactAppriseConfig(normalized)); err != nil {
log.Error().Err(err).Msg("Failed to encode Apprise configuration response")
}
}
@@ -710,6 +731,12 @@ func (h *NotificationHandlers) TestNotification(w http.ResponseWriter, r *http.R
return
}
+ // If the API key is empty, use the saved key
+ if appriseConfig.APIKey == "" {
+ savedConfig := h.getMonitor(r.Context()).GetNotificationManager().GetAppriseConfig()
+ appriseConfig.APIKey = savedConfig.APIKey
+ }
+
if err := h.getMonitor(r.Context()).GetNotificationManager().SendTestAppriseWithConfig(appriseConfig); err != nil {
writeTestNotificationError(w, err, http.StatusBadRequest)
return
diff --git a/internal/api/alerting/notifications_test.go b/internal/api/alerting/notifications_test.go
index a58e93452a..4fd5cd7349 100644
--- a/internal/api/alerting/notifications_test.go
+++ b/internal/api/alerting/notifications_test.go
@@ -511,7 +511,7 @@ func TestNotificationHandlers(t *testing.T) {
})
t.Run("GetAppriseConfig", func(t *testing.T) {
- cfg := notifications.AppriseConfig{Enabled: true}
+ cfg := notifications.AppriseConfig{Enabled: true, APIKey: "secret-key"}
mockManager.On("GetAppriseConfig").Return(cfg).Once()
req := httptest.NewRequest("GET", "/api/notifications/apprise", nil)
@@ -519,13 +519,17 @@ func TestNotificationHandlers(t *testing.T) {
h.GetAppriseConfig(w, req)
assert.Equal(t, 200, w.Code)
+ var resp map[string]interface{}
+ _ = json.Unmarshal(w.Body.Bytes(), &resp)
+ assert.NotContains(t, w.Body.String(), "secret-key") // Should be redacted
+ assert.Equal(t, true, resp["hasApiKey"])
})
t.Run("UpdateAppriseConfig", func(t *testing.T) {
cfg := notifications.AppriseConfig{Enabled: true}
+ mockManager.On("GetAppriseConfig").Return(cfg).Twice() // preserve lookup + response echo
mockManager.On("SetAppriseConfig", mock.Anything).Return().Once()
mockPersistence.On("SaveAppriseConfig", mock.Anything).Return(nil).Once()
- mockManager.On("GetAppriseConfig").Return(cfg).Once()
body, _ := json.Marshal(cfg)
req := httptest.NewRequest("PUT", "/api/notifications/apprise", bytes.NewReader(body))
@@ -535,6 +539,49 @@ func TestNotificationHandlers(t *testing.T) {
assert.Equal(t, 200, w.Code)
})
+ t.Run("UpdateAppriseConfig_PreservesSavedAPIKeyWhenBlank", func(t *testing.T) {
+ existing := notifications.AppriseConfig{Enabled: true, APIKey: "saved-key"}
+ mockManager.On("GetAppriseConfig").Return(existing).Twice() // preserve lookup + response echo
+ mockManager.On("SetAppriseConfig", mock.MatchedBy(func(cfg notifications.AppriseConfig) bool {
+ return cfg.APIKey == "saved-key"
+ })).Return().Once()
+ mockPersistence.On("SaveAppriseConfig", mock.MatchedBy(func(cfg notifications.AppriseConfig) bool {
+ return cfg.APIKey == "saved-key"
+ })).Return(nil).Once()
+
+ req := httptest.NewRequest(
+ "PUT",
+ "/api/notifications/apprise",
+ bytes.NewBufferString(`{"enabled":true,"apiKey":""}`),
+ )
+ w := httptest.NewRecorder()
+ h.UpdateAppriseConfig(w, req)
+
+ assert.Equal(t, http.StatusOK, w.Code)
+ assert.NotContains(t, w.Body.String(), "saved-key") // Response should stay redacted
+ })
+
+ t.Run("UpdateAppriseConfig_ReplacesAPIKey", func(t *testing.T) {
+ mockManager.On("SetAppriseConfig", mock.MatchedBy(func(cfg notifications.AppriseConfig) bool {
+ return cfg.APIKey == "new-key"
+ })).Return().Once()
+ mockPersistence.On("SaveAppriseConfig", mock.MatchedBy(func(cfg notifications.AppriseConfig) bool {
+ return cfg.APIKey == "new-key"
+ })).Return(nil).Once()
+ mockManager.On("GetAppriseConfig").Return(notifications.AppriseConfig{Enabled: true, APIKey: "new-key"}).Once()
+
+ req := httptest.NewRequest(
+ "PUT",
+ "/api/notifications/apprise",
+ bytes.NewBufferString(`{"enabled":true,"apiKey":"new-key"}`),
+ )
+ w := httptest.NewRecorder()
+ h.UpdateAppriseConfig(w, req)
+
+ assert.Equal(t, http.StatusOK, w.Code)
+ assert.NotContains(t, w.Body.String(), "new-key") // Response should stay redacted
+ })
+
t.Run("UpdateWebhook", func(t *testing.T) {
webhook := notifications.WebhookConfig{ID: "wh1", Name: "Updated"}
mockManager.On("GetWebhooks").Return([]notifications.WebhookConfig{{ID: "wh1"}}).Once()
@@ -656,7 +703,7 @@ func TestNotificationHandlers(t *testing.T) {
{"PUT", "/api/notifications/apprise", func() {
mockManager.On("SetAppriseConfig", mock.Anything).Return().Once()
mockPersistence.On("SaveAppriseConfig", mock.Anything).Return(nil).Once()
- mockManager.On("GetAppriseConfig").Return(notifications.AppriseConfig{}).Once()
+ mockManager.On("GetAppriseConfig").Return(notifications.AppriseConfig{}).Twice() // preserve lookup + response echo
}},
{"GET", "/api/notifications/webhooks", func() { mockManager.On("GetWebhooks").Return([]notifications.WebhookConfig{}).Once() }},
{"POST", "/api/notifications/webhooks", func() {
@@ -857,6 +904,23 @@ func TestNotificationHandlers(t *testing.T) {
assert.Equal(t, 200, w.Code)
})
+ t.Run("TestNotification_AppriseWithConfig_UsesSavedAPIKeyWhenBlank", func(t *testing.T) {
+ saved := notifications.AppriseConfig{Enabled: true, APIKey: "saved-key"}
+ mockManager.On("GetAppriseConfig").Return(saved).Once()
+ mockManager.On("SendTestAppriseWithConfig", mock.MatchedBy(func(cfg notifications.AppriseConfig) bool {
+ return cfg.APIKey == "saved-key"
+ })).Return(nil).Once()
+ mockManager.On("IsEnabled").Return(true).Once()
+ body, _ := json.Marshal(map[string]interface{}{
+ "method": "apprise",
+ "config": notifications.AppriseConfig{Enabled: true},
+ })
+ req := httptest.NewRequest("POST", "/api/notifications/test", bytes.NewReader(body))
+ w := httptest.NewRecorder()
+ h.TestNotification(w, req)
+ assert.Equal(t, 200, w.Code)
+ })
+
t.Run("UpdateWebhook_PreserveRedacted", func(t *testing.T) {
existing := notifications.WebhookConfig{
ID: "wh1",