[HTTP] Safer client calls and new browser buildPath utility#257230
Conversation
|
Pinging @elastic/kibana-core (Team:Core) |
|
🤖 Jobs for this PR can be triggered through checkboxes. 🚧
ℹ️ To trigger the CI, please tick the checkbox below 👇
|
|
/ci |
buildPath utilitydelete calls and new browser buildPath utility
|
/ci |
2 similar comments
|
/ci |
|
/ci |
delete calls and new browser buildPath utilitybuildPath utility
|
/ci |
1 similar comment
|
/ci |
Block encoded path traversal segments at the HTTP onRequest layer so Kibana rejects traversal attempts before routing or URL rewriting can redirect requests to unintended endpoints. Made-with: Cursor
This reverts commit eda3429.
Cover the new browser-side path builder and verify dashboard client routes encode path params instead of interpolating raw ids into request URLs. Made-with: Cursor
…r-build-path-utility
| }, | ||
| { | ||
| code: dedent` | ||
| const path = \`/api/dashboards/${'${id}'}\`; |
There was a problem hiding this comment.
It took me a bit to grasp what this is :) Was it your choice to 'escape' the variable symbols like this, or was this suggested by cursor?
If I had to chose, I'd pick the \ way:
| const path = \`/api/dashboards/${'${id}'}\`; | |
| const path = \`/api/dashboards/\${id}\`; |
There was a problem hiding this comment.
For some reason this format was not working, at least not as intended. I'll refactor for better readability. I agree the cruft introduced by ${'${... is pretty noisey
delanni
left a comment
There was a problem hiding this comment.
Outside the escaping nitpick, it looks good!
walterra
left a comment
There was a problem hiding this comment.
datavis code review only LGTM.
|
Starting backport for target branches: 8.19, 9.2, 9.3, 9.4 https://github.com/elastic/kibana/actions/runs/24826911443 |
💔 All backports failed
Manual backportTo create the backport manually run: Questions ?Please refer to the Backport tool documentation |
|
Looks like this PR has backport PRs but they still haven't been merged. Please merge them ASAP to keep the branches relatively in sync. |
1 similar comment
|
Looks like this PR has backport PRs but they still haven't been merged. Please merge them ASAP to keep the branches relatively in sync. |
…265249) ## 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) --------- 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> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: Jeramy Soucy <jeramy.soucy@elastic.co>
|
Looks like this PR has backport PRs but they still haven't been merged. Please merge them ASAP to keep the branches relatively in sync. |
…65250) ## Summary Backport #257230 to `9.3`. Resolved branch-specific conflicts for the older branch layout while preserving the intended path-safety changes. ## 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) --------- 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> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
http<method>calls are used dangerously: direct path injectionbuildPathutility that can be used with server-side routes/api/myapi/{id}to safely build and encode path parameters (bonus: server-side pathconsts can be reused by the client directly, no need to build these separately by hand)No unsafe
httppath usageWill flag usages of
httplike:With a message to use
buildPathorencodeURIComponentin order to safely encode parameters.buildPathNot strictly needed in this PR, this utility allows for using server side paths like
/api/myapi/{id}in a parameterised fashion like:Happy to exclude this utility if it simplifies things.
(Made with cursor y'all)