-
Notifications
You must be signed in to change notification settings - Fork 25.1k
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
Support bare IP in ip_range fields #40179
Comments
Pinging @elastic/es-search |
Pinging @elastic/es-core-features |
Related: #38064 |
We discussed this briefly on our FixIt call, and we don't see any downsides to making this change, assuming the IP spec allows single values for ranges (i.e. the CC @jtibshirani for visibility and also @not-napoleon who has been working in this space lately (aggs for range fields) |
I don't think the spec allows for the suffix to be optional. As noted in the original description, many whitelist implementations (including our own within security) allow direct IPs as well as CIDR ranges. One thing to note, though, is that in those cases a single range of ips is not being defined, but a list of allowed whitelists. My main concern would be a user accidentally leaving off the suffix, unknowingly only indexing a single ip within a range instead of an intended range. Perhaps an alternative would be to support a single |
I'll admit there is a risk that users might accidentally leave off the block size in a range, but does that mean it should be required to put a + in front of a positive number so you can be sure that the person didn't leave off a - on a negative number? The bigger threat I see is that someone intends to index a single IP and leaves off the /32 (or /128 for IPv6) and then ignores/misses the error, perhaps in a bulk indexing request. In this case, the data is lost entirely, whereas with an accidental listing of a single IP where a range was intended, the listing for the single IP would still be better than not listing anything. Note, I am not suggesting that ignoring errors is a good idea, but rather that data preservation should take precedence over forcing extra verbosity to prevent users from making mistakes. |
I'm going to mark this for discussion again so that @rjernst has the chance to weigh in. The main question seems to be whether we want to favor flexibility by default, and risk users accidentally indexing single IPs into the range field. |
I personally think this type of mistake is a very low risk as long as we aren't doing very lenient parsing. |
After a followup fix-it-day discussion, we have decided against this proposal. In addition to the already existing ability to pass a single value by using |
Describe the feature:
The ip_range should have a default mask to accept bare IP addresses that are appropriate for the type (
/32
for IPv4 and/128
for IPv6) rather than rejecting the input. Using the example of an ip whitelist (as shown in the docs)should be equally as valid as
They both represent a range starting and ending on a single IPv4 address, and it makes sense to support both formats since a large portion of whitelists/blocklists support both IP and CIDR notation in one file. Presently, an exception is thrown for the bare IP
"Expected [ip/prefix] but was [192.168.0.1]"
.The text was updated successfully, but these errors were encountered: