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

Closes #2977 - Removed POST body restriction from _search and _validate #2982

Merged
merged 1 commit into from
Feb 11, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
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
8 changes: 4 additions & 4 deletions src/server/lib/validateRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ function validate(req) {

// methods that accept standard json bodies
var maybeMGet = ('_mget' === maybeMethod && add && jsonBody);
var maybeSearch = ('_search' === maybeMethod && add && jsonBody);
var maybeValidate = ('_validate' === maybeMethod && add && jsonBody);
var maybeSearch = ('_search' === maybeMethod && add);
var maybeValidate = ('_validate' === maybeMethod && add);

// methods that accept bulk bodies
var maybeBulk = ('_bulk' === maybeMethod && add && bulkBody);
Expand Down Expand Up @@ -82,10 +82,10 @@ function validate(req) {
if (maybeKibanaIndex) return;

// allow json bodies sent to _mget _search and _validate
if (jsonBody && (maybeMGet || maybeSearch || maybeValidate)) return;
if (maybeMGet || maybeSearch || maybeValidate) return;

// allow bulk bodies sent to _msearch
if (bulkBody && (maybeMsearch)) return;
if (maybeMsearch) return;

throw new validate.Fail();
}
Expand Down
2 changes: 2 additions & 0 deletions test/server/unit/lib/validateRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ describe('lib/isValid', function () {
run('HEAD', '/other-index', true);
run('GET', '/_cluster/health', true);
run('POST', '/.kibana/__notRealIndex__/_validate/query?q=foo:bar', true);
run('POST', '/_validate', true);
run('POST', '/_search', true);
});
});

Expand Down