From 3af8d50bbeddf9dc1d25af8fe20a5a62e75f748f Mon Sep 17 00:00:00 2001 From: Elias Nahum Date: Thu, 13 Mar 2025 19:39:19 +0800 Subject: [PATCH] Add config settings for additional security features on mobile (#30411) --- server/config/client.go | 12 ++++++++++++ server/public/model/config.go | 25 ++++++++++++++++++++----- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/server/config/client.go b/server/config/client.go index f1b543870c..c5abb35daa 100644 --- a/server/config/client.go +++ b/server/config/client.go @@ -227,6 +227,12 @@ func GenerateClientConfig(c *model.Config, telemetryID string, license *model.Li props["PostAcknowledgements"] = "true" props["ScheduledPosts"] = strconv.FormatBool(*c.ServiceSettings.ScheduledPosts) } + + if license.SkuShortName == model.LicenseShortSkuEnterprise { + props["MobileEnableBiometrics"] = strconv.FormatBool(*c.NativeAppSettings.MobileEnableBiometrics) + props["MobilePreventScreenCapture"] = strconv.FormatBool(*c.NativeAppSettings.MobilePreventScreenCapture) + props["MobileJailbreakProtection"] = strconv.FormatBool(*c.NativeAppSettings.MobileJailbreakProtection) + } } return props @@ -388,6 +394,12 @@ func GenerateLimitedClientConfig(c *model.Config, telemetryID string, license *m props["OpenIdButtonColor"] = *c.OpenIdSettings.ButtonColor props["OpenIdButtonText"] = *c.OpenIdSettings.ButtonText } + + if license.SkuShortName == model.LicenseShortSkuEnterprise { + props["MobileEnableBiometrics"] = strconv.FormatBool(*c.NativeAppSettings.MobileEnableBiometrics) + props["MobilePreventScreenCapture"] = strconv.FormatBool(*c.NativeAppSettings.MobilePreventScreenCapture) + props["MobileJailbreakProtection"] = strconv.FormatBool(*c.NativeAppSettings.MobileJailbreakProtection) + } } for key, value := range c.FeatureFlags.ToMap() { diff --git a/server/public/model/config.go b/server/public/model/config.go index 04c77c5c0c..46382866c9 100644 --- a/server/public/model/config.go +++ b/server/public/model/config.go @@ -2849,11 +2849,14 @@ func (s *SamlSettings) SetDefaults() { } type NativeAppSettings struct { - AppCustomURLSchemes []string `access:"site_customization,write_restrictable,cloud_restrictable"` // telemetry: none - AppDownloadLink *string `access:"site_customization,write_restrictable,cloud_restrictable"` - AndroidAppDownloadLink *string `access:"site_customization,write_restrictable,cloud_restrictable"` - IosAppDownloadLink *string `access:"site_customization,write_restrictable,cloud_restrictable"` - MobileExternalBrowser *bool `access:"site_customization,write_restrictable,cloud_restrictable"` + AppCustomURLSchemes []string `access:"site_customization,write_restrictable,cloud_restrictable"` // telemetry: none + AppDownloadLink *string `access:"site_customization,write_restrictable,cloud_restrictable"` + AndroidAppDownloadLink *string `access:"site_customization,write_restrictable,cloud_restrictable"` + IosAppDownloadLink *string `access:"site_customization,write_restrictable,cloud_restrictable"` + MobileExternalBrowser *bool `access:"site_customization,write_restrictable,cloud_restrictable"` + MobileEnableBiometrics *bool `access:"site_customization,write_restrictable"` + MobilePreventScreenCapture *bool `access:"site_customization,write_restrictable"` + MobileJailbreakProtection *bool `access:"site_customization,write_restrictable"` } func (s *NativeAppSettings) SetDefaults() { @@ -2876,6 +2879,18 @@ func (s *NativeAppSettings) SetDefaults() { if s.MobileExternalBrowser == nil { s.MobileExternalBrowser = NewPointer(false) } + + if s.MobileEnableBiometrics == nil { + s.MobileEnableBiometrics = NewPointer(false) + } + + if s.MobilePreventScreenCapture == nil { + s.MobilePreventScreenCapture = NewPointer(false) + } + + if s.MobileJailbreakProtection == nil { + s.MobileJailbreakProtection = NewPointer(false) + } } type ElasticsearchSettings struct {