-
Notifications
You must be signed in to change notification settings - Fork 347
fix(query): adding support for CloudFormation queries missing ingress/egress resources - Part 2 #7755
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
Open
cx-andre-pereira
wants to merge
24
commits into
master
Choose a base branch
from
AST-115332-FN-For-cloudformation-ingress_egress_queries_2
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
fix(query): adding support for CloudFormation queries missing ingress/egress resources - Part 2 #7755
cx-andre-pereira
wants to merge
24
commits into
master
from
AST-115332-FN-For-cloudformation-ingress_egress_queries_2
Conversation
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
…ows_unrestricted_outbound_traffic
…exhibited_admin_ports
…thout_description
…ort_open and remote_desktop_port_open_to_internet plus logic change, security_group_egress_cidr_open_to_world/security_group_egress_with_port_range/security_group_rule_without_description fix, removed some temporary comments
…to_internet added
…_2' of https://github.com/Checkmarx/kics into AST-115332-FN-For-cloudformation-ingress_egress_queries_2
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
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.
Reason for Proposed Changes
Part 1 | Part 3
Currently some CloudFormation queries do not support the newer "AWS::EC2::SecurityGroupIngress" and "AWS::EC2::SecurityGroupEgress" resources, only working for samples with the legacy "AWS::EC2::SecurityGroup" resource.
This Pull Request will handle queries 6-10.
Query List
Proposed Changes
✅HTTP Port Open To Internet and ✅Remote Desktop Port Open To Internet
✅Security Groups Allows Unrestricted Outbound Traffic
IpProtocol
is set to "-1" instead of the "ALL" value; form my research this simply did not happen on valid configurations, even legacy aws versions that informally supported "all" did not support a caps locked version of it like the current implementation of this query does.❌Security Group Unrestricted Access To RDP
✅Security Groups With Exposed Admin Ports
(EXTRA)✅Fully Open Ingress
(EXTRA)✅Security Group Egress With All Protocols and ✅Security Group Ingress With All Protocols
IpProtocol
field is set to-1
, instead of the string value"-1"
, this is incorrect since , although numeric values can be used they must be written as strings. Numeric values could be interpreted as intended but by writing them as strings we can be sure that is the case and choosing between supporting only numeric values as the query does current or the intended string values is a simple choice; the case could be made to support both types allowing -1 and "-1" (in this case).(EXTRA)✅Security Group Egress With Port Range and ✅Security Group Egress CIDR Open To World
(EXTRA)✅Security Group Rule Without Description
On 0735b11 aside from some fixes and slight test changes for some queries I updated the "positive.yaml" sample from the
e2e/fixtures/samples
folder, the fact of the matter is i could not find a single source to support having a "fromPort" with a value lower that the "toPort", and the current file does so in 2 of the 3 from/to port ranges it defines. I did find 2 sources explicitly stating that this behavior is impossible for a valid range :FromPort The lower limit of the port range. This must be less than or equal to the ToPort specification." and "ToPort The upper limit of the port range. This must be greater than or equal to the FromPort specification.
"FromPort (integer) -- [REQUIRED] The lower limit of the port range. This must be less than or equal to the ToPort specification." and "FromPort (integer) -- [REQUIRED] The lower limit of the port range. This must be less than or equal to the ToPort specification.
"These refer to the same fields on different resources but there is no reason to believe it works differently in the given context.
I submit this contribution under the Apache-2.0 license.