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

net.cidr_contains evaluates incorrectly #1303

Closed
istalker2 opened this issue Mar 31, 2019 · 0 comments
Closed

net.cidr_contains evaluates incorrectly #1303

istalker2 opened this issue Mar 31, 2019 · 0 comments

Comments

@istalker2
Copy link
Contributor

Expression:

test = [
   net.cidr_contains("172.17.0.0/8", "172.17.0.0/16"), 
   net.cidr_contains("172.17.0.0/24", "172.17.0.0/16")
]

Expected result:

{"test": [true, false]}

Actual result:

{"test": [true, true]}
patrick-east added a commit to patrick-east/opa that referenced this issue Mar 31, 2019
The calculation for the last ip of a block had a typo switching the buffer
we created the last ip address from.. This meant we always returned the
first IP address in the range as the last one.

There was also a gap in the unit tests for these cases. Both are corrected
with this patch.

Fixes: open-policy-agent#1303
Signed-off-by: Patrick East <east.patrick@gmail.com>
tsandall pushed a commit that referenced this issue Apr 1, 2019
The calculation for the last ip of a block had a typo switching the buffer
we created the last ip address from.. This meant we always returned the
first IP address in the range as the last one.

There was also a gap in the unit tests for these cases. Both are corrected
with this patch.

Fixes: #1303
Signed-off-by: Patrick East <east.patrick@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant