-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Security Solution] Validate ipv4/CIDR with format x.x.x.x/xx #116127
[Security Solution] Validate ipv4/CIDR with format x.x.x.x/xx #116127
Conversation
return true; | ||
} catch (e) { | ||
return ipaddr.IPv4.isValid(maybeIp); | ||
const ipv4re = /^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$/; |
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.
regex explanation https://regex101.com/r/UaqhDn/
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.
Correct me if I'm wrong, but this regex is going to validate an ip like this as true:
33.333.33.3
And this is wrong since 333 > 255. Is this going to be validated by the IPv4 as false?
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.
yes. the regex is merely here to perform the basics format validation, the the actual validation will be done with ipaddr which has a full logic inside to handle all possible cases.
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.
got it! Thanks! 👍
Pinging @elastic/security-onboarding-and-lifecycle-mgt (Team:Onboarding and Lifecycle Mgt) |
💚 Build Succeeded
Metrics [docs]Async chunks
To update your PR or re-run it, just comment with: |
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.
LGTM! 🐑 it
💚 Backport successful
This backport PR will be merged automatically after passing CI. |
… (#116254) Co-authored-by: Esteban Beltran <academo@users.noreply.github.com>
…-migrate-away-from-injected-css-js * 'master' of github.com:elastic/kibana: (347 commits) [Upgrade Assistant] Disable UI by default in 8.0 (elastic#115782) [Uptime] Added permission for new tls alert (elastic#116107) [APM] Optimize synthtrace (elastic#116091) Fix ux/apm inspector panel (elastic#116188) [RAC]: add experimental badge to alerts (elastic#116090) Unskip jest handled promise rejections (elastic#116021) [Lens] Improve tick placement for binary formatter (elastic#116158) chore: rename getApmHref to getLegacyApmHref (elastic#115689) [Security Solution] Validate ipv4/CIDR with format x.x.x.x/xx (elastic#116127) [Fleet] Use data stream name in query to get data stream info (elastic#115805) [Uptime] TLS and TLS legacy alert translation mismatch (elastic#116113) New field for integrations field (elastic#116175) Set required to false until the input is not visited (elastic#116099) Enable interactive setup by default (elastic#116141) Add not ready response to interactive setup (elastic#116138) Hide or button if needed (elastic#116124) [ML] Adding datafeed api tests (elastic#116133) Add page title to index advanced page (elastic#116134) chore: rename functions in aggregated_transactions helper (elastic#116001) Fix bug where number rendered as date (elastic#116224) ... # Conflicts: # x-pack/plugins/reporting/server/lib/screenshots/observable.ts # x-pack/plugins/reporting/server/lib/screenshots/open_url.ts
Summary
Adds an additional regex validation for IPV4 values on top of the ipadrs library to only accept IPV4 formated like
x.x.x.x/xx
orx.x.x.x
Closes #116084 #116114 and #116082
Checklist