Skip to content

Commit

Permalink
[8.x] [Security Solution][Detection Engine] removes feature flag for …
Browse files Browse the repository at this point in the history
…logged requests for preview (#195569) (#195821)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[Security Solution][Detection Engine] removes feature flag for logged
requests for preview
(#195569)](#195569)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Vitalii
Dmyterko","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-10-10T20:20:50Z","message":"[Security
Solution][Detection Engine] removes feature flag for logged requests for
preview (#195569)\n\n## Summary\r\n \r\n- removes feature flag for
logged requests for
preview","sha":"84d6899a4f2f97e0d015e733cc20064b43636154","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","Team:
SecuritySolution","backport:prev-minor","Team:Detection
Engine"],"title":"[Security Solution][Detection Engine] removes feature
flag for logged requests for
preview","number":195569,"url":"https://github.com/elastic/kibana/pull/195569","mergeCommit":{"message":"[Security
Solution][Detection Engine] removes feature flag for logged requests for
preview (#195569)\n\n## Summary\r\n \r\n- removes feature flag for
logged requests for
preview","sha":"84d6899a4f2f97e0d015e733cc20064b43636154"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/195569","number":195569,"mergeCommit":{"message":"[Security
Solution][Detection Engine] removes feature flag for logged requests for
preview (#195569)\n\n## Summary\r\n \r\n- removes feature flag for
logged requests for
preview","sha":"84d6899a4f2f97e0d015e733cc20064b43636154"}}]}]
BACKPORT-->

Co-authored-by: Vitalii Dmyterko <[email protected]>
  • Loading branch information
kibanamachine and vitaliidm authored Oct 10, 2024
1 parent 749217d commit 19509fd
Show file tree
Hide file tree
Showing 10 changed files with 3 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,6 @@ export const allowedExperimentalValues = Object.freeze({
*/
esqlRulesDisabled: false,

/**
* enables logging requests during rule preview
*/
loggingRequestsEnabled: false,

/**
* Enables Protection Updates tab in the Endpoint Policy Details page
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import {
stepDefineDefaultValue,
} from '../../../../detections/pages/detection_engine/rules/utils';
import { usePreviewInvocationCount } from './use_preview_invocation_count';
import { useIsExperimentalFeatureEnabled } from '../../../../common/hooks/use_experimental_features';

jest.mock('../../../../common/lib/kibana');
jest.mock('./use_preview_route');
Expand All @@ -40,7 +39,6 @@ jest.mock('../../../../common/hooks/use_experimental_features', () => ({
useIsExperimentalFeatureEnabled: jest.fn(),
}));

const useIsExperimentalFeatureEnabledMock = useIsExperimentalFeatureEnabled as jest.Mock;
// rule types that do not support logged requests
const doNotSupportLoggedRequests: Type[] = [
'threshold',
Expand Down Expand Up @@ -114,8 +112,6 @@ describe('PreviewQuery', () => {
});

(usePreviewInvocationCount as jest.Mock).mockReturnValue({ invocationCount: 500 });

useIsExperimentalFeatureEnabledMock.mockReturnValue(true);
});

afterEach(() => {
Expand Down Expand Up @@ -172,23 +168,6 @@ describe('PreviewQuery', () => {
});
});

supportLoggedRequests.forEach((ruleType) => {
test(`does not render "Show Elasticsearch requests" for ${ruleType} rule type when feature is disabled`, () => {
useIsExperimentalFeatureEnabledMock.mockReturnValue(false);

render(
<TestProviders>
<RulePreview
{...defaultProps}
defineRuleData={{ ...defaultProps.defineRuleData, ruleType }}
/>
</TestProviders>
);

expect(screen.queryByTestId('show-elasticsearch-requests')).toBeNull();
});
});

doNotSupportLoggedRequests.forEach((ruleType) => {
test(`does not render "Show Elasticsearch requests" for ${ruleType} rule type`, () => {
render(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ import type {
TimeframePreviewOptions,
} from '../../../../detections/pages/detection_engine/rules/types';
import { usePreviewInvocationCount } from './use_preview_invocation_count';
import { useIsExperimentalFeatureEnabled } from '../../../../common/hooks/use_experimental_features';

export const REASONABLE_INVOCATION_COUNT = 200;

Expand Down Expand Up @@ -90,8 +89,6 @@ const RulePreviewComponent: React.FC<RulePreviewProps> = ({
const { indexPattern, ruleType } = defineRuleData;
const { spaces } = useKibana().services;

const isLoggingRequestsFeatureEnabled = useIsExperimentalFeatureEnabled('loggingRequestsEnabled');

const [spaceId, setSpaceId] = useState('');
useEffect(() => {
if (spaces) {
Expand Down Expand Up @@ -282,8 +279,7 @@ const RulePreviewComponent: React.FC<RulePreviewProps> = ({
</EuiFlexItem>
</EuiFlexGroup>
</EuiFormRow>
{isLoggingRequestsFeatureEnabled &&
RULE_TYPES_SUPPORTING_LOGGED_REQUESTS.includes(ruleType) ? (
{RULE_TYPES_SUPPORTING_LOGGED_REQUESTS.includes(ruleType) ? (
<EuiFormRow>
<EuiFlexGroup alignItems="center" gutterSize="s" responsive>
<EuiFlexItem grow>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ export function createTestConfig(options: CreateTestConfigOptions, testFiles?: s
'--xpack.ruleRegistry.unsafe.legacyMultiTenancy.enabled=true',
`--xpack.securitySolution.enableExperimental=${JSON.stringify([
'previewTelemetryUrlEnabled',
'loggingRequestsEnabled',
'riskScoringPersistence',
'riskScoringRoutesEnabled',
])}`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,5 @@ export default createTestConfig({
'testing_ignored.constant',
'/testing_regex*/',
])}`, // See tests within the file "ignore_fields.ts" which use these values in "alertIgnoreFields"
`--xpack.securitySolution.enableExperimental=${JSON.stringify(['loggingRequestsEnabled'])}`,
],
});
Original file line number Diff line number Diff line change
Expand Up @@ -1190,8 +1190,7 @@ export default ({ getService }: FtrProviderContext) => {
});
});

// skipped on MKI since feature flags are not supported there
describe('@skipInServerlessMKI preview logged requests', () => {
describe('preview logged requests', () => {
it('should not return requests property when not enabled', async () => {
const { logs } = await previewRule({
supertest,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1409,8 +1409,7 @@ export default ({ getService }: FtrProviderContext) => {
});
});

// skipped on MKI since feature flags are not supported there
describe('@skipInServerlessMKI preview logged requests', () => {
describe('preview logged requests', () => {
let rule: EsqlRuleCreateProps;
let id: string;
beforeEach(async () => {
Expand Down
1 change: 0 additions & 1 deletion x-pack/test/security_solution_cypress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) {
// See https://github.com/elastic/kibana/pull/125396 for details
'--xpack.alerting.rules.minimumScheduleInterval.value=1s',
'--xpack.ruleRegistry.unsafe.legacyMultiTenancy.enabled=true',
`--xpack.securitySolution.enableExperimental=${JSON.stringify(['loggingRequestsEnabled'])}`,
// mock cloud to enable the guided onboarding tour in e2e tests
'--xpack.cloud.id=test',
`--home.disableWelcomeScreen=true`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,6 @@ describe(
'Detection rules, preview',
{
tags: ['@ess', '@serverless'],
env: {
kbnServerArgs: [
`--xpack.securitySolution.enableExperimental=${JSON.stringify(['loggingRequestsEnabled'])}`,
],
},
},
() => {
beforeEach(() => {
Expand Down
1 change: 0 additions & 1 deletion x-pack/test/security_solution_cypress/serverless_config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) {
{ product_line: 'endpoint', product_tier: 'complete' },
{ product_line: 'cloud', product_tier: 'complete' },
])}`,
`--xpack.securitySolution.enableExperimental=${JSON.stringify(['loggingRequestsEnabled'])}`,
'--csp.strict=false',
'--csp.warnLegacyBrowsers=false',
],
Expand Down

0 comments on commit 19509fd

Please sign in to comment.