mirror of
https://github.com/mattermost/mattermost.git
synced 2026-08-26 13:17:29 -05:00
MM-65959: Add FIPS indicator to about dialog (#34463)
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/mattermost/mattermost/server/public/model"
|
||||
"github.com/mattermost/mattermost/server/v8/fips"
|
||||
)
|
||||
|
||||
// GenerateClientConfig renders the given configuration for a client.
|
||||
@@ -265,6 +266,7 @@ func GenerateLimitedClientConfig(c *model.Config, telemetryID string, license *m
|
||||
props["BuildHashEnterprise"] = model.BuildHashEnterprise
|
||||
props["BuildEnterpriseReady"] = model.BuildEnterpriseReady
|
||||
props["ServiceEnvironment"] = model.GetServiceEnvironment()
|
||||
props["IsFipsEnabled"] = strconv.FormatBool(fips.IsEnabled)
|
||||
|
||||
props["EnableBotAccountCreation"] = strconv.FormatBool(*c.ServiceSettings.EnableBotAccountCreation)
|
||||
props["EnableDesktopLandingPage"] = strconv.FormatBool(*c.ServiceSettings.EnableDesktopLandingPage)
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
//go:build requirefips
|
||||
|
||||
package fips
|
||||
|
||||
const IsEnabled = true
|
||||
@@ -0,0 +1,8 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
//go:build !requirefips
|
||||
|
||||
package fips
|
||||
|
||||
const IsEnabled = false
|
||||
@@ -270,6 +270,40 @@ describe('components/AboutBuildModal', () => {
|
||||
expect(screen.getByTestId('aboutModalVersionInfo')).not.toHaveTextContent('Load Metric:');
|
||||
});
|
||||
|
||||
test('should show FIPS indicator when IsFipsEnabled is true', () => {
|
||||
const fipsConfig = {
|
||||
...config,
|
||||
IsFipsEnabled: 'true',
|
||||
};
|
||||
|
||||
renderAboutBuildModal({config: fipsConfig});
|
||||
|
||||
expect(screen.getByTestId('aboutModalVersionInfo')).toHaveTextContent('Server Version: 3.6.0 (FIPS)');
|
||||
});
|
||||
|
||||
test('should not show FIPS indicator when IsFipsEnabled is false', () => {
|
||||
const nonFipsConfig = {
|
||||
...config,
|
||||
IsFipsEnabled: 'false',
|
||||
};
|
||||
|
||||
renderAboutBuildModal({config: nonFipsConfig});
|
||||
|
||||
expect(screen.getByTestId('aboutModalVersionInfo')).toHaveTextContent('Server Version: 3.6.0');
|
||||
expect(screen.getByTestId('aboutModalVersionInfo')).not.toHaveTextContent('(FIPS)');
|
||||
});
|
||||
|
||||
test('should not show FIPS indicator when IsFipsEnabled is not set', () => {
|
||||
const nonFipsConfig = {
|
||||
...config,
|
||||
};
|
||||
|
||||
renderAboutBuildModal({config: nonFipsConfig});
|
||||
|
||||
expect(screen.getByTestId('aboutModalVersionInfo')).toHaveTextContent('Server Version: 3.6.0');
|
||||
expect(screen.getByTestId('aboutModalVersionInfo')).not.toHaveTextContent('(FIPS)');
|
||||
});
|
||||
|
||||
function renderAboutBuildModal(props = {}) {
|
||||
const onExited = jest.fn();
|
||||
const show = true;
|
||||
|
||||
@@ -202,9 +202,11 @@ export default function AboutBuildModal(props: Props) {
|
||||
);
|
||||
|
||||
const getServerVersionString = () => {
|
||||
const version = config.BuildNumber === 'dev' ? config.BuildNumber : config.Version;
|
||||
const fipsSuffix = config.IsFipsEnabled === 'true' ? ' (FIPS)' : '';
|
||||
return intl.formatMessage(
|
||||
{id: 'about.serverVersion', defaultMessage: 'Server Version:'},
|
||||
) + '\u00a0' + (config.BuildNumber === 'dev' ? config.BuildNumber : config.Version);
|
||||
) + '\u00a0' + version + fipsSuffix;
|
||||
};
|
||||
|
||||
const getDesktopVersionString = () => {
|
||||
|
||||
@@ -24,6 +24,7 @@ export type ClientConfig = {
|
||||
BuildHash: string;
|
||||
BuildHashEnterprise: string;
|
||||
BuildNumber: string;
|
||||
IsFipsEnabled: string;
|
||||
CollapsedThreads: CollapsedThreads;
|
||||
CustomBrandText: string;
|
||||
CustomDescriptionText: string;
|
||||
|
||||
Reference in New Issue
Block a user