Skip to content

[8.19] [HTTP] Safer client calls and new browser buildPath utility#265249

Merged
jloleysens merged 5 commits into
elastic:8.19from
jloleysens:backport/8.19/pr-257230
Apr 28, 2026
Merged

[8.19] [HTTP] Safer client calls and new browser buildPath utility#265249
jloleysens merged 5 commits into
elastic:8.19from
jloleysens:backport/8.19/pr-257230

Conversation

@jloleysens
Copy link
Copy Markdown
Contributor

@jloleysens jloleysens commented Apr 23, 2026

Summary

Backport #257230 to 8.19.

Resolved branch-specific conflicts while keeping the older 8.19 dashboard and lens implementations intact.

Validation

Could not run node scripts/check_changes.ts or Jest in the temporary backport repo because dependencies are not bootstrapped there.

(Made with cursor y'all)

…c#257230)

- Create a new best-effort ESLint rule that checks if `http<method>`
calls are used dangerously: direct path injection
- Adds a new `buildPath` utility that can be used with server-side
routes `/api/myapi/{id}` to safely build and encode path parameters
(**bonus**: server-side path `const`s can be reused by the client
directly, no need to build these separately by hand)
- Updates existing usages

Will flag usages of `http` like:

```ts
core.http.delete(`/api/myapi/${id}`, {...});
```

With a message to use `buildPath` or `encodeURIComponent` in order to
safely encode parameters.

Not strictly needed in this PR, this utility allows for using server
side paths like `/api/myapi/{id}` in a parameterised fashion like:

```ts
import { buildPath } from '@kbn/core-http-browser';

buildPath('/api/dashboard/{id}' /* same as { path: ... } server side */, { id })
// => /api/dashboard/encoded-id
```

Happy to exclude this utility if it simplifies things.

(Made with cursor y'all)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Gerard Soldevila <gerard.soldevila@elastic.co>
(cherry picked from commit 2d72284)
@jloleysens jloleysens added Team:Core Platform Core services: plugins, logging, config, saved objects, http, ES client, i18n, etc t// release_note:skip Skip the PR/issue when compiling release notes backport:skip This PR does not require backporting labels Apr 23, 2026
@jloleysens jloleysens changed the title [8.19] [HTTP] Safer client calls and new browser utility [8.19] [HTTP] Safer client calls and new browser buildPath utility Apr 23, 2026
@jloleysens jloleysens marked this pull request as ready for review April 24, 2026 09:49
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/kibana-core (Team:Core)

@elastic elastic deleted a comment from infra-vault-gh-plugin-prod Bot Apr 24, 2026
@jloleysens
Copy link
Copy Markdown
Contributor Author

@elasticmachine merge upstream

@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/obs-ux-management-team (Team:obs-ux-management)

@elasticmachine
Copy link
Copy Markdown
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #78 / saved objects tagging - functional tests feature controls tag management write privileges can bulk delete tags

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
canvas 1406 1408 +2
data 536 538 +2
enterpriseSearch 2214 2216 +2
logstash 52 54 +2
observability 1459 1461 +2
osquery 314 316 +2
total +12

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
@kbn/core-http-browser 36 38 +2

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
canvas 1.1MB 1.1MB +1.0KB
enterpriseSearch 2.5MB 2.5MB +835.0B
home 142.3KB 142.3KB +40.0B
osquery 1.0MB 1.0MB +947.0B
total +2.8KB

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
data 404.1KB 404.9KB +879.0B
kbnUiSharedDeps-srcJs 3.6MB 3.6MB +127.0B
logstash 14.1KB 14.9KB +815.0B
observability 93.8KB 94.6KB +822.0B
total +2.6KB
Unknown metric groups

API count

id before after diff
@kbn/core-http-browser 116 119 +3

@kibanamachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
canvas 1406 1408 +2
data 536 538 +2
enterpriseSearch 2214 2216 +2
logstash 52 54 +2
observability 1459 1461 +2
osquery 314 316 +2
total +12

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
@kbn/core-http-browser 36 38 +2

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
canvas 1.1MB 1.1MB +1.0KB
enterpriseSearch 2.5MB 2.5MB +835.0B
home 142.3KB 142.3KB +40.0B
osquery 1.0MB 1.0MB +947.0B
total +2.8KB

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
data 404.1KB 404.9KB +879.0B
logstash 14.1KB 14.9KB +815.0B
observability 93.8KB 94.6KB +822.0B
total +2.5KB
Unknown metric groups

API count

id before after diff
@kbn/core-http-browser 116 119 +3

@jloleysens jloleysens merged commit d48edd9 into elastic:8.19 Apr 28, 2026
10 checks passed
@jloleysens jloleysens deleted the backport/8.19/pr-257230 branch April 28, 2026 08:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting release_note:skip Skip the PR/issue when compiling release notes Team:Core Platform Core services: plugins, logging, config, saved objects, http, ES client, i18n, etc t// Team:obs-ux-management

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants