mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[Security Solution] Remove feature flag trustedAppsByPolicyEnabled (#122107)
This commit is contained in:
parent
e938f4cb12
commit
3cca7f0630
10 changed files with 60 additions and 136 deletions
|
@ -16,7 +16,6 @@ export const allowedExperimentalValues = Object.freeze({
|
|||
ruleRegistryEnabled: true,
|
||||
tGridEnabled: true,
|
||||
tGridEventRenderedViewEnabled: true,
|
||||
trustedAppsByPolicyEnabled: true,
|
||||
excludePoliciesInFilterEnabled: false,
|
||||
uebaEnabled: false,
|
||||
disableIsolationUIPendingStatuses: false,
|
||||
|
|
|
@ -15,7 +15,6 @@ import {
|
|||
NewPackagePolicy,
|
||||
pagePathGetters,
|
||||
} from '../../../../../../../fleet/public';
|
||||
import { useIsExperimentalFeatureEnabled } from '../../../../../common/hooks/use_experimental_features';
|
||||
import { INTEGRATIONS_PLUGIN_ID } from '../../../../../../../fleet/common';
|
||||
import { useAppUrl } from '../../../../../common/lib/kibana/hooks';
|
||||
import { PolicyDetailsRouteState } from '../../../../../../common/endpoint/types';
|
||||
|
@ -58,10 +57,6 @@ const WrappedPolicyDetailsForm = memo<{
|
|||
const endpointDetailsLoadingError = usePolicyDetailsSelector(apiError);
|
||||
const { getAppUrl } = useAppUrl();
|
||||
const [, setLastUpdatedPolicy] = useState(updatedPolicy);
|
||||
// TODO: Remove this and related code when removing FF
|
||||
const isTrustedAppsByPolicyEnabled = useIsExperimentalFeatureEnabled(
|
||||
'trustedAppsByPolicyEnabled'
|
||||
);
|
||||
|
||||
// When the form is initially displayed, trigger the Redux middleware which is based on
|
||||
// the location information stored via the `userChangedUrl` action.
|
||||
|
@ -164,63 +159,59 @@ const WrappedPolicyDetailsForm = memo<{
|
|||
|
||||
return (
|
||||
<div data-test-subj="endpointIntegrationPolicyForm">
|
||||
{isTrustedAppsByPolicyEnabled ? (
|
||||
<>
|
||||
<div>
|
||||
<EuiText>
|
||||
<h5>
|
||||
<>
|
||||
<div>
|
||||
<EuiText>
|
||||
<h5>
|
||||
<FormattedMessage
|
||||
id="xpack.securitySolution.endpoint.policyDetails.artifacts.title"
|
||||
defaultMessage="Artifacts"
|
||||
/>
|
||||
</h5>
|
||||
</EuiText>
|
||||
<EuiSpacer size="s" />
|
||||
<FleetTrustedAppsCard
|
||||
policyId={policyId}
|
||||
cardSize="m"
|
||||
customLink={policyTrustedAppsLink}
|
||||
/>
|
||||
<EuiSpacer size="s" />
|
||||
<FleetIntegrationEventFiltersCard policyId={policyId} />
|
||||
<EuiSpacer size="s" />
|
||||
<FleetIntegrationHostIsolationExceptionsCard policyId={policyId} />
|
||||
</div>
|
||||
<EuiSpacer size="l" />
|
||||
<div>
|
||||
<EuiText>
|
||||
<h5>
|
||||
<FormattedMessage
|
||||
id="xpack.securitySolution.endpoint.policyDetails.settings.title"
|
||||
defaultMessage="Policy settings"
|
||||
/>
|
||||
</h5>
|
||||
</EuiText>
|
||||
<EuiSpacer size="s" />
|
||||
{endpointDetailsLoadingError ? (
|
||||
<EuiCallOut
|
||||
title={
|
||||
<FormattedMessage
|
||||
id="xpack.securitySolution.endpoint.policyDetails.artifacts.title"
|
||||
defaultMessage="Artifacts"
|
||||
id="xpack.securitySolution.endpoint.policyDetails.loadError"
|
||||
defaultMessage="Failed to load endpoint policy settings"
|
||||
/>
|
||||
</h5>
|
||||
</EuiText>
|
||||
<EuiSpacer size="s" />
|
||||
<FleetTrustedAppsCard
|
||||
policyId={policyId}
|
||||
cardSize="m"
|
||||
customLink={policyTrustedAppsLink}
|
||||
/>
|
||||
<EuiSpacer size="s" />
|
||||
<FleetIntegrationEventFiltersCard policyId={policyId} />
|
||||
<EuiSpacer size="s" />
|
||||
<FleetIntegrationHostIsolationExceptionsCard policyId={policyId} />
|
||||
</div>
|
||||
<EuiSpacer size="l" />
|
||||
<div>
|
||||
<EuiText>
|
||||
<h5>
|
||||
<FormattedMessage
|
||||
id="xpack.securitySolution.endpoint.policyDetails.settings.title"
|
||||
defaultMessage="Policy settings"
|
||||
/>
|
||||
</h5>
|
||||
</EuiText>
|
||||
<EuiSpacer size="s" />
|
||||
{endpointDetailsLoadingError ? (
|
||||
<EuiCallOut
|
||||
title={
|
||||
<FormattedMessage
|
||||
id="xpack.securitySolution.endpoint.policyDetails.loadError"
|
||||
defaultMessage="Failed to load endpoint policy settings"
|
||||
/>
|
||||
}
|
||||
iconType="alert"
|
||||
color="warning"
|
||||
data-test-subj="endpiontPolicySettingsLoadingError"
|
||||
>
|
||||
{endpointDetailsLoadingError.message}
|
||||
</EuiCallOut>
|
||||
) : !endpointPolicyDetails ? (
|
||||
<EuiLoadingSpinner size="l" className="essentialAnimation" />
|
||||
) : (
|
||||
<PolicyDetailsForm />
|
||||
)}
|
||||
</div>
|
||||
</>
|
||||
) : (
|
||||
<PolicyDetailsForm />
|
||||
)}
|
||||
}
|
||||
iconType="alert"
|
||||
color="warning"
|
||||
data-test-subj="endpiontPolicySettingsLoadingError"
|
||||
>
|
||||
{endpointDetailsLoadingError.message}
|
||||
</EuiCallOut>
|
||||
) : !endpointPolicyDetails ? (
|
||||
<EuiLoadingSpinner size="l" className="essentialAnimation" />
|
||||
) : (
|
||||
<PolicyDetailsForm />
|
||||
)}
|
||||
</div>
|
||||
</>
|
||||
</div>
|
||||
);
|
||||
});
|
||||
|
|
|
@ -12,10 +12,8 @@ import { EuiCallOut, EuiLoadingSpinner, EuiPageTemplate } from '@elastic/eui';
|
|||
import { usePolicyDetailsSelector } from './policy_hooks';
|
||||
import { policyDetails, agentStatusSummary, apiError } from '../store/policy_details/selectors';
|
||||
import { AgentsSummary } from './agents_summary';
|
||||
import { useIsExperimentalFeatureEnabled } from '../../../../common/hooks/use_experimental_features';
|
||||
import { PolicyTabs } from './tabs';
|
||||
import { AdministrationListPage } from '../../../components/administration_list_page';
|
||||
import { PolicyFormLayout } from './policy_forms/components';
|
||||
import {
|
||||
BackToExternalAppButton,
|
||||
BackToExternalAppButtonProps,
|
||||
|
@ -26,10 +24,6 @@ import { useAppUrl } from '../../../../common/lib/kibana';
|
|||
import { APP_UI_ID } from '../../../../../common/constants';
|
||||
|
||||
export const PolicyDetails = React.memo(() => {
|
||||
// TODO: Remove this and related code when removing FF
|
||||
const isTrustedAppsByPolicyEnabled = useIsExperimentalFeatureEnabled(
|
||||
'trustedAppsByPolicyEnabled'
|
||||
);
|
||||
const { state: routeState = {} } = useLocation<PolicyDetailsRouteState>();
|
||||
const { getAppUrl } = useAppUrl();
|
||||
|
||||
|
@ -106,13 +100,8 @@ export const PolicyDetails = React.memo(() => {
|
|||
);
|
||||
}
|
||||
|
||||
// TODO: Remove this and related code when removing FF
|
||||
if (isTrustedAppsByPolicyEnabled) {
|
||||
return <PolicyTabs />;
|
||||
}
|
||||
|
||||
return <PolicyFormLayout />;
|
||||
}, [isTrustedAppsByPolicyEnabled, policyApiError, policyItem]);
|
||||
return <PolicyTabs />;
|
||||
}, [policyApiError, policyItem]);
|
||||
|
||||
return (
|
||||
<AdministrationListPage
|
||||
|
@ -122,7 +111,7 @@ export const PolicyDetails = React.memo(() => {
|
|||
headerBackComponent={backToEndpointList}
|
||||
actions={policyApiError ? undefined : headerRightContent}
|
||||
restrictWidth={true}
|
||||
hasBottomBorder={!isTrustedAppsByPolicyEnabled} // TODO: Remove this and related code when removing FF
|
||||
hasBottomBorder={false}
|
||||
>
|
||||
{pageBody}
|
||||
</AdministrationListPage>
|
||||
|
|
|
@ -86,7 +86,6 @@ describe('when rendering the PolicyTrustedAppsList', () => {
|
|||
});
|
||||
|
||||
mockedApis = policyDetailsPageAllApiHttpMocks(appTestContext.coreStart.http);
|
||||
appTestContext.setExperimentalFlag({ trustedAppsByPolicyEnabled: true });
|
||||
waitForAction = appTestContext.middlewareSpy.waitForAction;
|
||||
componentRenderProps = {};
|
||||
|
||||
|
|
|
@ -51,7 +51,6 @@ import { useTestIdGenerator } from '../../../../components/hooks/use_test_id_gen
|
|||
import { useLicense } from '../../../../../common/hooks/use_license';
|
||||
import { isGlobalEffectScope } from '../../state/type_guards';
|
||||
import { NewTrustedApp } from '../../../../../../common/endpoint/types';
|
||||
import { useIsExperimentalFeatureEnabled } from '../../../../../common/hooks/use_experimental_features';
|
||||
|
||||
export type CreateTrustedAppFlyoutProps = Omit<EuiFlyoutProps, 'hideCloseButton'>;
|
||||
export const CreateTrustedAppFlyout = memo<CreateTrustedAppFlyoutProps>(
|
||||
|
@ -116,10 +115,6 @@ export const CreateTrustedAppFlyout = memo<CreateTrustedAppFlyoutProps>(
|
|||
[dispatch, formValues]
|
||||
);
|
||||
|
||||
const isTrustedAppsByPolicyEnabled = useIsExperimentalFeatureEnabled(
|
||||
'trustedAppsByPolicyEnabled'
|
||||
);
|
||||
|
||||
const [wasByPolicy, setWasByPolicy] = useState(!isGlobalEffectScope(formValues.effectScope));
|
||||
// set initial state of `wasByPolicy` that checks if the initial state of the exception was by policy or not
|
||||
useEffect(() => {
|
||||
|
@ -133,21 +128,8 @@ export const CreateTrustedAppFlyout = memo<CreateTrustedAppFlyoutProps>(
|
|||
}, [formValues]);
|
||||
|
||||
const showExpiredLicenseBanner = useMemo(() => {
|
||||
return (
|
||||
isTrustedAppsByPolicyEnabled &&
|
||||
!isPlatinumPlus &&
|
||||
isEditMode &&
|
||||
wasByPolicy &&
|
||||
(!isGlobal || isFormDirty)
|
||||
);
|
||||
}, [
|
||||
isTrustedAppsByPolicyEnabled,
|
||||
isPlatinumPlus,
|
||||
isEditMode,
|
||||
isGlobal,
|
||||
isFormDirty,
|
||||
wasByPolicy,
|
||||
]);
|
||||
return !isPlatinumPlus && isEditMode && wasByPolicy && (!isGlobal || isFormDirty);
|
||||
}, [isPlatinumPlus, isEditMode, isGlobal, isFormDirty, wasByPolicy]);
|
||||
|
||||
// If there was a failure trying to retrieve the Trusted App for edit item,
|
||||
// then redirect back to the list ++ show toast message.
|
||||
|
|
|
@ -33,7 +33,6 @@ import {
|
|||
hasSimpleExecutableName,
|
||||
} from '../../../../../../common/endpoint/service/trusted_apps/validations';
|
||||
|
||||
import { useIsExperimentalFeatureEnabled } from '../../../../../common/hooks/use_experimental_features';
|
||||
import {
|
||||
isGlobalEffectScope,
|
||||
isMacosLinuxTrustedAppCondition,
|
||||
|
@ -238,10 +237,6 @@ export const CreateTrustedAppForm = memo<CreateTrustedAppFormProps>(
|
|||
|
||||
const dataTestSubj = formProps['data-test-subj'];
|
||||
|
||||
const isTrustedAppsByPolicyEnabled = useIsExperimentalFeatureEnabled(
|
||||
'trustedAppsByPolicyEnabled'
|
||||
);
|
||||
|
||||
const isPlatinumPlus = useLicense().isPlatinumPlus();
|
||||
|
||||
const isGlobal = useMemo(() => {
|
||||
|
@ -519,7 +514,7 @@ export const CreateTrustedAppForm = memo<CreateTrustedAppFormProps>(
|
|||
value={trustedApp.description}
|
||||
onChange={handleDomChangeEvents}
|
||||
fullWidth
|
||||
compressed={isTrustedAppsByPolicyEnabled}
|
||||
compressed
|
||||
maxLength={256}
|
||||
data-test-subj={getTestId('descriptionField')}
|
||||
/>
|
||||
|
@ -577,7 +572,7 @@ export const CreateTrustedAppForm = memo<CreateTrustedAppFormProps>(
|
|||
data-test-subj={getTestId('conditionsBuilder')}
|
||||
/>
|
||||
</EuiFormRow>
|
||||
{isTrustedAppsByPolicyEnabled && showAssignmentSection ? (
|
||||
{showAssignmentSection ? (
|
||||
<>
|
||||
<EuiHorizontalRule />
|
||||
<EuiFormRow fullWidth={fullWidth} data-test-subj={getTestId('policySelection')}>
|
||||
|
|
|
@ -20,16 +20,11 @@ import { HttpFetchOptions, HttpFetchOptionsWithPath } from 'kibana/public';
|
|||
import { isFailedResourceState, isLoadedResourceState } from '../state';
|
||||
import { forceHTMLElementOffsetWidth } from '../../../components/effected_policy_select/test_utils';
|
||||
import { toUpdateTrustedApp } from '../../../../../common/endpoint/service/trusted_apps/to_update_trusted_app';
|
||||
import { useIsExperimentalFeatureEnabled } from '../../../../common/hooks/use_experimental_features';
|
||||
import { licenseService } from '../../../../common/hooks/use_license';
|
||||
import { FoundExceptionListItemSchema } from '@kbn/securitysolution-io-ts-list-types';
|
||||
import { EXCEPTION_LIST_ITEM_URL } from '@kbn/securitysolution-list-constants';
|
||||
import { trustedAppsAllHttpMocks } from '../../mocks';
|
||||
|
||||
// TODO: remove this mock when feature flag is removed
|
||||
jest.mock('../../../../common/hooks/use_experimental_features');
|
||||
const useIsExperimentalFeatureEnabledMock = useIsExperimentalFeatureEnabled as jest.Mock;
|
||||
|
||||
jest.mock('../../../../common/hooks/use_license', () => {
|
||||
const licenseServiceInstance = {
|
||||
isPlatinumPlus: jest.fn(),
|
||||
|
@ -173,7 +168,6 @@ describe('When on the Trusted Apps Page', () => {
|
|||
describe('the license is downgraded to gold or below and the user is editing a per policy TA', () => {
|
||||
beforeEach(async () => {
|
||||
(licenseService.isPlatinumPlus as jest.Mock).mockReturnValue(false);
|
||||
useIsExperimentalFeatureEnabledMock.mockReturnValue(true);
|
||||
|
||||
const originalFakeTrustedAppProvider = getFakeTrustedApp.getMockImplementation();
|
||||
getFakeTrustedApp.mockImplementation(() => {
|
||||
|
@ -198,7 +192,6 @@ describe('When on the Trusted Apps Page', () => {
|
|||
describe('the license is downgraded to gold or below and the user is adding a new TA', () => {
|
||||
beforeEach(async () => {
|
||||
(licenseService.isPlatinumPlus as jest.Mock).mockReturnValue(false);
|
||||
useIsExperimentalFeatureEnabledMock.mockReturnValue(true);
|
||||
|
||||
const originalFakeTrustedAppProvider = getFakeTrustedApp.getMockImplementation();
|
||||
getFakeTrustedApp.mockImplementation(() => {
|
||||
|
@ -467,7 +460,6 @@ describe('When on the Trusted Apps Page', () => {
|
|||
});
|
||||
|
||||
it('should have list of policies populated', async () => {
|
||||
useIsExperimentalFeatureEnabledMock.mockReturnValue(true);
|
||||
const resetEnv = forceHTMLElementOffsetWidth();
|
||||
const renderResult = await renderAndClickAddButton();
|
||||
act(() => {
|
||||
|
@ -700,23 +692,6 @@ describe('When on the Trusted Apps Page', () => {
|
|||
expect(flyoutAddButton.disabled).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('and there is a feature flag for agents policy', () => {
|
||||
it('should hide agents policy if feature flag is disabled', async () => {
|
||||
useIsExperimentalFeatureEnabledMock.mockReturnValue(false);
|
||||
const renderResult = await renderAndClickAddButton();
|
||||
expect(
|
||||
renderResult.queryByTestId('addTrustedAppFlyout-createForm-policySelection')
|
||||
).toBeNull();
|
||||
});
|
||||
it('should display agents policy if feature flag is enabled', async () => {
|
||||
useIsExperimentalFeatureEnabledMock.mockReturnValue(true);
|
||||
const renderResult = await renderAndClickAddButton();
|
||||
expect(
|
||||
renderResult.queryByTestId('addTrustedAppFlyout-createForm-policySelection')
|
||||
).toBeTruthy();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('and there are no trusted apps', () => {
|
||||
|
|
|
@ -33,13 +33,9 @@ import { EmptyState } from './components/empty_state';
|
|||
import { SearchExceptions } from '../../../components/search_exceptions';
|
||||
import { BackToExternalAppButton } from '../../../components/back_to_external_app_button';
|
||||
import { ListPageRouteState } from '../../../../../common/endpoint/types';
|
||||
import { useIsExperimentalFeatureEnabled } from '../../../../common/hooks/use_experimental_features';
|
||||
import { ManagementPageLoader } from '../../../components/management_page_loader';
|
||||
|
||||
export const TrustedAppsPage = memo(() => {
|
||||
const isTrustedAppsByPolicyEnabled = useIsExperimentalFeatureEnabled(
|
||||
'trustedAppsByPolicyEnabled'
|
||||
);
|
||||
const dispatch = useDispatch<Dispatch<AppAction>>();
|
||||
const { state: routeState } = useLocation<ListPageRouteState | undefined>();
|
||||
const location = useTrustedAppsSelector(getCurrentLocation);
|
||||
|
@ -120,7 +116,7 @@ export const TrustedAppsPage = memo(() => {
|
|||
defaultValue={location.filter}
|
||||
onSearch={handleOnSearch}
|
||||
placeholder={SEARCH_TRUSTED_APP_PLACEHOLDER}
|
||||
hasPolicyFilter={isTrustedAppsByPolicyEnabled}
|
||||
hasPolicyFilter={true}
|
||||
policyList={policyList}
|
||||
defaultExcludedPolicies={location.excluded_policies}
|
||||
defaultIncludedPolicies={location.included_policies}
|
||||
|
|
|
@ -90,7 +90,7 @@ export const configSchema = schema.object({
|
|||
* @example
|
||||
* xpack.securitySolution.enableExperimental:
|
||||
* - someCrazyFeature
|
||||
* - trustedAppsByPolicyEnabled
|
||||
* - someEvenCrazierFeature
|
||||
*/
|
||||
enableExperimental: schema.arrayOf(schema.string(), {
|
||||
defaultValue: () => [],
|
||||
|
|
|
@ -44,8 +44,6 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) {
|
|||
// always install Endpoint package by default when Fleet sets up
|
||||
`--xpack.fleet.packages.0.name=endpoint`,
|
||||
`--xpack.fleet.packages.0.version=latest`,
|
||||
// TODO: Remove feature flags once we're good to go
|
||||
'--xpack.securitySolution.enableExperimental=["trustedAppsByPolicyEnabled"]',
|
||||
],
|
||||
},
|
||||
layout: {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue