-
-
Notifications
You must be signed in to change notification settings - Fork 192
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_group be_opened
matches on nil
#416
Comments
I can confirm the bug:
Now running the related the spec:
I found that there are also other issues with
def describe_security_groups(param)
ec2_client.describe_security_groups(param).security_groups
end
describe security_group('my-security-tag-name') do
its(:outbound) { should be_opened(50_000) }
its(:inbound) { should be_opened(80) }
it { should belong_to_vpc('my-vpc') }
end There is no such label |
Just created the PR #546 to address this issue. @rhysbarrett , could you please give a shot with this PR? @k1LoW , the promoted changes might be incompatible with older specs written by end users. The reason for that is when writing a spec, just checking if port 80 is opened means basically nothing, AFAIK, that's not how a security group is expect to work, unless there is a rule where the protocol is "-1" (everything) and the CIDR is defined as The current implementation will raise an exception if a port number is no given, so this method: def port_opened?(permission, port)
return true unless permission.from_port
return true unless permission.to_port
port_between?(port, permission.from_port, permission.to_port)
end Doesn't make much sense the way is defined right now. Finally, I'm not sure the best place to include this constants: DEFAULT_PROTOCOL = '-1'
DEFAULT_ROUTE = '0.0.0.0/0' Currently they are defined in both |
I suspect this is a rather serious bug, best demonstrated by example:
This test passes when I assume it really shouldn't - bearing in mind the security group I'm testing against has a rule for ports 5001-5003 (verified with a passing test case of
its(:inbound) { should be_opened("5001 - 5003") }
.The implication of this is that malformed configuration files supplying test data to this test will cause the test to pass, regardless of whether it should pass or not.
This is my first Git Issue so I'm sorry if I haven't done this properly or if I've missed something obvious.
The text was updated successfully, but these errors were encountered: