Skip to content

Commit 4774020

Browse files
authored
Merge branch 'main' into copilot/fix-custom-instructions-field-title
2 parents ea32402 + b19818d commit 4774020

1,009 files changed

Lines changed: 37704 additions & 13256 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.buildkite/ftr-manifests/ftr_platform_stateful_configs.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,6 @@ enabled:
256256
- x-pack/platform/test/functional/apps/cross_cluster_replication/config.ts
257257
- x-pack/platform/test/functional/apps/dashboard/group1/config.ts
258258
- x-pack/platform/test/functional/apps/dashboard/group3/config.ts
259-
- x-pack/platform/test/functional/apps/data_views/config.ts
260259
- x-pack/platform/test/functional/apps/discover/group1/config.ts
261260
- x-pack/platform/test/functional/apps/discover/group2/config.ts
262261
- x-pack/platform/test/functional/apps/discover/group3/config.ts
@@ -321,14 +320,6 @@ enabled:
321320
- x-pack/platform/test/functional/apps/reporting_management/config.ts
322321
- x-pack/platform/test/functional/apps/rollup_job/config.ts
323322
- x-pack/platform/test/functional/apps/saved_objects_management/config.ts
324-
- x-pack/platform/test/functional/apps/saved_query_management/config.discover.ts
325-
- x-pack/platform/test/functional/apps/saved_query_management/config.dashboard.ts
326-
- x-pack/platform/test/functional/apps/saved_query_management/config.maps.ts
327-
- x-pack/platform/test/functional/apps/saved_query_management/config.visualize.ts
328-
- x-pack/platform/test/functional/apps/saved_query_management/config.v2.discover.ts
329-
- x-pack/platform/test/functional/apps/saved_query_management/config.v2.dashboard.ts
330-
- x-pack/platform/test/functional/apps/saved_query_management/config.v2.maps.ts
331-
- x-pack/platform/test/functional/apps/saved_query_management/config.v2.visualize.ts
332323
- x-pack/platform/test/functional/apps/security/config.ts
333324
- x-pack/platform/test/functional/apps/snapshot_restore/config.ts
334325
- x-pack/platform/test/functional/apps/spaces/config.ts

