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

Validate op_type for _create #27483

Merged
merged 3 commits into from
Nov 23, 2017
Merged

Validate op_type for _create #27483

merged 3 commits into from
Nov 23, 2017

Conversation

olcbean
Copy link
Contributor

@olcbean olcbean commented Nov 21, 2017

Currently any op_type passed to _create is simply set to create without any validation.

This PR will validate the passed op_type to _create as discussed in comment

CC @javanna

@elasticmachine
Copy link
Collaborator

Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually?

request.params().put("op_type", "create");
return RestIndexAction.this.prepareRequest(request, client);
}

public void validateOpType(String opType) {
if (null != opType && !"create".equals(opType.toLowerCase(Locale.US))) {
Copy link
Contributor

Choose a reason for hiding this comment

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

please use the root locale

Copy link
Contributor

Choose a reason for hiding this comment

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

also please use == false for comparison

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@s1monw I just made the requested changes.

@s1monw
Copy link
Contributor

s1monw commented Nov 21, 2017

@elasticmachine ok to test

Copy link
Contributor

@s1monw s1monw left a comment

Choose a reason for hiding this comment

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

left one suggestion, can you fix that then I will merge it

request.params().put("op_type", "create");
return RestIndexAction.this.prepareRequest(request, client);
}

public void validateOpType(String opType) {
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe make this static and pkg private?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@s1monw what about private (or pkg private) and final?
It cannot be set to static as the inner class CreateHandler itself is not static.

@s1monw s1monw added :Core/Infra/REST API REST infrastructure and utilities >enhancement v7.0.0 labels Nov 23, 2017
@s1monw s1monw merged commit 05998f9 into elastic:master Nov 23, 2017
@s1monw
Copy link
Contributor

s1monw commented Nov 23, 2017

merged thanks

@olcbean olcbean deleted the check_op_type branch November 23, 2017 12:26
martijnvg added a commit that referenced this pull request Nov 24, 2017
* es/master: (38 commits)
  Backport wait_for_initialiazing_shards to cluster health API
  Carry over version map size to prevent excessive resizing (#27516)
  Fix scroll query with a sort that is a prefix of the index sort (#27498)
  Delete shard store files before restoring a snapshot (#27476)
  Replace `delimited_payload_filter` by `delimited_payload` (#26625)
  CURRENT should not be a -SNAPSHOT version if build.snapshot is false (#27512)
  Fix merging of _meta field (#27352)
  Remove unused method (#27508)
  unmuted test, this has been fixed by #27397
  Consolidate version numbering semantics (#27397)
  Add wait_for_no_initializing_shards to cluster health API (#27489)
  [TEST] use routing partition size based on the max routing shards of the second split
  Adjust CombinedDeletionPolicy for multiple commits (#27456)
  Update composite-aggregation.asciidoc
  Deprecate `levenstein` in favor of `levenshtein` (#27409)
  Automatically prepare indices for splitting (#27451)
  Validate `op_type` for `_create` (#27483)
  Minor ShapeBuilder cleanup
  muted test
  Decouple nio constructs from the tcp transport (#27484)
  ...
@jimczi jimczi added v7.0.0-beta1 and removed v7.0.0 labels Feb 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants