Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[es] when specifying path with vars always use encodeURIComponent #29210

Merged
merged 6 commits into from
Jan 24, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/legacy/core_plugins/elasticsearch/lib/create_proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export function createProxy(server) {
handler(req, h) {
const { query, payload: body } = req;
return callWithRequest(req, 'transport.request', {
path: `/${req.params.index}/_search`,
path: `/${encodeURIComponent(req.params.index)}/_search`,
method: 'POST',
query,
body
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ async function getAffectedIndices(
}
const indexParams = {
method: 'GET',
path: `/${indexPatterns.join(',')}`,
path: `/${encodeURIComponent(indexPatterns.join(','))}`,
// we allow 404 in case there are no indices
ignore: [404]
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ async function updateIndexTemplate(callWithRequest, indexTemplatePatch) {

const params = {
method: 'PUT',
path: `/_template/${indexTemplatePatch.templateName}`,
path: `/_template/${encodeURIComponent(indexTemplatePatch.templateName)}`,
ignore: [ 404 ],
body: template,
};
Expand Down Expand Up @@ -67,4 +67,4 @@ export function registerAddPolicyRoute(server) {
pre: [ licensePreRouting ]
}
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { licensePreRoutingFactory } from'../../../lib/license_pre_routing_factor
async function fetchTemplate(callWithRequest, templateName) {
const params = {
method: 'GET',
path: `/_template/${templateName}`,
path: `/_template/${encodeURIComponent(templateName)}`,
// we allow 404 incase the user shutdown security in-between the check and now
ignore: [ 404 ]
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function getIndexArrayFromPayload(payload) {

async function freezeIndices(callWithRequest, indices) {
const params = {
path: `/${indices.join(',')}/_freeze`,
path: `/${encodeURIComponent(indices.join(','))}/_freeze`,
method: 'POST',
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function getIndexArrayFromPayload(payload) {

async function unfreezeIndices(callWithRequest, indices) {
const params = {
path: `/${indices.join(',')}/_unfreeze`,
path: `/${encodeURIComponent(indices.join(','))}/_unfreeze`,
method: 'POST',
};

Expand Down