-
Notifications
You must be signed in to change notification settings - Fork 150
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 port range example not working #181
Comments
Thanks for the issue. I agree there is a problem there and found out why the tool is failing on this specific scenario. We have to implement I am going to refactor the step and the helper functions that is required for Security Groups checking. |
Just giving an update, we are about to finalise the refactoring of the Security Groups feature that will not only fix this problem but also will be extendable for other scenarios. |
awesome, thanks for the update |
Hi @mjseid , |
this works now if I only have security groups which match the exact cidr and ports listed. It still fails on rules which should not be in scope (different cidr) or rules which have a subset of the allowed ports but not all of the allowed ports. Updated resources and rules below
Results with version 1.1.5
|
Hmm, according to the documents it is following the rules ? Because you are using
exists on a Security Group. Your test on the given example are failing because ;
|
What was your exact expectation ? Just after reading your message, I think I need to implement a similar step to ; Then it must only have tcp protocol and port 53,80,123,443 for 0.0.0.0/0 like Then all must have tcp protocol and port 53,80,123,443 for 0.0.0.0/0 which will be iterated over all values at once, instead of individiuals. |
Yes it does seem to follow the reference you linked based on the I was hoping for a way to look at all my security_group rules and if the CIDR of a rule is 0.0.0.0/0 then the port(s) for that rule must be a subset of the allowed list, not necessarily the full list. Also if the CIDR isn't 0.0.0.0/0 then it should pass. This would support the ability to have many groups verified with a single scenario. For example a group which allows port 22 only to 0.0.0.0/0 and different group which allows port 443 only to 0.0.0.0/0 would be covered by a single step that says |
Hi, You can do it actually, in a way. Instead of Unfortunately, this is not the case if you have 2 security groups, since evaluation is based on the individual security group hence the Given I have AWS Security Group defined IMHO, as I wrote one message above, we may have something like ; Then all must have tcp protocol and port 53,80,123,443 for 0.0.0.0/0 and that or maybe better as a Then it must contain tcp protocol port <port> for <cidr> where it will search that port for those CIDRs and you can also use Let me know your thoughts please ? |
If I use the current The same if I use the I guess my wish list would be the ability to filter more so its only looking at groups with 0.0.0.0/0 rules and then also only requiring at least 1 of the given ports within the superset of ports in the group. Something like:
|
I will create a new step for going over ALL security groups ( not one by one ) ; Then all must only contain tcp protocol and port 53,80,123,443 for 0.0.0.0/0 Where |
Hello, I was just wondering if there is any update on this? We're just doing an initial proof-of-concept of using your project, and are very interested in it, but this specific check (ensuring that only a certain list of port numbers can be open to 0.0.0.0/0) is one of the first things we'd like to do. |
Description :
I am testing the example for "Only selected ports should be publicly open", where the engine checks for only a comma seperated list of ports allowed to a cidr. The rule is incorrectly failing when a rule exists for an allowed 2 digit port, and the rule is failing with an assertion error when a 3 digit port is included in the list of ports.
To Reproduce
1.
default
python package
Scenario: Only selected ports should be publicly open ingress
Given I have AWS Security Group defined
When it contains ingress
Then it must only have tcp protocol and port 53,80 for 0.0.0.0/0
Failure: tcp/53-53 ports are defined for ['0.0.0.0/0'] network. Must be limited to tcp/53,80 and 0.0.0.0/0
Scenario: Only selected ports should be publicly open ingress
Given I have AWS Security Group defined
When it contains ingress
Then it must only have tcp protocol and port 53,80,123,443 for 0.0.0.0/0
AssertionError: Port range is defined incorrectly within the Scenario. Define it 123-80 instead of 80-123.
Expected behavior :
I expect the test to pass b/c the only ports allowed for the cidr are given in the comma seperated allowed list
Tested versions :
The text was updated successfully, but these errors were encountered: