-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/master' into lens/error-telemetry
- Loading branch information
Showing
87 changed files
with
819 additions
and
350 deletions.
There are no files selected for viewing
This file contains 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
43 changes: 43 additions & 0 deletions
43
src/core/server/saved_objects/service/lib/aggregations/aggs_types/schemas.test.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import { bucketAggsSchemas } from './bucket_aggs'; | ||
|
||
describe('bucket aggregation schemas', () => { | ||
describe('terms aggregation schema', () => { | ||
const schema = bucketAggsSchemas.terms; | ||
|
||
it('passes validation when using `1` for `min_doc_count`', () => { | ||
expect(() => schema.validate({ min_doc_count: 1 })).not.toThrow(); | ||
}); | ||
|
||
// see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-terms-aggregation.html#_minimum_document_count_4 | ||
// Setting min_doc_count=0 will also return buckets for terms that didn’t match any hit, | ||
// bypassing any filtering perform via `filter` or `query` | ||
// causing a potential security issue as we can return values from other spaces. | ||
it('throws an error when using `0` for `min_doc_count`', () => { | ||
expect(() => schema.validate({ min_doc_count: 0 })).toThrowErrorMatchingInlineSnapshot( | ||
`"[min_doc_count]: Value must be equal to or greater than [1]."` | ||
); | ||
}); | ||
}); | ||
|
||
describe('histogram aggregation schema', () => { | ||
const schema = bucketAggsSchemas.histogram; | ||
|
||
it('passes validation when using `1` for `min_doc_count`', () => { | ||
expect(() => schema.validate({ min_doc_count: 1 })).not.toThrow(); | ||
}); | ||
|
||
it('throws an error when using `0` for `min_doc_count`', () => { | ||
expect(() => schema.validate({ min_doc_count: 0 })).toThrowErrorMatchingInlineSnapshot( | ||
`"[min_doc_count]: Value must be equal to or greater than [1]."` | ||
); | ||
}); | ||
}); | ||
}); |
20 changes: 20 additions & 0 deletions
20
.../plugins/enterprise_search/public/applications/shared/schema/schema_errors_accordion.scss
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
.schemaFieldError { | ||
border-top: 1px solid $euiColorLightShade; | ||
|
||
&:last-child { | ||
border-bottom: 1px solid $euiColorLightShade; | ||
} | ||
|
||
// Something about the EuiFlexGroup being inside a button collapses the row of items. | ||
// This wrapper div was injected by EUI and had 'with: auto' on it. | ||
.euiIEFlexWrapFix { | ||
width: 100%; | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.