.buildkite/pipelines/evals/evals.suites.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,20 @@
162162
"evals:attack-discovery"
163163
]
164164
},
165+
{
166+
"id": "lead-generation",
167+
"name": "Lead Generation",
168+
"configPath": "x-pack/solutions/security/packages/kbn-evals-suite-lead-generation/playwright.config.ts",
169+
"tags": [
170+
"security",
171+
"lead-generation",
172+
"entity-analytics"
173+
],
174+
"ciLabels": [
175+
"evals:lead-generation"
176+
],
177+
"serverConfigSet": "evals_lead_generation"
178+
},
165179
{
166180
"id": "workflows",
167181
"name": "Workflows Authoring",

.buildkite/pipelines/flaky_tests/pipeline.ts

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,8 @@ if (Number.isNaN(concurrency)) {
3434

3535
const BASE_JOBS = 1;
3636
const MAX_JOBS = 500;
37-
// Each scoutConfig now fans out to one Buildkite step per (arch, domain) mode,
38-
// so a single entry can multiply into many jobs. Cap per-entry runs to keep the
39-
// total job budget under control and to give users a clear, fast failure when
40-
// they request too many repetitions for a single config.
41-
const MAX_SCOUT_COUNT_PER_CONFIG = 50;
37+
// 50 runs is enough to confirm a test is no longer flaky;
38+
const MAX_COUNT_PER_CONFIG = 50;
4239

4340
// Scout discovery target for the flaky-setup step. We read the branch name
4441
// from `package.json` (set when forking a release branch).
@@ -88,6 +85,13 @@ function getTestSuitesFromJson(json: string) {
8885
fail(`testSuite.ftrConfig must be a string`);
8986
}
9087

88+
if (count > MAX_COUNT_PER_CONFIG) {
89+
fail(
90+
`testSuite.count for ftrConfig '${ftrConfig}' is ${count}; ` +
91+
`max allowed is ${MAX_COUNT_PER_CONFIG}. Lower the count or split the run.`
92+
);
93+
}
94+
9195
testSuites.push({
9296
type: 'ftrConfig',
9397
ftrConfig,
@@ -102,10 +106,10 @@ function getTestSuitesFromJson(json: string) {
102106
fail(`testSuite.scoutConfig must be a string`);
103107
}
104108

105-
if (count > MAX_SCOUT_COUNT_PER_CONFIG) {
109+
if (count > MAX_COUNT_PER_CONFIG) {
106110
fail(
107111
`testSuite.count for scoutConfig '${scoutConfig}' is ${count}; ` +
108-
`max allowed is ${MAX_SCOUT_COUNT_PER_CONFIG}. ` +
112+
`max allowed is ${MAX_COUNT_PER_CONFIG}. ` +
109113
`Each Scout request fans out to one job per (arch x domain) mode, ` +
110114
`so high counts multiply quickly. Lower the count or split the run.`
111115
);
@@ -123,6 +127,14 @@ function getTestSuitesFromJson(json: string) {
123127
if (typeof key !== 'string') {
124128
fail(`testSuite.key must be a string`);
125129
}
130+
131+
if (count > MAX_COUNT_PER_CONFIG) {
132+
fail(
133+
`testSuite.count for group '${key}' is ${count}; ` +
134+
`max allowed is ${MAX_COUNT_PER_CONFIG}. Lower the count or split the run.`
135+
);
136+
}
137+
126138
testSuites.push({
127139
type: 'group',
128140
key,

.buildkite/pipelines/orchestrate_vm_builds.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,15 @@ steps:
1414
required: true
1515

1616
- name: 'Upload trigger steps'
17-
checkout: none
17+
plugins:
18+
- sparse-checkout#v1.6.0:
19+
paths:
20+
- .buildkite
21+
- .node-version
22+
- package.json
23+
- tsconfig.base.json
24+
- versions.json
25+
cleanup_sparse_state: true
1826
command: |
1927
VM_IMAGES_BRANCH="$$(buildkite-agent meta-data get "VM_IMAGES_BRANCH")"
2028
KIBANA_BRANCH="$$(buildkite-agent meta-data get "KIBANA_BRANCH")"

.buildkite/scout_ci_config.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ plugins:
1616
- dashboard_markdown
1717
- data
1818
- data_views
19+
- data_view_management
1920
- dev_tools
2021
- discover
2122
- discover_enhanced
@@ -63,6 +64,7 @@ plugins:
6364
- task_manager
6465
- transform
6566
- triggers_actions_ui
67+
- unified_search
6668
- upgrade_assistant
6769
- uptime
6870
- ux

.github/CODEOWNERS

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,7 @@ src/platform/packages/shared/content-management/table_list_view @elastic/appex-s
472472
src/platform/packages/shared/content-management/table_list_view_common @elastic/appex-sharedux
473473
src/platform/packages/shared/content-management/table_list_view_table @elastic/appex-sharedux
474474
src/platform/packages/shared/content-management/user_profiles @elastic/appex-sharedux
475+
src/platform/packages/shared/context-switcher-components @elastic/appex-sharedux
475476
src/platform/packages/shared/controls/control-group-renderer @elastic/kibana-presentation
476477
src/platform/packages/shared/controls/controls-constants @elastic/kibana-presentation
477478
src/platform/packages/shared/controls/controls-schemas @elastic/kibana-presentation
@@ -1328,6 +1329,7 @@ x-pack/solutions/security/packages/kbn-evals-suite-alerts-rag @elastic/security-
13281329
x-pack/solutions/security/packages/kbn-evals-suite-attack-discovery @elastic/security-threat-hunting
13291330
x-pack/solutions/security/packages/kbn-evals-suite-endpoint @elastic/security-defend-workflows
13301331
x-pack/solutions/security/packages/kbn-evals-suite-entity-analytics @elastic/security-entity-analytics
1332+
x-pack/solutions/security/packages/kbn-evals-suite-lead-generation @elastic/security-entity-analytics
13311333
x-pack/solutions/security/packages/kbn-evals-suite-pci-compliance @elastic/security-defend-workflows
13321334
x-pack/solutions/security/packages/kbn-evals-suite-security-ai-rules @elastic/security-detection-engine
13331335
x-pack/solutions/security/packages/kbn-evals-suite-security-automatic-migrations @elastic/security-threat-hunting
@@ -1465,7 +1467,6 @@ x-pack/platform/test/serverless/api_integration/test_suites/platform_security @e
14651467
/x-pack/platform/test/api_integration/apis/management/rollup/index_patterns_extensions.js @elastic/kibana-data-discovery
14661468
/x-pack/platform/test/api_integration/apis/search @elastic/kibana-data-discovery
14671469
/x-pack/platform/test/examples/search_examples @elastic/kibana-data-discovery
1468-
/x-pack/platform/test/functional/apps/data_views @elastic/kibana-data-discovery
14691470
/x-pack/platform/test/functional/apps/discover @elastic/kibana-data-discovery
14701471
/x-pack/platform/test/functional/apps/saved_query_management @elastic/kibana-data-discovery
14711472
/x-pack/platform/test/functional_with_es_ssl/apps/discover_ml/discover @elastic/kibana-data-discovery
@@ -2859,6 +2860,9 @@ x-pack/solutions/security/test/security_solution_api_integration/test_suites/sou
28592860
/x-pack/solutions/security/plugins/security_solution/.agents/skills/flaky-test-doctor @elastic/security-engineering-productivity
28602861
/x-pack/solutions/security/plugins/security_solution/.agents/skills/scout-best-practices-reviewer @elastic/security-engineering-productivity
28612862
/x-pack/solutions/security/plugins/security_solution/.agents/skills/test-plan-generator @elastic/security-engineering-productivity
2863+
/x-pack/solutions/security/plugins/security_solution/.agents/skills/bug-fixer @elastic/security-engineering-productivity
2864+
/x-pack/solutions/security/plugins/security_solution/.agents/skills/bug-reproduce @elastic/security-engineering-productivity
2865+
/x-pack/solutions/security/plugins/security_solution/.agents/skills/bug-fix @elastic/security-engineering-productivity
28622866
/x-pack/solutions/security/test/security_solution_cypress/* @elastic/security-engineering-productivity
28632867
/x-pack/solutions/security/test/security_solution_cypress/cypress/* @elastic/security-engineering-productivity
28642868
/x-pack/solutions/security/test/security_solution_cypress/cypress/tasks/login.ts @elastic/security-engineering-productivity
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
/**
2+
* Shared predicates for excluding non-request-payload schema usages from
3+
* Kibana DoS queries (unbounded strings, unbounded arrays, etc.).
4+
*
5+
* CONSERVATIVE POLICY: Only exclude file paths that NEVER contain HTTP request
6+
* payload schemas. When in doubt, keep the finding — a false positive is far
7+
* less costly than missing a real vulnerability.
8+
*
9+
* For one-off false positives in mixed-purpose files, use inline suppression:
10+
* // codeql[js/kibana/unbounded-string-in-schema] reason
11+
* // codeql[js/kibana/unbounded-array-in-schema] reason
12+
*
13+
* If a new file category consistently produces false positives, add a path
14+
* pattern here rather than scattering per-line suppressions.
15+
*/
16+
17+
import javascript
18+
19+
/**
20+
* Holds when `e` resides in a file whose schemas are known to never validate
21+
* HTTP request payloads. These fall into structural/data-at-rest categories:
22+
* plugin configuration, saved-object attributes, UI settings, content
23+
* management layer schemas, sample-data registration, AI/LLM output schemas,
24+
* and tooling config.
25+
*/
26+
predicate shouldExcludeFileFromDoSRules(Expr e) {
27+
exists(string path | path = e.getFile().getRelativePath() |
28+
// Plugin configuration (kibana.yml settings)
29+
e.getFile().getBaseName() = "config.ts"
30+
or
31+
// Plugin server entry points (re-exports only)
32+
(e.getFile().getBaseName() = "index.ts" and
33+
path.regexpMatch(".*/plugins/[^/]+(/[^/]+)?/server/index\\.ts"))
34+
or
35+
// Saved-object attribute schemas (versioned shapes, never route payloads)
36+
path.regexpMatch(".*/saved_objects/schemas/.*")
37+
or
38+
// Saved-object model-version migration schemas
39+
path.regexpMatch(".*/saved_objects/model_versions/.*")
40+
or
41+
// Saved-object type sub-schemas (e.g. cases/server/saved_object_types/*/schemas/*)
42+
path.regexpMatch(".*/saved_object_types/.*/schemas/.*")
43+
or
44+
// Dashboard saved-object attribute schemas
45+
path.regexpMatch(".*/dashboard_saved_object/schema/.*")
46+
or
47+
// Content-management layer schemas (maps, lens, links CM CRUD)
48+
path.regexpMatch(".*/content_management/schema/.*")
49+
or
50+
// UI-settings definitions (Advanced Settings value schemas)
51+
e.getFile().getBaseName() = "ui_settings.ts"
52+
or
53+
path.regexpMatch(".*/ui_settings/.*")
54+
or
55+
// Sample-data registration schema (internal registration, not HTTP input)
56+
path.regexpMatch(".*/sample_data/lib/sample_dataset_schema\\.ts")
57+
or
58+
// Connector-schema type-only files (no route handlers)
59+
path.regexpMatch(".*/kbn-connector-schemas/.*/types/.*")
60+
or
61+
// LLM/AI structured-output schemas
62+
path.regexpMatch(".*/compaction_schema\\.ts")
63+
or
64+
// Agent-builder tool parameter schemas (AI tool arguments, not HTTP routes)
65+
path.regexpMatch(".*/agent_builder/tools/.*")
66+
or
67+
// Benchmark tooling config schemas
68+
path.regexpMatch(".*/kbn-bench/.*")
69+
or
70+
// Scout test-environment config schemas
71+
path.regexpMatch(".*/kbn-scout/.*/schema/.*")
72+
)
73+
}

.github/codeql/custom-queries/dos/UnboundedArrayInRoute.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ An attacker could exploit unbounded array validation by sending extremely large
1111
- Application crashes due to out-of-memory conditions
1212
- Degraded performance affecting all users of the system
1313

14-
The query specifically targets `schema.arrayOf()` calls that are missing the `maxSize` option in the second argument. It excludes configuration files (`config.ts`) and plugin entry points (`server/index.ts`) as these typically handle trusted internal configuration rather than external user input.
14+
The query specifically targets `schema.arrayOf()` calls that are missing the `maxSize` option in the second argument. It uses a shared exclusion list (defined in `KibanaDoSExclusions.qll`) to skip files whose schemas are known to never validate HTTP request payloads, such as saved-object attribute schemas, plugin configuration, UI settings definitions, content-management layer schemas, and similar structural/data-at-rest categories. See that file for the full set of excluded path patterns.
1515

1616
## Recommendation
1717

@@ -119,6 +119,19 @@ router.post({
119119
}, handler);
120120
```
121121

122+
## False positives and suppression
123+
124+
This query intentionally casts a wide net — it flags all unbounded `schema.arrayOf()` calls except those in file paths that are clearly non-payload contexts. Some findings will be in schemas that validate route **responses**, saved-object attributes in shared files, or other non-request-payload contexts. These are expected false positives.
125+
126+
To suppress a legitimate false positive, add a `codeql[...]` comment on the line above the flagged call:
127+
128+
```javascript
129+
// codeql[js/kibana/unbounded-array-in-schema] internal registration — not route input
130+
schema.arrayOf(schema.string())
131+
```
132+
133+
The exclusion list in `KibanaDoSExclusions.qll` is maintained conservatively and may be updated as new non-payload schema patterns are identified. If you encounter a false positive that affects an entire file category (not a one-off), consider proposing an addition to the shared exclusion library rather than adding per-line suppressions.
134+
122135
## References
123136

124137
- [OWASP: Denial of Service Attacks](https://owasp.org/www-community/attacks/Denial_of_Service)

.github/codeql/custom-queries/dos/UnboundedArrayInRoute.qhelp

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,19 @@ requests. This can cause:
1919
<li>Degraded performance affecting all users of the system</li>
2020
</ul>
2121
<p>
22-
The query specifically targets <code>schema.arrayOf()</code> calls that are missing the
23-
<code>maxSize</code> option in the second argument. It excludes configuration files
24-
(<code>config.ts</code>) and plugin entry points (<code>server/index.ts</code>) as these
25-
typically handle trusted internal configuration rather than external user input.
22+
The query specifically targets <code>schema.arrayOf()</code> calls that are missing the
23+
<code>maxSize</code> option in the second argument. It uses a shared exclusion list (defined
24+
in <code>KibanaDoSExclusions.qll</code>) to skip files whose schemas are known to never validate
25+
HTTP request payloads, such as saved-object attribute schemas, plugin configuration, UI settings
26+
definitions, content-management layer schemas, and similar structural/data-at-rest categories.
27+
See that file for the full set of excluded path patterns.
28+
</p>
29+
<p>
30+
Some findings will be in schemas that validate route <b>responses</b> or other non-request-payload
31+
contexts. These are expected false positives. To suppress a legitimate false positive, add a
32+
<code>codeql[js/kibana/unbounded-array-in-schema]</code> comment on the line above the flagged
33+
call. If a false positive affects an entire file category, consider proposing an addition to
34+
<code>KibanaDoSExclusions.qll</code> rather than adding per-line suppressions.
2635
</p>
2736
</overview>
2837

.github/codeql/custom-queries/dos/UnboundedArrayInRoute.ql

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
*/
1515

1616
import javascript
17+
import dos.KibanaDoSExclusions
1718

1819
/**
1920
* Gets the local variable bound to 'schema' imported from '@kbn/config-schema'
@@ -22,7 +23,11 @@ LocalVariable schemaVariable() {
2223
exists(ImportDeclaration decl, ImportSpecifier spec |
2324
decl.getImportedPathExpr().getStringValue() = "@kbn/config-schema" and
2425
spec = decl.getASpecifier() and
25-
spec.getImportedName() = "schema" and
26+
(
27+
spec.getImportedName() = "schema"
28+
or
29+
spec instanceof ImportNamespaceSpecifier
30+
) and
2631
result = spec.getLocal().getVariable()
2732
)
2833
}
@@ -54,25 +59,10 @@ class SchemaArrayOfCall extends CallExpr {
5459
}
5560
}
5661

57-
/**
58-
* Identifies files that should be excluded from analysis:
59-
* - config.ts files (plugin configuration, not request validation)
60-
* - index.ts files at plugin server root (typically re-exports)
61-
*/
62-
predicate isInExcludedFile(Expr e) {
63-
e.getFile().getBaseName() = "config.ts"
64-
or
65-
// Exclude index.ts at plugin server root: plugins/*/server/index.ts or plugins/*/*/server/index.ts
66-
(
67-
e.getFile().getBaseName() = "index.ts" and
68-
e.getFile().getRelativePath().regexpMatch(".*/plugins/[^/]+(/[^/]+)?/server/index\\.ts")
69-
)
70-
}
71-
7262
from SchemaArrayOfCall arrayCall
7363
where
7464
not arrayCall.hasMaxSize() and
75-
not isInExcludedFile(arrayCall)
65+
not shouldExcludeFileFromDoSRules(arrayCall)
7666
select arrayCall,
7767
"This schema.arrayOf() call does not specify a maxSize. Unbounded input can cause Denial of Service (DoS) vulnerabilities. Consider adding { maxSize: N } as the second argument."
7868

0 commit comments

Comments
 (0)