From 59c737a5309f55bb0456257e80a1c80d7cca2163 Mon Sep 17 00:00:00 2001 From: "opensearch-trigger-bot[bot]" <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Date: Mon, 19 Aug 2024 10:22:51 -0400 Subject: [PATCH] [Backport 2.x] Handle the audit config being null (#4664) Signed-off-by: Merlin Signed-off-by: github-actions[bot] Co-authored-by: github-actions[bot] --- .../opensearch/security/securityconf/DynamicConfigFactory.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/opensearch/security/securityconf/DynamicConfigFactory.java b/src/main/java/org/opensearch/security/securityconf/DynamicConfigFactory.java index d6ad8ecc2a..b710602d54 100644 --- a/src/main/java/org/opensearch/security/securityconf/DynamicConfigFactory.java +++ b/src/main/java/org/opensearch/security/securityconf/DynamicConfigFactory.java @@ -82,6 +82,7 @@ public class DynamicConfigFactory implements Initializable, ConfigurationChangeL private static SecurityDynamicConfiguration staticTenants = SecurityDynamicConfiguration.empty(); private static final WhitelistingSettings defaultWhitelistingSettings = new WhitelistingSettings(); private static final AllowlistingSettings defaultAllowlistingSettings = new AllowlistingSettings(); + private static final AuditConfig defaultAuditConfig = AuditConfig.from(Settings.EMPTY); static void resetStatics() { staticRoles = SecurityDynamicConfiguration.empty(); @@ -323,7 +324,7 @@ public void onChange(Map> typeToConfig) { eventBus.post(whitelist == null ? defaultWhitelistingSettings : whitelist); eventBus.post(allowlist == null ? defaultAllowlistingSettings : allowlist); if (cr.isAuditHotReloadingEnabled()) { - eventBus.post(audit); + eventBus.post(audit == null ? defaultAuditConfig : audit); } initialized.set(true);