Skip to content

Commit 41fcc21

Browse files
Merge branch 'master' into ua/status_endpoint
2 parents dcd2e44 + ebdda25 commit 41fcc21

File tree

1,272 files changed

+23051
-9949
lines changed

Some content is hidden

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

1,272 files changed

+23051
-9949
lines changed

.ci/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# NOTE: This Dockerfile is ONLY used to run certain tasks in CI. It is not used to run Kibana or as a distributable.
22
# If you're looking for the Kibana Docker image distributable, please see: src/dev/build/tasks/os_packages/docker_generator/templates/dockerfile.template.ts
33

4-
ARG NODE_VERSION=14.17.3
4+
ARG NODE_VERSION=14.17.5
55

66
FROM node:${NODE_VERSION} AS base
77

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ snapshots.js
2727
/x-pack/plugins/canvas/shareable_runtime/build
2828
/x-pack/plugins/canvas/storybook/build
2929
/x-pack/plugins/reporting/server/export_types/printable_pdf/server/lib/pdf/assets/**
30+
/x-pack/plugins/reporting/server/export_types/printable_pdf_v2/server/lib/pdf/assets/**
3031

3132
# package overrides
3233
/packages/elastic-eslint-config-kibana

.github/CODEOWNERS

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@
107107
/x-pack/plugins/observability/public/components/shared/exploratory_view @elastic/uptime
108108
/x-pack/test/functional_with_es_ssl/apps/uptime @elastic/uptime
109109
/x-pack/test/functional/apps/uptime @elastic/uptime
110+
/x-pack/test/functional/es_archives/uptime @elastic/uptime
111+
/x-pack/test/functional/services/uptime @elastic/uptime
110112
/x-pack/test/api_integration/apis/uptime @elastic/uptime
111113

112114
# Client Side Monitoring / Uptime (lives in APM directories but owned by Uptime)
@@ -123,6 +125,12 @@
123125

124126
# Presentation
125127
/src/plugins/dashboard/ @elastic/kibana-presentation
128+
/src/plugins/expression_error/ @elastic/kibana-presentation
129+
/src/plugins/expression_image/ @elastic/kibana-presentation
130+
/src/plugins/expression_metric/ @elastic/kibana-presentation
131+
/src/plugins/expression_repeat_image/ @elastic/kibana-presentation
132+
/src/plugins/expression_reveal_image/ @elastic/kibana-presentation
133+
/src/plugins/expression_shape/ @elastic/kibana-presentation
126134
/src/plugins/input_control_vis/ @elastic/kibana-presentation
127135
/src/plugins/vis_type_markdown/ @elastic/kibana-presentation
128136
/src/plugins/presentation_util/ @elastic/kibana-presentation

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ report.asciidoc
7575
# TS incremental build cache
7676
*.tsbuildinfo
7777

78+
# Automatically generated and user-modifiable
79+
/tsconfig.refs.json
80+
7881
# Yarn local mirror content
7982
.yarn-local-mirror
8083

.node-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
14.17.3
1+
14.17.5

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
14.17.3
1+
14.17.5

BUILD.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
exports_files(
44
[
55
"tsconfig.base.json",
6+
"tsconfig.bazel.json",
67
"tsconfig.browser.json",
8+
"tsconfig.browser_bazel.json",
79
"tsconfig.json",
810
"package.json"
911
],

WORKSPACE.bazel

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ check_rules_nodejs_version(minimum_version_string = "3.7.0")
2727
# we can update that rule.
2828
node_repositories(
2929
node_repositories = {
30-
"14.17.3-darwin_amd64": ("node-v14.17.3-darwin-x64.tar.gz", "node-v14.17.3-darwin-x64", "522f85db1d1fe798cba5f601d1bba7b5203ca8797b2bc934ff6f24263f0b7fb2"),
31-
"14.17.3-linux_arm64": ("node-v14.17.3-linux-arm64.tar.xz", "node-v14.17.3-linux-arm64", "80f4143d3c2d4cf3c4420eea3202c7bf16788b0a72fd512e60bfc8066a08a51c"),
32-
"14.17.3-linux_s390x": ("node-v14.17.3-linux-s390x.tar.xz", "node-v14.17.3-linux-s390x", "4f69c30732f94189b9ab98f3100b17f1e4db2000848d56064e887be1c28e81ae"),
33-
"14.17.3-linux_amd64": ("node-v14.17.3-linux-x64.tar.xz", "node-v14.17.3-linux-x64", "d659d78144042a1801f35dd611d0fab137e841cde902b2c6a821163a5e36f105"),
34-
"14.17.3-windows_amd64": ("node-v14.17.3-win-x64.zip", "node-v14.17.3-win-x64", "170fb4f95539d1d7e1295fb2556cb72bee352cdf81a02ffb16cf6d50ad2fefbf"),
30+
"14.17.5-darwin_amd64": ("node-v14.17.5-darwin-x64.tar.gz", "node-v14.17.5-darwin-x64", "2e40ab625b45b9bdfcb963ddd4d65d87ddf1dd37a86b6f8b075cf3d77fe9dc09"),
31+
"14.17.5-linux_arm64": ("node-v14.17.5-linux-arm64.tar.xz", "node-v14.17.5-linux-arm64", "3a2e674b6db50dfde767c427e8f077235bbf6f9236e1b12a4cc3496b12f94bae"),
32+
"14.17.5-linux_s390x": ("node-v14.17.5-linux-s390x.tar.xz", "node-v14.17.5-linux-s390x", "7d40eee3d54241403db12fb3bc420cd776e2b02e89100c45cf5e74a73942e7f6"),
33+
"14.17.5-linux_amd64": ("node-v14.17.5-linux-x64.tar.xz", "node-v14.17.5-linux-x64", "2d759de07a50cd7f75bd73d67e97b0d0e095ee3c413efac7d1b3d1e84ed76fff"),
34+
"14.17.5-windows_amd64": ("node-v14.17.5-win-x64.zip", "node-v14.17.5-win-x64", "a99b7ee08e846e5d1f4e70c4396265542819d79ed9cebcc27760b89571f03cbf"),
3535
},
36-
node_version = "14.17.3",
36+
node_version = "14.17.5",
3737
node_urls = [
3838
"https://nodejs.org/dist/v{version}/{filename}",
3939
],
512 KB
Loading

dev_docs/best_practices.mdx

Lines changed: 55 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@ Refer to [divio documentation](https://documentation.divio.com/) for guidance on
2222

2323
<DocLink id="kibDevDocsWelcome" text="Getting started" /> and
2424
<DocLink id="kibPlatformIntro" text="Key concepts" /> sections are both _explanation_ oriented,
25-
<DocLink id="kibDevTutorialBuildAPlugin" text="Tutorials" /> covers both _tutorials_ and _How to_, and
26-
the <DocLink id="kibDevDocsApiWelcome" text="API documentation" /> section covers _reference_ material.
25+
<DocLink id="kibDevTutorialDebugging" text="Tutorials" /> covers both _tutorials_ and _How to_, and the <DocLink
26+
id="kibDevDocsApiWelcome"
27+
text="API documentation"
28+
/> section covers _reference_ material.
2729

2830
#### Location
2931

@@ -256,17 +258,17 @@ links](https://elastic.github.io/eui/#/navigation/link#link-validation), and a r
256258

257259
**Best practices**
258260

259-
* Check for dangerous functions or assignments that can result in unescaped user input in the browser DOM. Avoid using:
260-
* **React:** [`dangerouslySetInnerHtml`](https://reactjs.org/docs/dom-elements.html#dangerouslysetinnerhtml).
261-
* **Browser DOM:** `Element.innerHTML` and `Element.outerHTML`.
262-
* If using the aforementioned unsafe functions or assignments is absolutely necessary, follow [these XSS prevention
263-
rules](https://cheatsheetseries.owasp.org/cheatsheets/Cross_Site_Scripting_Prevention_Cheat_Sheet.html#xss-prevention-rules) to ensure that
264-
user input is not inserted into unsafe locations and that it is escaped properly.
265-
* Use EUI components to build your UI, particularly when rendering `href` links. Otherwise, sanitize user input before rendering links to
266-
ensure that they do not use the `javascript:` protocol.
267-
* Don't use the `eval`, `Function`, and `_.template` functions -- these are restricted by ESLint rules.
268-
* Be careful when using `setTimeout` and `setInterval` in client-side code. If an attacker can manipulate the arguments and pass a string to
269-
one of these, it is evaluated dynamically, which is equivalent to the dangerous `eval` function.
261+
- Check for dangerous functions or assignments that can result in unescaped user input in the browser DOM. Avoid using:
262+
- **React:** [`dangerouslySetInnerHtml`](https://reactjs.org/docs/dom-elements.html#dangerouslysetinnerhtml).
263+
- **Browser DOM:** `Element.innerHTML` and `Element.outerHTML`.
264+
- If using the aforementioned unsafe functions or assignments is absolutely necessary, follow [these XSS prevention
265+
rules](https://cheatsheetseries.owasp.org/cheatsheets/Cross_Site_Scripting_Prevention_Cheat_Sheet.html#xss-prevention-rules) to ensure that
266+
user input is not inserted into unsafe locations and that it is escaped properly.
267+
- Use EUI components to build your UI, particularly when rendering `href` links. Otherwise, sanitize user input before rendering links to
268+
ensure that they do not use the `javascript:` protocol.
269+
- Don't use the `eval`, `Function`, and `_.template` functions -- these are restricted by ESLint rules.
270+
- Be careful when using `setTimeout` and `setInterval` in client-side code. If an attacker can manipulate the arguments and pass a string to
271+
one of these, it is evaluated dynamically, which is equivalent to the dangerous `eval` function.
270272

271273
### Cross-Site Request Forgery (CSRF/XSRF)
272274

@@ -280,10 +282,10 @@ Headers](https://www.elastic.co/guide/en/kibana/master/api.html#api-request-head
280282

281283
**Best practices**
282284

283-
* Ensure all HTTP routes are registered with the [Kibana HTTP service](https://www.elastic.co/guide/en/kibana/master/http-service.html) to
284-
take advantage of the custom request header security control.
285-
* Note that HTTP GET requests do **not** require the custom request header; any routes that change data should [adhere to the HTTP
286-
specification and use a different method (PUT, POST, etc.)](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods)
285+
- Ensure all HTTP routes are registered with the [Kibana HTTP service](https://www.elastic.co/guide/en/kibana/master/http-service.html) to
286+
take advantage of the custom request header security control.
287+
- Note that HTTP GET requests do **not** require the custom request header; any routes that change data should [adhere to the HTTP
288+
specification and use a different method (PUT, POST, etc.)](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods)
287289

288290
### Remote Code Execution (RCE)
289291

@@ -295,11 +297,11 @@ ESLint rules to restrict vulnerable functions, and by hooking into or hardening
295297

296298
**Best practices**
297299

298-
* Don't use the `eval`, `Function`, and `_.template` functions -- these are restricted by ESLint rules.
299-
* Don't use dynamic `require`.
300-
* Check for usages of templating libraries. Ensure that user-provided input doesn't influence the template and is used only as data for
301-
rendering the template.
302-
* Take extra caution when spawning child processes with any user input or parameters that are user-controlled.
300+
- Don't use the `eval`, `Function`, and `_.template` functions -- these are restricted by ESLint rules.
301+
- Don't use dynamic `require`.
302+
- Check for usages of templating libraries. Ensure that user-provided input doesn't influence the template and is used only as data for
303+
rendering the template.
304+
- Take extra caution when spawning child processes with any user input or parameters that are user-controlled.
303305

304306
### Prototype Pollution
305307

@@ -309,26 +311,26 @@ hardening sensitive functions (such as those exposed by `child_process`), and by
309311

310312
**Best practices**
311313

312-
* Check for instances of `anObject[a][b] = c` where `a`, `b`, and `c` are controlled by user input. This includes code paths where the
313-
following logical code steps could be performed in separate files by completely different operations, or by recursively using dynamic
314-
operations.
315-
* Validate all user input, including API URL parameters, query parameters, and payloads. Preferably, use a schema that only allows specific
316-
keys and values. At a minimum, implement a deny-list that prevents `__proto__` and `prototype.constructor` from being used within object
317-
keys.
318-
* When calling APIs that spawn new processes or perform code generation from strings, protect against Prototype Pollution by checking if
319-
`Object.hasOwnProperty` has arguments to the APIs that originate from an Object. An example is the defunct Code app's
320-
[`spawnProcess`](https://github.com/elastic/kibana/blob/b49192626a8528af5d888545fb14cd1ce66a72e7/x-pack/legacy/plugins/code/server/lsp/workspace_command.ts#L40-L44)
321-
function.
322-
* Common Node.js offenders: `child_process.spawn`, `child_process.exec`, `eval`, `Function('some string')`, `vm.runInContext(x)`,
323-
`vm.runInNewContext(x)`, `vm.runInThisContext()`
324-
* Common client-side offenders: `eval`, `Function('some string')`, `setTimeout('some string', num)`, `setInterval('some string', num)`
314+
- Check for instances of `anObject[a][b] = c` where `a`, `b`, and `c` are controlled by user input. This includes code paths where the
315+
following logical code steps could be performed in separate files by completely different operations, or by recursively using dynamic
316+
operations.
317+
- Validate all user input, including API URL parameters, query parameters, and payloads. Preferably, use a schema that only allows specific
318+
keys and values. At a minimum, implement a deny-list that prevents `__proto__` and `prototype.constructor` from being used within object
319+
keys.
320+
- When calling APIs that spawn new processes or perform code generation from strings, protect against Prototype Pollution by checking if
321+
`Object.hasOwnProperty` has arguments to the APIs that originate from an Object. An example is the defunct Code app's
322+
[`spawnProcess`](https://github.com/elastic/kibana/blob/b49192626a8528af5d888545fb14cd1ce66a72e7/x-pack/legacy/plugins/code/server/lsp/workspace_command.ts#L40-L44)
323+
function.
324+
- Common Node.js offenders: `child_process.spawn`, `child_process.exec`, `eval`, `Function('some string')`, `vm.runInContext(x)`,
325+
`vm.runInNewContext(x)`, `vm.runInThisContext()`
326+
- Common client-side offenders: `eval`, `Function('some string')`, `setTimeout('some string', num)`, `setInterval('some string', num)`
325327

326328
See also:
327329

328-
* [Prototype pollution: The dangerous and underrated vulnerability impacting JavaScript applications |
329-
portswigger.net](https://portswigger.net/daily-swig/prototype-pollution-the-dangerous-and-underrated-vulnerability-impacting-javascript-applications)
330-
* [Prototype pollution attack in NodeJS application | Olivier
331-
Arteau](https://github.com/HoLyVieR/prototype-pollution-nsec18/blob/master/paper/JavaScript_prototype_pollution_attack_in_NodeJS.pdf)
330+
- [Prototype pollution: The dangerous and underrated vulnerability impacting JavaScript applications |
331+
portswigger.net](https://portswigger.net/daily-swig/prototype-pollution-the-dangerous-and-underrated-vulnerability-impacting-javascript-applications)
332+
- [Prototype pollution attack in NodeJS application | Olivier
333+
Arteau](https://github.com/HoLyVieR/prototype-pollution-nsec18/blob/master/paper/JavaScript_prototype_pollution_attack_in_NodeJS.pdf)
332334

333335
### Server-Side Request Forgery (SSRF)
334336

@@ -339,12 +341,12 @@ a vector for information disclosure or injection attacks.
339341

340342
**Best practices**
341343

342-
* Ensure that all outbound requests from the Kibana server use hard-coded URLs.
343-
* If user input is used to construct a URL for an outbound request, ensure that an allow-list is used to validate the endpoints and that
344-
user input is escaped properly. Ideally, the allow-list should be set in `kibana.yml`, so only server administrators can change it.
345-
* This is particularly relevant when using `transport.request` with the Elasticsearch client, as no automatic escaping is performed.
346-
* Note that URLs are very hard to validate properly; exact match validation for user input is most preferable, while URL parsing or RegEx
347-
validation should only be used if absolutely necessary.
344+
- Ensure that all outbound requests from the Kibana server use hard-coded URLs.
345+
- If user input is used to construct a URL for an outbound request, ensure that an allow-list is used to validate the endpoints and that
346+
user input is escaped properly. Ideally, the allow-list should be set in `kibana.yml`, so only server administrators can change it.
347+
- This is particularly relevant when using `transport.request` with the Elasticsearch client, as no automatic escaping is performed.
348+
- Note that URLs are very hard to validate properly; exact match validation for user input is most preferable, while URL parsing or RegEx
349+
validation should only be used if absolutely necessary.
348350

349351
### Reverse tabnabbing
350352

@@ -356,10 +358,10 @@ buttons, and other vulnerable DOM elements.
356358

357359
**Best practices**
358360

359-
* Use EUI components to build your UI whenever possible. Otherwise, ensure that any DOM elements that have an `href` attribute also have the
360-
`rel="noreferrer noopener"` attribute specified. For more information, refer to the [OWASP HTML5 Security Cheat
361-
Sheet](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/HTML5_Security_Cheat_Sheet.md#tabnabbing).
362-
* If using a non-EUI markdown renderer, use a custom link renderer for rendered links.
361+
- Use EUI components to build your UI whenever possible. Otherwise, ensure that any DOM elements that have an `href` attribute also have the
362+
`rel="noreferrer noopener"` attribute specified. For more information, refer to the [OWASP HTML5 Security Cheat
363+
Sheet](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/HTML5_Security_Cheat_Sheet.md#tabnabbing).
364+
- If using a non-EUI markdown renderer, use a custom link renderer for rendered links.
363365

364366
### Information disclosure
365367

@@ -370,7 +372,7 @@ control, but at a high level, Kibana relies on the hapi framework to automatical
370372

371373
**Best practices**
372374

373-
* Look for instances where sensitive information might accidentally be revealed, particularly in error messages, in the UI, and URL
374-
parameters that are exposed to users.
375-
* Make sure that sensitive request data is not forwarded to external resources. For example, copying client request headers and using them
376-
to make an another request could accidentally expose the user's credentials.
375+
- Look for instances where sensitive information might accidentally be revealed, particularly in error messages, in the UI, and URL
376+
parameters that are exposed to users.
377+
- Make sure that sensitive request data is not forwarded to external resources. For example, copying client request headers and using them
378+
to make an another request could accidentally expose the user's credentials.

0 commit comments

Comments
 (0)