Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Guard reserved tags field against incorrect use #14822
Guard reserved tags field against incorrect use #14822
Changes from 10 commits
58ac5c0
410c8b9
461a34d
97dce2e
a528472
9cf92f2
8348a04
f89d765
fa1ee92
d37d453
1e1a951
c356d9f
4d7c080
f3ab6ed
9fa7993
94607c0
713923c
909526b
409b634
4e322d1
3ffa3cc
61de3d0
ad4259d
fce4f4a
cd27ed8
b312284
32a7d8b
05ae484
11bf4aa
ff21c0d
5df8219
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of a block-list of one particular bad shape, can we have an allow-list of the supported shapes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure this does what we want, since it renames the field independently of the shape of its value.
It may be worth intercepting
TAGS_FIELD
to be handled by a helper method:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Applied the suggestion. It now handles the illegal tags field first in Event.setField()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I read this as:
tags
In my mind, we need to handle two cases when
ILLEGAL_TAGS_ACTION == IllegalTagsAction.RENAME
:(path == null || path.length == 0) && key.equals(TAGS)
, with a value that is neither a string nor an array of strings (setting top-leveltags
to be an illegal shape)(path != null && path.length > 0 && path[0].equals(TAGS))
regardless of value (setting field nested inside thetags
, which cannot have nested fields in it)Examples that should trigger a rename using the
Event.setField(String, Object)
:event.setField("[tags]", Map.of("poison", "true"))
event.setField("[tags][poison]", "true")
Similarly, using the Ruby APIs
Event#set
:event.set("[tags]", { "poison" => "true"})
event.set("[tags][poison]", "true")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for listing the cases. The PR is changed to handle other illegal types, not limited to map. And
_tags
field holds a list of illegal values.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am wary of making this
public
, since it would allow plugins built with the Java plugin API to route around our field reference caching.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I revert it to private and build the FieldReference from string instead