mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
Fixes #29194 In node 10, urls are validated to not include any multi-byte characters, which wouldn't be possible if we were always encoding variables injected into URLs but we missed a couple places.
This commit is contained in:
parent
12a17f4885
commit
48f01ba020
10 changed files with 41 additions and 12 deletions
|
@ -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
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
exports[`StatusMessage should render with exact matches 1`] = `
|
||||
<EuiText
|
||||
data-test-subj="createIndexPatternStatusMessage"
|
||||
grow={true}
|
||||
size="s"
|
||||
>
|
||||
|
@ -48,6 +49,7 @@ exports[`StatusMessage should render with exact matches 1`] = `
|
|||
|
||||
exports[`StatusMessage should render with no partial matches 1`] = `
|
||||
<EuiText
|
||||
data-test-subj="createIndexPatternStatusMessage"
|
||||
grow={true}
|
||||
size="s"
|
||||
>
|
||||
|
@ -83,6 +85,7 @@ exports[`StatusMessage should render with no partial matches 1`] = `
|
|||
|
||||
exports[`StatusMessage should render with partial matches 1`] = `
|
||||
<EuiText
|
||||
data-test-subj="createIndexPatternStatusMessage"
|
||||
grow={true}
|
||||
size="s"
|
||||
>
|
||||
|
@ -118,6 +121,7 @@ exports[`StatusMessage should render with partial matches 1`] = `
|
|||
|
||||
exports[`StatusMessage should render without a query 1`] = `
|
||||
<EuiText
|
||||
data-test-subj="createIndexPatternStatusMessage"
|
||||
grow={true}
|
||||
size="s"
|
||||
>
|
||||
|
@ -145,6 +149,7 @@ exports[`StatusMessage should render without a query 1`] = `
|
|||
|
||||
exports[`StatusMessage should show that no indices exist 1`] = `
|
||||
<EuiText
|
||||
data-test-subj="createIndexPatternStatusMessage"
|
||||
grow={true}
|
||||
size="s"
|
||||
>
|
||||
|
@ -165,6 +170,7 @@ exports[`StatusMessage should show that no indices exist 1`] = `
|
|||
|
||||
exports[`StatusMessage should show that system indices exist 1`] = `
|
||||
<EuiText
|
||||
data-test-subj="createIndexPatternStatusMessage"
|
||||
grow={true}
|
||||
size="s"
|
||||
>
|
||||
|
|
|
@ -161,7 +161,7 @@ export const StatusMessage = ({
|
|||
}
|
||||
|
||||
return (
|
||||
<EuiText size="s">
|
||||
<EuiText size="s" data-test-subj="createIndexPatternStatusMessage">
|
||||
<EuiTextColor color={statusColor}>
|
||||
{ statusIcon ? <EuiIcon type={statusIcon}/> : null }
|
||||
{statusMessage}
|
||||
|
|
|
@ -24,7 +24,8 @@ export default function ({ getService, getPageObjects }) {
|
|||
const browser = getService('browser');
|
||||
const log = getService('log');
|
||||
const retry = getService('retry');
|
||||
const PageObjects = getPageObjects(['settings', 'common']);
|
||||
const testSubjects = getService('testSubjects');
|
||||
const PageObjects = getPageObjects(['settings', 'common', 'header']);
|
||||
|
||||
describe('creating and deleting default index', function describeIndexTests() {
|
||||
before(function () {
|
||||
|
@ -38,6 +39,28 @@ export default function ({ getService, getPageObjects }) {
|
|||
});
|
||||
});
|
||||
|
||||
describe('special character handling', () => {
|
||||
it('should handle special charaters in template input', async () => {
|
||||
await PageObjects.settings.clickOptionalAddNewButton();
|
||||
await PageObjects.header.waitUntilLoadingHasFinished();
|
||||
await PageObjects.settings.setIndexPatternField({
|
||||
indexPatternName: '❤️',
|
||||
expectWildcard: false
|
||||
});
|
||||
await PageObjects.header.waitUntilLoadingHasFinished();
|
||||
|
||||
await retry.try(async () => {
|
||||
expect(await testSubjects.getVisibleText('createIndexPatternStatusMessage'))
|
||||
.to.contain(`The index pattern you've entered doesn't match any indices`);
|
||||
});
|
||||
});
|
||||
|
||||
after(async () => {
|
||||
await PageObjects.settings.navigateTo();
|
||||
await PageObjects.settings.clickKibanaIndices();
|
||||
});
|
||||
});
|
||||
|
||||
describe('index pattern creation', function indexPatternCreation() {
|
||||
let indexPatternId;
|
||||
|
||||
|
|
|
@ -277,7 +277,7 @@ export function SettingsPageProvider({ getService, getPageObjects }) {
|
|||
await this.clickOptionalAddNewButton();
|
||||
await PageObjects.header.waitUntilLoadingHasFinished();
|
||||
await retry.try(async () => {
|
||||
await this.setIndexPatternField(indexPatternName);
|
||||
await this.setIndexPatternField({ indexPatternName });
|
||||
});
|
||||
await PageObjects.common.sleep(2000);
|
||||
await (await this.getCreateIndexPatternGoToStep2Button()).click();
|
||||
|
@ -317,14 +317,14 @@ export function SettingsPageProvider({ getService, getPageObjects }) {
|
|||
return indexPatternId;
|
||||
}
|
||||
|
||||
async setIndexPatternField(indexPatternName = 'logstash-') {
|
||||
async setIndexPatternField({ indexPatternName = 'logstash-', expectWildcard = true } = {}) {
|
||||
log.debug(`setIndexPatternField(${indexPatternName})`);
|
||||
const field = await this.getIndexPatternField();
|
||||
await field.clearValue();
|
||||
await field.type(indexPatternName);
|
||||
const currentName = await field.getAttribute('value');
|
||||
log.debug(`setIndexPatternField set to ${currentName}`);
|
||||
expect(currentName).to.eql(`${indexPatternName}*`);
|
||||
expect(currentName).to.eql(`${indexPatternName}${expectWildcard ? '*' : ''}`);
|
||||
}
|
||||
|
||||
async getCreateIndexPatternGoToStep2Button() {
|
||||
|
|
|
@ -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]
|
||||
};
|
||||
|
|
|
@ -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,
|
||||
};
|
||||
|
@ -67,4 +67,4 @@ export function registerAddPolicyRoute(server) {
|
|||
pre: [ licensePreRouting ]
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 ]
|
||||
};
|
||||
|
|
|
@ -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',
|
||||
};
|
||||
|
||||
|
|
|
@ -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',
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue