mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
Disable allowAbsoluteUrls
for axios (#215138)
## Summary After https://github.com/elastic/kibana/pull/214843, `axios` client usages need to set a flag to prevent the vulnerable behavior. To reviewers: if you think it's a mistake, and you created a client to request for absolute URLs, consider unsetting the `baseURL` to communicate intent.
This commit is contained in:
parent
bf5af0d011
commit
e40b17aa22
14 changed files with 15 additions and 0 deletions
|
@ -54,6 +54,7 @@ export class ApmClient {
|
|||
auth,
|
||||
baseURL,
|
||||
timeout,
|
||||
allowAbsoluteUrls: false,
|
||||
});
|
||||
|
||||
this.logger = logger || console;
|
||||
|
|
|
@ -102,6 +102,7 @@ it('captures a list of failed test issue, loads the bodies for each issue, and o
|
|||
"calls": Array [
|
||||
Array [
|
||||
Object {
|
||||
"allowAbsoluteUrls": false,
|
||||
"baseURL": "https://ci-stats.kibana.dev",
|
||||
"data": Object {
|
||||
"failures": Array [
|
||||
|
@ -117,6 +118,7 @@ it('captures a list of failed test issue, loads the bodies for each issue, and o
|
|||
],
|
||||
Array [
|
||||
Object {
|
||||
"allowAbsoluteUrls": false,
|
||||
"baseURL": "https://ci-stats.kibana.dev",
|
||||
"data": Object {
|
||||
"failures": Array [
|
||||
|
|
|
@ -119,6 +119,7 @@ export class ExistingFailedTestIssues {
|
|||
const resp = await Axios.request<FindFailedTestIssuesResponse>({
|
||||
method: 'POST',
|
||||
baseURL: BASE_URL,
|
||||
allowAbsoluteUrls: false,
|
||||
url: '/v1/find_failed_test_issues',
|
||||
data: {
|
||||
failures: failures.map((f) => ({
|
||||
|
|
|
@ -29,6 +29,7 @@ export class GithubApi {
|
|||
constructor(private accessToken?: string) {
|
||||
this.api = axios.create({
|
||||
baseURL: 'https://api.github.com/',
|
||||
allowAbsoluteUrls: false,
|
||||
headers: {
|
||||
Accept: 'application/vnd.github.v3+json',
|
||||
'User-Agent': 'kibana/update_prs_cli',
|
||||
|
|
|
@ -372,6 +372,7 @@ export class CiStatsReporter {
|
|||
method: 'POST',
|
||||
url: path,
|
||||
baseURL: BASE_URL,
|
||||
allowAbsoluteUrls: false,
|
||||
headers,
|
||||
data: body,
|
||||
params: query,
|
||||
|
|
|
@ -405,6 +405,7 @@ describe('request', () => {
|
|||
defaults: {
|
||||
...axios.defaults,
|
||||
baseURL: 'https://here-we-go.com',
|
||||
allowAbsoluteUrls: false,
|
||||
},
|
||||
} as unknown as AxiosInstance,
|
||||
url: '/test',
|
||||
|
|
|
@ -23,6 +23,7 @@ export async function callKibana<T>({
|
|||
const { data } = await axios.request({
|
||||
...options,
|
||||
baseURL: baseUrl,
|
||||
allowAbsoluteUrls: false,
|
||||
auth: { username, password },
|
||||
headers: { 'kbn-xsrf': 'true', 'x-elastic-internal-origin': 'kibana', ...options.headers },
|
||||
});
|
||||
|
|
|
@ -53,6 +53,7 @@ export async function initDiagnosticsBundle({
|
|||
|
||||
const kibanaClientOpts = {
|
||||
baseURL: kbHost ?? parsedCloudId.kibanaHost,
|
||||
allowAbsoluteUrls: false,
|
||||
auth,
|
||||
headers: {
|
||||
'kbn-xsrf': 'true',
|
||||
|
|
|
@ -27,6 +27,7 @@ export async function callKibana<T>({
|
|||
const { data } = await axios.request({
|
||||
...options,
|
||||
baseURL: baseUrl,
|
||||
allowAbsoluteUrls: false,
|
||||
auth: { username, password },
|
||||
headers: { ...DEFAULT_HEADERS, ...options.headers },
|
||||
});
|
||||
|
|
|
@ -23,6 +23,7 @@ export async function callKibana<T>({
|
|||
const { data } = await axios.request({
|
||||
...options,
|
||||
baseURL: baseUrl,
|
||||
allowAbsoluteUrls: false,
|
||||
auth: { username, password },
|
||||
headers: { 'kbn-xsrf': 'true', 'x-elastic-internal-origin': 'kibana', ...options.headers },
|
||||
});
|
||||
|
|
|
@ -48,6 +48,7 @@ export function SpacesServiceProvider({ getService }: FtrProviderContext) {
|
|||
'kbn-xsrf': 'x-pack/ftr/services/spaces/space',
|
||||
},
|
||||
baseURL: url,
|
||||
allowAbsoluteUrls: false,
|
||||
maxRedirects: 0,
|
||||
validateStatus: () => true, // we do our own validation below and throw better error messages
|
||||
httpsAgent,
|
||||
|
|
|
@ -23,6 +23,7 @@ export async function callKibana<T>({
|
|||
const { data } = await axios.request({
|
||||
...options,
|
||||
baseURL: baseUrl,
|
||||
allowAbsoluteUrls: false,
|
||||
auth: { username, password },
|
||||
headers: { 'kbn-xsrf': 'true', ...options.headers },
|
||||
});
|
||||
|
|
|
@ -19,6 +19,7 @@ export class FeaturesService {
|
|||
this.axios = axios.create({
|
||||
headers: { 'kbn-xsrf': 'x-pack/ftr/services/features' },
|
||||
baseURL: url,
|
||||
allowAbsoluteUrls: false,
|
||||
maxRedirects: 0,
|
||||
validateStatus: () => true, // we'll handle our own statusCodes and throw informative errors
|
||||
});
|
||||
|
|
|
@ -39,6 +39,7 @@ export class UICapabilitiesService {
|
|||
this.axios = axios.create({
|
||||
headers: { 'kbn-xsrf': 'x-pack/ftr/services/ui_capabilities' },
|
||||
baseURL: url,
|
||||
allowAbsoluteUrls: false,
|
||||
maxRedirects: 0,
|
||||
validateStatus: () => true, // we'll handle our own statusCodes and throw informative errors
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue