grafana/public
Matthew Jacobson e3787de470
Alerting: Fix Alertmanager change detection for receivers with secure settings (#71307)
* Alerting: Make ApplyAlertmanagerConfiguration only decrypt/encrypt new/changed secure settings

Previously, ApplyAlertmanagerConfiguration would decrypt and re-encrypt all secure settings. However, this caused re-encrypted secure settings to be included in the raw configuration when applied to the embedded alertmanager, resulting in changes to the hash. Consequently, even if no actual modifications were made, saving any alertmanager configuration triggered an apply/restart and created a new historical entry in the database.

To address the issue, this modifies ApplyAlertmanagerConfiguration, which is called by POST `api/alertmanager/grafana/config/api/v1/alerts`, to decrypt and re-encrypt only new and updated secure settings. Unchanged secure settings are loaded directly from the database without alteration.

We determine whether secure settings have changed based on the following (already in-use) assumption: Only new or updated secure settings are provided via the POST `api/alertmanager/grafana/config/api/v1/alerts` request, while existing unchanged settings are omitted.

* Ensure saving a grafana-managed contact point will only send new/changed secure settings

Previously, when saving a grafana-managed contact point, empty string values were transmitted for all unset secure settings. This led to potential backend issues, as it assumed that only newly added or updated secure settings would be provided.

To address this, we now exclude empty ('', null, undefined) secure settings, unless there was a pre-existing entry in secureFields for that specific setting. In essence, this means we only transmit an empty secure setting if a previously configured value was cleared.

* Fix linting

* refactor omitEmptyUnlessExisting

* fixup

---------

Co-authored-by: Gilles De Mey <gilles.de.mey@gmail.com>
2023-07-11 08:23:07 +02:00
..
app Alerting: Fix Alertmanager change detection for receivers with secure settings (#71307) 2023-07-11 08:23:07 +02:00
dashboards Dashboards: Make the home dashboard non-editable (by default) (#68044) 2023-05-09 07:04:49 -07:00
emails Show the alertname for each alert in plain text email (#70183) 2023-06-16 10:06:43 -04:00
fonts Theme: Use Inter font by default (#59544) 2022-12-01 11:59:37 +00:00
gazetteer Geomap: Add GeoJSON gazetteer (#40589) 2021-10-19 21:05:55 -07:00
img XYChart: Improve base options setup (#67878) 2023-07-10 17:54:01 -07:00
lib Azure: Fix Kusto auto-completion for Azure datasources (#69685) 2023-06-07 11:49:43 +01:00
locales I18n: Translate phrases for new Browse Dashboards (#70654) 2023-07-04 16:32:32 +01:00
maps Geomap: include sample geojson files (#39057) 2021-09-10 09:05:03 -07:00
sass GrafanaUI: Update FilterPill active state and ToolbarButton active state (#70396) 2023-07-10 11:41:33 +02:00
test Navigation: Fix toolbar actions flickering on mobile (#70524) 2023-06-23 08:50:51 +01:00
testdata MarketTrend: add new alpha panel (#40909) 2021-11-05 18:01:26 -07:00
vendor Plugins: Allow loading panel plugins from a CDN (#59096) 2023-01-27 15:08:17 +01:00
views Themes: Adds support for extraThemes (behind feature toggle) (#67981) 2023-05-10 15:37:04 +02:00
api-merged.json Correlations: Create paginated API (#65241) 2023-07-05 09:37:17 -05:00
openapi3.json Correlations: Create paginated API (#65241) 2023-07-05 09:37:17 -05:00
robots.txt