Skip to content

Commit

Permalink
Merge branch 'main' into issue-49-apidocs
Browse files Browse the repository at this point in the history
  • Loading branch information
natasha-moore-elastic authored Dec 12, 2024
2 parents e4e1480 + ba945c9 commit 616f691
Show file tree
Hide file tree
Showing 544 changed files with 450 additions and 141 deletions.
14 changes: 7 additions & 7 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -1102,7 +1102,7 @@ module.exports = {
'x-pack/plugins/elastic_assistant/common/**/*.{js,mjs,ts,tsx}',
'x-pack/packages/kbn-elastic-assistant/**/*.{js,mjs,ts,tsx}',
'x-pack/packages/kbn-elastic-assistant-common/**/*.{js,mjs,ts,tsx}',
'x-pack/packages/security-solution/**/*.{js,mjs,ts,tsx}',
'x-pack/solutions/security/packages/**/*.{js,mjs,ts,tsx}',
'x-pack/plugins/security_solution/public/**/*.{js,mjs,ts,tsx}',
'x-pack/plugins/security_solution_ess/public/**/*.{js,mjs,ts,tsx}',
'x-pack/plugins/security_solution_serverless/public/**/*.{js,mjs,ts,tsx}',
Expand Down Expand Up @@ -1140,7 +1140,7 @@ module.exports = {
'x-pack/packages/kbn-elastic-assistant/**/*.{ts,tsx}',
'x-pack/packages/kbn-elastic-assistant-common/**/*.{ts,tsx}',
'x-pack/packages/kbn-langchain/**/*.{ts,tsx}',
'x-pack/packages/security-solution/**/*.{ts,tsx}',
'x-pack/solutions/security/packages/**/*.{ts,tsx}',
'x-pack/plugins/security_solution/**/*.{ts,tsx}',
'x-pack/plugins/security_solution_ess/**/*.{ts,tsx}',
'x-pack/plugins/security_solution_serverless/**/*.{ts,tsx}',
Expand All @@ -1155,7 +1155,7 @@ module.exports = {
'x-pack/packages/kbn-elastic-assistant/**/*.{test,mock,test_helper}.{ts,tsx}',
'x-pack/packages/kbn-elastic-assistant-common/**/*.{test,mock,test_helper}.{ts,tsx}',
'x-pack/packages/kbn-langchain/**/*.{test,mock,test_helper}.{ts,tsx}',
'x-pack/packages/security-solution/**/*.{test,mock,test_helper}.{ts,tsx}',
'x-pack/solutions/security/packages/**/*.{test,mock,test_helper}.{ts,tsx}',
'x-pack/plugins/security_solution/**/*.{test,mock,test_helper}.{ts,tsx}',
'x-pack/plugins/security_solution_ess/**/*.{test,mock,test_helper}.{ts,tsx}',
'x-pack/plugins/security_solution_serverless/**/*.{test,mock,test_helper}.{ts,tsx}',
Expand All @@ -1176,7 +1176,7 @@ module.exports = {
'x-pack/packages/kbn-elastic-assistant/**/*.{ts,tsx}',
'x-pack/packages/kbn-elastic-assistant-common/**/*.{ts,tsx}',
'x-pack/packages/kbn-langchain/**/*.{ts,tsx}',
'x-pack/packages/security-solution/**/*.{ts,tsx}',
'x-pack/solutions/security/packages/**/*.{ts,tsx}',
'x-pack/plugins/security_solution/**/*.{ts,tsx}',
'x-pack/plugins/security_solution_ess/**/*.{ts,tsx}',
'x-pack/plugins/security_solution_serverless/**/*.{ts,tsx}',
Expand Down Expand Up @@ -1210,7 +1210,7 @@ module.exports = {
'x-pack/packages/kbn-elastic-assistant/**/*.{js,mjs,ts,tsx}',
'x-pack/packages/kbn-elastic-assistant-common/**/*.{js,mjs,ts,tsx}',
'x-pack/packages/kbn-langchain/**/*.{js,mjs,ts,tsx}',
'x-pack/packages/security-solution/**/*.{js,mjs,ts,tsx}',
'x-pack/solutions/security/packages/**/*.{js,mjs,ts,tsx}',
'x-pack/plugins/security_solution/**/*.{js,mjs,ts,tsx}',
'x-pack/plugins/security_solution_ess/**/*.{js,mjs,ts,tsx}',
'x-pack/plugins/security_solution_serverless/**/*.{js,mjs,ts,tsx}',
Expand Down Expand Up @@ -1309,8 +1309,8 @@ module.exports = {
overrides: [
{
files: [
'x-pack/packages/security-solution/features/**/*.{js,mjs,ts,tsx}',
'x-pack/packages/security-solution/navigation/**/*.{js,mjs,ts,tsx}',
'x-pack/solutions/security/packages/features/**/*.{js,mjs,ts,tsx}',
'x-pack/solutions/security/packages/navigation/**/*.{js,mjs,ts,tsx}',
'x-pack/plugins/security_solution/**/*.{js,mjs,ts,tsx}',
'x-pack/plugins/security_solution_ess/**/*.{js,mjs,ts,tsx}',
'x-pack/plugins/security_solution_serverless/**/*.{js,mjs,ts,tsx}',
Expand Down
23 changes: 12 additions & 11 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -808,14 +808,6 @@ x-pack/packages/observability/observability_utils/observability_utils_server @el
x-pack/packages/observability/synthetics_test_data @elastic/obs-ux-management-team
x-pack/packages/rollup @elastic/kibana-management
x-pack/packages/search/shared_ui @elastic/search-kibana
x-pack/packages/security-solution/data_table @elastic/security-threat-hunting-investigations
x-pack/packages/security-solution/distribution_bar @elastic/kibana-cloud-security-posture
x-pack/packages/security-solution/ecs_data_quality_dashboard @elastic/security-threat-hunting-explore
x-pack/packages/security-solution/features @elastic/security-threat-hunting-explore
x-pack/packages/security-solution/navigation @elastic/security-threat-hunting-explore
x-pack/packages/security-solution/side_nav @elastic/security-threat-hunting-explore
x-pack/packages/security-solution/storybook/config @elastic/security-threat-hunting-explore
x-pack/packages/security-solution/upselling @elastic/security-threat-hunting-explore
x-pack/packages/security/api_key_management @elastic/kibana-security
x-pack/packages/security/authorization_core @elastic/kibana-security
x-pack/packages/security/authorization_core_common @elastic/kibana-security
Expand Down Expand Up @@ -946,8 +938,8 @@ x-pack/plugins/observability_solution/logs_shared @elastic/obs-ux-logs-team
x-pack/plugins/observability_solution/metrics_data_access @elastic/obs-ux-infra_services-team
x-pack/plugins/observability_solution/observability @elastic/obs-ux-management-team
x-pack/plugins/observability_solution/observability_logs_explorer @elastic/obs-ux-logs-team
x-pack/plugins/observability_solution/observability_onboarding @elastic/obs-ux-logs-team @elastic/obs-ux-onboarding-team
x-pack/plugins/observability_solution/observability_onboarding/e2e @elastic/obs-ux-logs-team @elastic/obs-ux-onboarding-team
x-pack/plugins/observability_solution/observability_onboarding @elastic/obs-ux-logs-team
x-pack/plugins/observability_solution/observability_onboarding/e2e @elastic/obs-ux-logs-team
x-pack/plugins/observability_solution/observability_shared @elastic/observability-ui
x-pack/plugins/observability_solution/profiling @elastic/obs-ux-infra_services-team
x-pack/plugins/observability_solution/profiling_data_access @elastic/obs-ux-infra_services-team
Expand Down Expand Up @@ -1001,6 +993,14 @@ x-pack/solutions/observability/plugins/observability_solution/entities_data_acce
x-pack/solutions/observability/plugins/observability_solution/entity_manager_app @elastic/obs-entities
x-pack/solutions/observability/plugins/streams @elastic/streams-program-team
x-pack/solutions/observability/plugins/streams_app @elastic/streams-program-team
x-pack/solutions/security/packages/data_table @elastic/security-threat-hunting-investigations
x-pack/solutions/security/packages/distribution_bar @elastic/kibana-cloud-security-posture
x-pack/solutions/security/packages/ecs_data_quality_dashboard @elastic/security-threat-hunting-explore
x-pack/solutions/security/packages/features @elastic/security-threat-hunting-explore
x-pack/solutions/security/packages/navigation @elastic/security-threat-hunting-explore
x-pack/solutions/security/packages/side_nav @elastic/security-threat-hunting-explore
x-pack/solutions/security/packages/storybook/config @elastic/security-threat-hunting-explore
x-pack/solutions/security/packages/upselling @elastic/security-threat-hunting-explore
x-pack/test
x-pack/test_serverless
x-pack/test/alerting_api_integration/common/plugins/aad @elastic/response-ops
Expand Down Expand Up @@ -2128,6 +2128,7 @@ x-pack/test_serverless/functional/test_suites/security/index.mki_only.ts @elasti
/x-pack/test/functional/es_archives/auditbeat/default @elastic/security-solution
/x-pack/test/functional/es_archives/auditbeat/hosts @elastic/security-solution
/x-pack/test_serverless/functional/page_objects/svl_management_page.ts @elastic/security-solution
/x-pack/test_serverless/functional/page_objects/svl_data_usage.ts @elastic/security-solution @elastic/obs-ai-assistant
/x-pack/test_serverless/api_integration/test_suites/security @elastic/security-solution

/x-pack/test_serverless/functional/test_suites/security/index.feature_flags.ts @elastic/security-solution
Expand Down Expand Up @@ -2490,7 +2491,7 @@ x-pack/test/automatic_import_api_integration @elastic/security-scalability

## Packages
x-pack/packages/kbn-cloud-security-posture @elastic/kibana-cloud-security-posture
x-pack/packages/security-solution/distribution_bar @elastic/kibana-cloud-security-posture
x-pack/solutions/security/packages/distribution_bar @elastic/kibana-cloud-security-posture
## Plugins
x-pack/plugins/cloud_defend @elastic/kibana-cloud-security-posture
x-pack/plugins/cloud_security_posture @elastic/kibana-cloud-security-posture
Expand Down
2 changes: 1 addition & 1 deletion .i18nrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
"searchIndexDocuments": "packages/kbn-search-index-documents",
"searchResponseWarnings": "packages/kbn-search-response-warnings",
"searchTypes": "packages/kbn-search-types",
"securitySolutionPackages": "x-pack/packages/security-solution",
"securitySolutionPackages": "x-pack/solutions/security/packages",
"serverlessPackages": "packages/serverless",
"sse": ["packages/kbn-sse-utils"],
"coloring": "packages/kbn-coloring/src",
Expand Down
1 change: 1 addition & 0 deletions config/serverless.security.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ xpack.observabilityAIAssistant.enabled: false
xpack.search.notebooks.enabled: false
xpack.searchPlayground.enabled: false
xpack.searchInferenceEndpoints.enabled: false
xpack.inventory.enabled: false

## Fine-tune the security solution feature privileges. Also, refer to `serverless.yml` for the project-agnostic overrides.
xpack.features.overrides:
Expand Down
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@
"@kbn/doc-links": "link:src/platform/packages/shared/kbn-doc-links",
"@kbn/dom-drag-drop": "link:packages/kbn-dom-drag-drop",
"@kbn/ebt-tools": "link:packages/kbn-ebt-tools",
"@kbn/ecs-data-quality-dashboard": "link:x-pack/packages/security-solution/ecs_data_quality_dashboard",
"@kbn/ecs-data-quality-dashboard": "link:x-pack/solutions/security/packages/ecs_data_quality_dashboard",
"@kbn/ecs-data-quality-dashboard-plugin": "link:x-pack/plugins/ecs_data_quality_dashboard",
"@kbn/elastic-agent-utils": "link:packages/kbn-elastic-agent-utils",
"@kbn/elastic-assistant": "link:x-pack/packages/kbn-elastic-assistant",
Expand Down Expand Up @@ -827,20 +827,20 @@
"@kbn/security-plugin-types-public": "link:x-pack/packages/security/plugin_types_public",
"@kbn/security-plugin-types-server": "link:x-pack/packages/security/plugin_types_server",
"@kbn/security-role-management-model": "link:x-pack/packages/security/role_management_model",
"@kbn/security-solution-distribution-bar": "link:x-pack/packages/security-solution/distribution_bar",
"@kbn/security-solution-distribution-bar": "link:x-pack/solutions/security/packages/distribution_bar",
"@kbn/security-solution-ess": "link:x-pack/plugins/security_solution_ess",
"@kbn/security-solution-features": "link:x-pack/packages/security-solution/features",
"@kbn/security-solution-features": "link:x-pack/solutions/security/packages/features",
"@kbn/security-solution-fixtures-plugin": "link:x-pack/test/cases_api_integration/common/plugins/security_solution",
"@kbn/security-solution-navigation": "link:x-pack/packages/security-solution/navigation",
"@kbn/security-solution-navigation": "link:x-pack/solutions/security/packages/navigation",
"@kbn/security-solution-plugin": "link:x-pack/plugins/security_solution",
"@kbn/security-solution-serverless": "link:x-pack/plugins/security_solution_serverless",
"@kbn/security-solution-side-nav": "link:x-pack/packages/security-solution/side_nav",
"@kbn/security-solution-storybook-config": "link:x-pack/packages/security-solution/storybook/config",
"@kbn/security-solution-upselling": "link:x-pack/packages/security-solution/upselling",
"@kbn/security-solution-side-nav": "link:x-pack/solutions/security/packages/side_nav",
"@kbn/security-solution-storybook-config": "link:x-pack/solutions/security/packages/storybook/config",
"@kbn/security-solution-upselling": "link:x-pack/solutions/security/packages/upselling",
"@kbn/security-test-endpoints-plugin": "link:x-pack/test/security_functional/plugins/test_endpoints",
"@kbn/security-ui-components": "link:x-pack/packages/security/ui_components",
"@kbn/securitysolution-autocomplete": "link:packages/kbn-securitysolution-autocomplete",
"@kbn/securitysolution-data-table": "link:x-pack/packages/security-solution/data_table",
"@kbn/securitysolution-data-table": "link:x-pack/solutions/security/packages/data_table",
"@kbn/securitysolution-ecs": "link:packages/kbn-securitysolution-ecs",
"@kbn/securitysolution-endpoint-exceptions-common": "link:packages/kbn-securitysolution-endpoint-exceptions-common",
"@kbn/securitysolution-es-utils": "link:packages/kbn-securitysolution-es-utils",
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-babel-preset/styled_components_files.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ module.exports = {
/x-pack[\/\\]plugins[\/\\](observability_solution\/apm|beats_management|fleet|observability_solution\/infra|lists|observability_solution\/observability|observability_solution\/observability_shared|observability_solution\/exploratory_view|security_solution|timelines|observability_solution\/synthetics|observability_solution\/ux|observability_solution\/uptime)[\/\\]/,
/x-pack[\/\\]test[\/\\]plugin_functional[\/\\]plugins[\/\\]resolver_test[\/\\]/,
/x-pack[\/\\]packages[\/\\]elastic_assistant[\/\\]/,
/x-pack[\/\\]packages[\/\\]security-solution[\/\\]ecs_data_quality_dashboard[\/\\]/,
/x-pack[\/\\]solutions[\/\\]security[\/\\]packages[\/\\]ecs_data_quality_dashboard[\/\\]/,
],
};
2 changes: 1 addition & 1 deletion packages/kbn-ftr-common-functional-ui-services/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export type {
CustomCheerioStatic,
} from './services/web_element_wrapper/custom_cheerio_api';
export { Browsers } from './services/remote/browsers';
export { type Browser } from './services/browser';
export { type Browser, type InterceptResponseFactory } from './services/browser';
export {
NETWORK_PROFILES,
type NetworkOptions,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { Key, Origin, type WebDriver } from 'selenium-webdriver';
import { Driver as ChromiumWebDriver } from 'selenium-webdriver/chrome';
import { setTimeout as setTimeoutAsync } from 'timers/promises';
import Url from 'url';
import { Protocol } from 'devtools-protocol';

import { NoSuchSessionError } from 'selenium-webdriver/lib/error';
import sharp from 'sharp';
Expand All @@ -26,7 +27,12 @@ import {
import { FtrService, type FtrProviderContext } from './ftr_provider_context';

export type Browser = BrowserService;

export interface InterceptResponseFactory {
fail: () => ['Fetch.failRequest', Protocol.Fetch.FailRequestRequest];
fulfill: (
responseOptions: Omit<Protocol.Fetch.FulfillRequestRequest, 'requestId'>
) => ['Fetch.fulfillRequest', Protocol.Fetch.FulfillRequestRequest];
}
class BrowserService extends FtrService {
/**
* Keyboard events
Expand Down Expand Up @@ -837,6 +843,59 @@ class BrowserService extends FtrService {
throw new Error(message);
}
}

/**
* Intercept network requests using the Chrome DevTools Protocol (CDP).
* @param pattern - URL pattern to match intercepted requests.
* @param onIntercept - Callback defining how to handle intercepted requests.
* @param cb - Callback to trigger actions that make requests.
*/

public async interceptRequest(
pattern: string,
onIntercept: (responseFactory: InterceptResponseFactory) => [string, Record<string, any>],
cb: () => Promise<void>
): Promise<void> {
const connection = await this.driver.createCDPConnection('page');

return new Promise<void>((resolve, reject) => {
connection._wsConnection.on('message', async (data: Buffer) => {
try {
const parsed = JSON.parse(data.toString());
this.log.debug(`CDP Event: ${parsed.method} ${parsed.params?.request?.url}`);

if (parsed.method === 'Fetch.requestPaused') {
const requestId = parsed.params.requestId;

const [method, params] = onIntercept({
fail: () => ['Fetch.failRequest', { requestId, errorReason: 'Failed' }],
fulfill: (responseOptions) => [
'Fetch.fulfillRequest',
{ requestId, ...responseOptions },
],
});

connection.execute(method, params, () => {
this.log.debug(`Executed command: ${method}`);
});
}
} catch (error) {
this.log.error(`Error in Fetch.requestPaused handler: ${error.message}`);
}
});

connection.execute('Fetch.enable', { patterns: [{ urlPattern: pattern }] }, (result: any) => {
this.log.debug('Fetch.enable result:', result);

cb()
.then(resolve)
.catch((error) => {
this.log.error(`Error in callback: ${error.message}`);
reject(error);
});
});
});
}
}

export async function BrowserProvider(ctx: FtrProviderContext) {
Expand Down
2 changes: 1 addition & 1 deletion src/dev/storybook/aliases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export const storybookAliases = {
random_sampling: 'x-pack/packages/kbn-random-sampling/.storybook',
esql_editor: 'src/platform/packages/private/kbn-esql-editor/.storybook',
security_solution: 'x-pack/plugins/security_solution/.storybook',
security_solution_packages: 'x-pack/packages/security-solution/storybook/config',
security_solution_packages: 'x-pack/solutions/security/packages/storybook/config',
serverless: 'packages/serverless/storybook/config',
shared_ux: 'packages/shared-ux/storybook/config',
slo: 'x-pack/plugins/observability_solution/slo/.storybook',
Expand Down
Loading

0 comments on commit 616f691

Please sign in to comment.