[9.3] chore(axios,security-generative-ai) Remove axios dependency in favor … (#266771)#267467
Merged
kibanamachine merged 1 commit intoelastic:9.3from May 4, 2026
Merged
Conversation
elastic#266771) ## Summary This PR removes the `axios` dependency for files owned by `@elastic/security-generative-ai`. Phase 1.1 of the axios migration tracked under elastic#266556. ### Why Node.js 22 ships a native `fetch` API built on undici, and every browser Kibana targets supports `fetch` natively. Removing axios cuts one runtime dependency and continues the per-team rollout that mirrors the earlier node-fetch migration ([elastic#250719](elastic#250719) and siblings). ### Changes - Migrated `create_conversations_script.ts` (a developer seed script fetching the connector list) from `axios.get` to `fetch`. - Migrated `create_and_login_users.js` (a developer script that creates test users via the Elasticsearch security API) from `axios.get` / `axios.put` to `fetch`. Three call sites: role lookup, role create, user create. Basic auth was previously passed via axios's `auth: { username, password }` option; native fetch strips `user:pass@` URL credentials, so it now goes through an `Authorization: Basic <base64>` header. - Removed the entire `x-pack/solutions/security/plugins/elastic_assistant/scripts/` entry from `AXIOS_LEGACY_CONSUMERS` in `.eslintrc.js`. New axios usage anywhere in this directory is now blocked by the existing global ban. ### Behavior parity Native fetch does not throw on non-2xx, so each call site explicitly checks `res.ok` / `res.status`. The previous status-based branches (404 fall-through on role check, 409 informational on user create) are preserved with the same logging and `return err` shape. The diff is intentionally minimal: variable names, comment placement, try-catch structure, and error-return semantics from the original axios code are kept. Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> (cherry picked from commit 0643d49)
Contributor
Author
💚 Build Succeeded
Metrics [docs]
cc @azasypkin |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport
This will backport the following commits from
mainto9.3:Questions ?
Please refer to the Backport tool documentation