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

Disallow introducing illegal object mappings (double '..') #22891

Merged
merged 1 commit into from Feb 1, 2017

Conversation

Projects
None yet
2 participants
@dakrone
Copy link
Member

commented Jan 31, 2017

This disallows object mappings that would accidentally create something like
foo..bar, which is then unparsable for the bar field as it does not know
what its parent is.

Resolves #22794

@jpountz
Copy link
Contributor

left a comment

LGTM

core/src/main/java/org/elasticsearch/index/mapper/DocumentParser.java Outdated
+ fullFieldPath + "]");
}
return fullFieldPath.split("\\.");
}

This comment has been minimized.

Copy link
@jpountz

jpountz Jan 31, 2017

Contributor

what about splitting first and then checking whether the array contains an empty string? I think that would also cover two other cases we are interested in validating: leading dots and trailing dots? (just thinking out loud)

core/src/main/java/org/elasticsearch/index/mapper/DocumentParser.java Outdated
@@ -172,6 +172,14 @@ private static MapperParsingException wrapInMapperParsingException(SourceToParse
return new MapperParsingException("failed to parse", e);
}

public static String[] splitAndValidatePath(String fullFieldPath) {

This comment has been minimized.

Copy link
@jpountz

jpountz Jan 31, 2017

Contributor

can you reduce the visibility of this method?

@dakrone

This comment has been minimized.

Copy link
Member Author

commented Jan 31, 2017

Thanks @jpountz, I pushed a commit that addresses your feedback!

@jpountz
Copy link
Contributor

left a comment

LGTM

@dakrone dakrone force-pushed the dakrone:disallow-double-dot branch Jan 31, 2017

@dakrone

This comment has been minimized.

Copy link
Member Author

commented Feb 1, 2017

retest this please

Disallow introducing illegal object mappings (double '..')
This disallows object mappings that would accidentally create something like
`foo..bar`, which is then unparsable for the `bar` field as it does not know
what its parent is.

Resolves #22794

@dakrone dakrone force-pushed the dakrone:disallow-double-dot branch to 8d83edc Feb 1, 2017

@dakrone dakrone merged commit 8d83edc into elastic:master Feb 1, 2017

1 of 2 checks passed

elasticsearch-ci Build started sha1 is merged.
Details
CLA Commit author has signed the CLA
Details

@dakrone dakrone added the v5.1.3 label Feb 1, 2017

@dakrone dakrone deleted the dakrone:disallow-double-dot branch May 24, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.