Skip to content
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
5 changes: 5 additions & 0 deletions docs/changelog/130427.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pr: 130427
summary: Disallow brackets in unquoted index pattersn
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo

area: ES|QL
type: bug
issues: []
7 changes: 6 additions & 1 deletion x-pack/plugin/esql/src/main/antlr/EsqlBaseParser.g4
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,12 @@ showCommand
;

enrichCommand
: ENRICH policyName=ENRICH_POLICY_NAME (ON matchField=qualifiedNamePattern)? (WITH enrichWithClause (COMMA enrichWithClause)*)?
: ENRICH policyName=enrichPolicyName (ON matchField=qualifiedNamePattern)? (WITH enrichWithClause (COMMA enrichWithClause)*)?
;

enrichPolicyName
: ENRICH_POLICY_NAME
| QUOTED_STRING
;

enrichWithClause
Expand Down
4 changes: 3 additions & 1 deletion x-pack/plugin/esql/src/main/antlr/lexer/Enrich.g4
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ ENRICH_WITH : WITH -> type(WITH), pushMode(ENRICH_FIELD_MODE);
// similar to that of an index
// see https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-create-index.html#indices-create-api-path-params
fragment ENRICH_POLICY_NAME_BODY
: ~[\\/?"<>| ,#\t\r\n:]
: ~[\\/?"<>| ,#\t\r\n:()]
;

ENRICH_POLICY_NAME
Expand All @@ -36,6 +36,8 @@ ENRICH_MODE_UNQUOTED_VALUE
: ENRICH_POLICY_NAME -> type(ENRICH_POLICY_NAME)
;

ENRICH_QUOTED_POLICY_NAME : QUOTED_STRING -> type(QUOTED_STRING);

ENRICH_LINE_COMMENT
: LINE_COMMENT -> channel(HIDDEN)
;
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugin/esql/src/main/antlr/lexer/From.g4
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ FROM_RP : RP -> type(RP), popMode;
// in 8.14 ` were not allowed
// this has been relaxed in 8.15 since " is used for quoting
fragment UNQUOTED_SOURCE_PART
: ~[:"=|,[\]/ \t\r\n]
: ~[:"=|,[\]/() \t\r\n]
| '/' ~[*/] // allow single / but not followed by another / or * which would start a comment -- used in index pattern date spec
;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1228,7 +1228,13 @@ public enum Cap {
/**
* Support avg with aggregate metric doubles
*/
AGGREGATE_METRIC_DOUBLE_AVG(AGGREGATE_METRIC_DOUBLE_FEATURE_FLAG);
AGGREGATE_METRIC_DOUBLE_AVG(AGGREGATE_METRIC_DOUBLE_FEATURE_FLAG),

/**
* Forbid usage of brackets in unquoted index and enrich policy names
* https://github.com/elastic/elasticsearch/issues/130378
*/
NO_BRACKETS_IN_UNQUOTED_INDEX_NAMES;

private final boolean enabled;

Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Loading
Loading