fix(query): fn for security_group_with_unrestricted_access_to_ssh - terraform/aws#7568
Conversation
…_rest_missing_results--terraform/aws
|
| GitGuardian id | GitGuardian status | Secret | Commit | Filename | |
|---|---|---|---|---|---|
| 4266022 | Triggered | Generic Password | 4c4d1e4 | assets/queries/cloudFormation/aws/amplify_app_basic_auth_config_password_exposed/test/negative7.yaml | View secret |
| 9419039 | Triggered | Username Password | 4c4d1e4 | assets/queries/cloudFormation/aws/amplify_branch_basic_auth_config_password_exposed/test/positive5.yaml | View secret |
🛠 Guidelines to remediate hardcoded secrets
- Understand the implications of revoking this secret by investigating where it is used in your code.
- Replace and store your secrets safely. Learn here the best practices.
- Revoke and rotate these secrets.
- If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.
To avoid such incidents in the future consider
- following these best practices for managing and storing secrets including API keys and other credentials
- install secret detection on pre-commit to catch secret before it leaves your machine and ease remediation.
🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.
…_rest_missing_results--terraform/aws
Reason for Proposed Changes
terraform/awsresource/module security groups do not have thessh port (22)exposed on an "Ingress" block associated with that group; that is to say thecidr_blocksof a givenIngresscannot have the reserved IP adress "0.0.0.0/0" while exposing port 22.resourceormoduleblocks of this sort.ipv6_cidr_blockswhich can represent the aforementioned IP address in 3 main ways:Proposed Changes
I implemented correct case handling for arrays of ingress blocks.
To support
ipv6 cidr_blocksome improvements were made to the default terraform library´scheck_cidrpolicy which is essential for theportOpenToInternetpolicy that the query depends on.Finally the number of tests was greatly increased to account for the many use case scenarios. In the current implementation there are 2 variables considered: being a resource/module and having a
cidr_blocksassociated with a single value or 2+ values. Now we have to consider both those variables plusarrays of ingress blocks,ipv6_cidr_blocksandipv6_cidre_blocks + (ipv4)cidr_blocks.Given this the tests have been expanded from 2 negative to 8 and 4 positive to 22. Rundown of test´s purpose:
cidr_blockswith ipv6 for resource and module.cidr_blockswith ipv6 for resource and module with more than 1 ingress.cidr_blockassociated with multiple/single_value(s).ipv6_cidr_blocks(similar to 1 to 4).ipv6_cidr_blocks.cidr_blockssimultaneously for resource and module.Spreadsheat of features tested (combinations):
I submit this contribution under the Apache-2.0 license.