fix(infra): restrict overly permissive security group ingress#122
Open
hacktron-app-stg[bot] wants to merge 1 commit into
Open
fix(infra): restrict overly permissive security group ingress#122hacktron-app-stg[bot] wants to merge 1 commit into
hacktron-app-stg[bot] wants to merge 1 commit into
Conversation
Scope aws_security_group.open ingress to TCP 443 from the private 10.0.0.0/8 range instead of all ports/protocols from 0.0.0.0/0.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Vulnerability
infra.tfdefined the security groupaws_security_group.openwith an ingress rule permitting all ports (0-65535), all protocols (-1), from any source (0.0.0.0/0). This effectively disables network-level ingress filtering, exposing any associated resources (including SSH and database ports) to the entire public internet.Fix
The ingress rule was tightened to:
from_port/to_port=443(HTTPS only, instead of the full 0-65535 range)protocol=tcp(instead of-1, which matches all protocols)cidr_blocks=["10.0.0.0/8"](private network range, instead of0.0.0.0/0)The resource
namewas also updated fromallow-alltorestricted-ingressto reflect the corrected posture.This is a minimal change limited to the vulnerable
aws_security_group.openblock; the other resources in the file are untouched.Verification
Reviewed the resulting Terraform block — no
0.0.0.0/0, no wildcard protocol, no full port range remains for this security group. No Terraform toolchain is provisioned in the sandbox to runterraform validate, and the repository has no existing test infrastructure for the Terraform config, so no automated test was added.Automated fix by Hacktron for finding: https://staging.hacktron.ai/testestesttest/findings/6251a928-2db2-46bc-b633-d0e81d36b75e