fix(query): fixed false negative for "App Service Authentication Disabled" query missing resources#7591
Conversation
cx-artur-ribeiro
left a comment
There was a problem hiding this comment.
LGTM, nice work on all the test cases included.
Just left a change on your comment but nothing too important.
…bled/query.rego Co-authored-by: Artur Ribeiro <153724638+cx-artur-ribeiro@users.noreply.github.com>
|
| GitGuardian id | GitGuardian status | Secret | Commit | Filename | |
|---|---|---|---|---|---|
| 4266022 | Triggered | Generic Password | 1602b39 | assets/queries/cloudFormation/aws/amplify_branch_basic_auth_config_password_exposed/test/negative7.yaml | View secret |
| 9419039 | Triggered | Username Password | 1602b39 | 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.
Closes #
Reason for Proposed Changes
App Service Authentication Disabledwas not taking into consideration the resourcesazurerm_linux_web_appandazurerm_windows_web_appnot verifying if the authentication settings for these two resources are enabled.Proposed Changes
azurerm_linux_web_appandazurerm_windows_web_appwith the resourceazurerm_app_serviceI realized that there is another authentication field calledauth_settings_v2that was not present on the last one.azurerm_app_service, and added an extra one that uses a helper function calledprepare_issues, which verifies not only theauth_settingsfield but also theauth_settings_v2field and handles all the cases regarding the new resources that are going to be analyzed in this query for these two fields.auth_settingsfield because, according to the information present on the documentation, this field has equal settings and fields within for all the resources.auth_settings_v2, there is small things that changes in comparison to the fieldauth_settings, more precisely, the fieldauth_settings_v2not being required and set tofalseby default, which should return a positive result, made me deal with it in a slightly different way, returning a positive result on the query when this field is not defined.auth_settingsandauth_settings_v2are not defined, I only inserted theauth_settingsblock on the remediation field and not theauth_settings_v2but this positive case can be solved defining the fieldauth_settings_v2instead of theauth_settingsfield.I submit this contribution under the Apache-2.0 license.