From 499e4e30e862f5f20717af2abbeb9dd604cdcaa4 Mon Sep 17 00:00:00 2001 From: Gabriel Hernandez Date: Mon, 7 Jul 2025 18:20:17 +0100 Subject: [PATCH] fix issue when end_user_license_agreeement is defined but value is nil or empty string (#30595) relates to [#28691](https://github.com/fleetdm/fleet/issues/28691) This fixes an issue where `end_user_license_agreeement` is defined but is an empty string or nil. ## Summary by CodeRabbit * **Bug Fixes** * Improved handling of the end user license agreement (EULA) field in app configuration to ensure it is always set correctly and removed from the configuration map after processing. --- server/service/client.go | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/server/service/client.go b/server/service/client.go index 93dd8233df..928268845b 100644 --- a/server/service/client.go +++ b/server/service/client.go @@ -1797,13 +1797,17 @@ func (c *Client) DoGitOps( WindowsEnabledAndConfigured: optjson.SetBool(windowsEnabledAndConfiguredAssumption), } } - // check for the eula in the mdmAppConfig. If it exists we want to delete it - // from the app config so it will not be applied to the group/team though the - // ApplyGroup method. It will be applied separately. - if endUserLicenseAgreement, ok := mdmAppConfig["end_user_license_agreement"].(string); ok && len(endUserLicenseAgreement) > 0 { - eulaPath = endUserLicenseAgreement - delete(mdmAppConfig, "end_user_license_agreement") + + // check for the eula in the mdmAppConfig. If it exists we want to assign it + // to eulaPath so that it will be applied later. We always delete it from + // mdmAppConfig so it will not be applied to the group/team though the + // ApplyGroup method. + if endUserLicenseAgreement, exists := mdmAppConfig["end_user_license_agreement"]; !exists || endUserLicenseAgreement == nil || (endUserLicenseAgreement == "") { + eulaPath = "" + } else if eulaStr, ok := endUserLicenseAgreement.(string); ok && len(eulaStr) > 0 { + eulaPath = eulaStr } + delete(mdmAppConfig, "end_user_license_agreement") group.AppConfig.(map[string]interface{})["scripts"] = scripts