-
Notifications
You must be signed in to change notification settings - Fork 11
feat: add semver gte, lte and cidr matching constraint #115
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,230 @@ | ||
| { | ||
| "name": "22-cidr-constraint-operator", | ||
| "state": { | ||
| "version": 1, | ||
| "features": [ | ||
| { | ||
| "name": "CIDR.exact.match", | ||
| "description": "Exact IP match using IN_CIDR", | ||
| "enabled": true, | ||
| "strategies": [ | ||
| { | ||
| "name": "default", | ||
| "parameters": {}, | ||
| "constraints": [ | ||
| { | ||
| "contextName": "remoteAddress", | ||
| "operator": "IN_CIDR", | ||
| "values": ["127.0.0.1"] | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "name": "CIDR.range.match", | ||
| "description": "CIDR range match using IN_CIDR", | ||
| "enabled": true, | ||
| "strategies": [ | ||
| { | ||
| "name": "default", | ||
| "parameters": {}, | ||
| "constraints": [ | ||
| { | ||
| "contextName": "remoteAddress", | ||
| "operator": "IN_CIDR", | ||
| "values": ["160.33.0.0/16"] | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "name": "CIDR.mixed.values", | ||
| "description": "Invalid values should be ignored when valid ones exist", | ||
| "enabled": true, | ||
| "strategies": [ | ||
| { | ||
| "name": "default", | ||
| "parameters": {}, | ||
| "constraints": [ | ||
| { | ||
| "contextName": "remoteAddress", | ||
| "operator": "IN_CIDR", | ||
| "values": ["127.invalid", "192.168.1.0/24"] | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "name": "CIDR.invalid.only", | ||
| "description": "Only invalid values should not match anything", | ||
| "enabled": true, | ||
| "strategies": [ | ||
| { | ||
| "name": "default", | ||
| "parameters": {}, | ||
| "constraints": [ | ||
| { | ||
| "contextName": "remoteAddress", | ||
| "operator": "IN_CIDR", | ||
| "values": ["127.invalid"] | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "name": "CIDR.ipv6.exact.match", | ||
| "description": "Exact IPv6 match using IN_CIDR", | ||
| "enabled": true, | ||
| "strategies": [ | ||
| { | ||
| "name": "default", | ||
| "parameters": {}, | ||
| "constraints": [ | ||
| { | ||
| "contextName": "remoteAddress", | ||
| "operator": "IN_CIDR", | ||
| "values": ["2001:db8::1"] | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "name": "CIDR.ipv6.range.match", | ||
| "description": "IPv6 CIDR range match using IN_CIDR", | ||
| "enabled": true, | ||
| "strategies": [ | ||
| { | ||
| "name": "default", | ||
| "parameters": {}, | ||
| "constraints": [ | ||
| { | ||
| "contextName": "remoteAddress", | ||
| "operator": "IN_CIDR", | ||
| "values": ["2001:db8::/32"] | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "name": "CIDR.ipv6.mixed.values", | ||
| "description": "Invalid values should be ignored when valid IPv6 CIDR exists", | ||
| "enabled": true, | ||
| "strategies": [ | ||
| { | ||
| "name": "default", | ||
| "parameters": {}, | ||
| "constraints": [ | ||
| { | ||
| "contextName": "remoteAddress", | ||
| "operator": "IN_CIDR", | ||
| "values": ["bad::cidr", "2001:db8::/32"] | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| }, | ||
| "tests": [ | ||
| { | ||
| "description": "Exact IP match should be enabled", | ||
| "context": { | ||
| "remoteAddress": "127.0.0.1" | ||
| }, | ||
| "toggleName": "CIDR.exact.match", | ||
| "expectedResult": true | ||
| }, | ||
| { | ||
| "description": "Exact IP mismatch should be disabled", | ||
| "context": { | ||
| "remoteAddress": "127.0.0.2" | ||
| }, | ||
| "toggleName": "CIDR.exact.match", | ||
| "expectedResult": false | ||
| }, | ||
| { | ||
| "description": "CIDR range should enable matching IP", | ||
| "context": { | ||
| "remoteAddress": "160.33.0.33" | ||
| }, | ||
| "toggleName": "CIDR.range.match", | ||
| "expectedResult": true | ||
| }, | ||
| { | ||
| "description": "CIDR range should disable non-matching IP", | ||
| "context": { | ||
| "remoteAddress": "160.34.0.1" | ||
| }, | ||
| "toggleName": "CIDR.range.match", | ||
| "expectedResult": false | ||
| }, | ||
| { | ||
| "description": "Valid CIDR should match even when invalid entries exist", | ||
| "context": { | ||
| "remoteAddress": "192.168.1.42" | ||
| }, | ||
| "toggleName": "CIDR.mixed.values", | ||
| "expectedResult": true | ||
| }, | ||
| { | ||
| "description": "Invalid-only values should not match", | ||
| "context": { | ||
| "remoteAddress": "127.0.0.1" | ||
| }, | ||
| "toggleName": "CIDR.invalid.only", | ||
| "expectedResult": false | ||
| }, | ||
| { | ||
| "description": "Missing remoteAddress should not match", | ||
| "context": {}, | ||
| "toggleName": "CIDR.range.match", | ||
| "expectedResult": false | ||
| }, | ||
| { | ||
| "description": "Exact IPv6 match should be enabled", | ||
| "context": { | ||
| "remoteAddress": "2001:db8::1" | ||
| }, | ||
| "toggleName": "CIDR.ipv6.exact.match", | ||
| "expectedResult": true | ||
| }, | ||
| { | ||
| "description": "Exact IPv6 mismatch should be disabled", | ||
| "context": { | ||
| "remoteAddress": "2001:db8::2" | ||
| }, | ||
| "toggleName": "CIDR.ipv6.exact.match", | ||
| "expectedResult": false | ||
| }, | ||
| { | ||
| "description": "IPv6 CIDR range should enable matching IP", | ||
| "context": { | ||
| "remoteAddress": "2001:db8:0:1::42" | ||
| }, | ||
| "toggleName": "CIDR.ipv6.range.match", | ||
| "expectedResult": true | ||
| }, | ||
| { | ||
| "description": "IPv6 CIDR range should disable non-matching IP", | ||
| "context": { | ||
| "remoteAddress": "2001:db9::1" | ||
| }, | ||
| "toggleName": "CIDR.ipv6.range.match", | ||
| "expectedResult": false | ||
| }, | ||
| { | ||
| "description": "Valid IPv6 CIDR should match even when invalid entries exist", | ||
| "context": { | ||
| "remoteAddress": "2001:db8::abcd" | ||
| }, | ||
| "toggleName": "CIDR.ipv6.mixed.values", | ||
| "expectedResult": true | ||
| } | ||
| ] | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
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.
this isn't a valid CIDR mask, it is a valid IP address, does that mean our IN_CIDR should be able to parse both?
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.
Answered in standup, so yes. It's a port of the old node IP address strategy adding CIDR support.