Skip to content

Conversation

@cx-andre-pereira
Copy link
Contributor

@cx-andre-pereira cx-andre-pereira commented Sep 26, 2025

Reason for Proposed Changes

Query Name ID Implementation (KICS 2.1.14)
App Service Not Using Latest TLS Encryption Version b7b9d1c7-2d3b-49b4-b867-ebbe68d0b643 query 1
App Service Managed Identity Disabled b61cce4b-0cc4-472b-8096-15617a6d769b query 2
Web App Accepting Traffic Other Than HTTPS 11e9a948-c6c3-4a0f-8dcf-b5cf1763cdbe query 3
Azure App Service Client Certificate Disabled a81573f9-3691-4d83-88a0-7d4af63e17a3 query 4
  • Additionally the queries related to the "azurerm_function_app" resource face a near identical issue that will be fixed through a separate Pull Request.

Proposed Changes

  • App Service Not Using Latest TLS Encryption Version

    • For this query some issues beside the lack of resource support stood out. Recently this query was updated to check for tls version 1.3, unfortunately this check was made on the legacy azurerm_app_service resource that does not support this tls version, it can only handle up to version 1.2 as per the documentation.
    • The query's logic itself was redundant since the 2 CxPolicys currently in place can be merged into 1 very easily and so i did.
    • The verification for the newer resources was made with an extra CxPolicy due to 2 reasons, firstly the "min_tls_version" field is now named "minimum_tls_version" and the tls version support for it is actually 1.3 changing the check that must be done; secondly since the default value for missing the "min/minimum_tls_version" field(s) for all resources is 1.2, the newer resources should, in contrast with the legacy counterpart, flag in case the field is undefined. (doc1 / doc2 /doc3 stating the defaulting to 1.2)
  • App Service Managed Identity Disabled

    • This query's fix was much more streamlined than the latter, it was as easy as replacing the "azurerm_app_service" with the list of valid "types" with all 3 possible resources and adding new tests analog to the current ones for the new additions.
  • Web App Accepting Traffic Other Than HTTPS

    • The query did not require any major changes all i did was update it to account for all resources. Additionally i simplified the tests and added analogs for the two new resources.
  • Azure App Service Client Certificate Disabled

    • For this query from the start the implementation was extremely messy, the auxiliary function are used in redundant ways in the current implementation, furthermore these auxiliary functions are not necessary in the first place. I have removed them and incorporated a more thoughtful logic together with some comments.
    • Lines 32/33 it is easy to see that there is no scenarios where both auxiliary functions will flag as false unless the "http2_enabled" is undefined. (one functions checks for == true and the other for == false); on lines 57/58 first it is checked that "http2_enabled" is set to false and then that it is not set to true, which is clearly unnecessary.

I submit this contribution under the Apache-2.0 license.

@github-actions github-actions bot added query New query feature terraform Terraform query azure PR related with Azure Cloud labels Sep 26, 2025
@github-actions
Copy link
Contributor

kics-logo

KICS version: v2.1.13

Category Results
CRITICAL CRITICAL 0
HIGH HIGH 0
MEDIUM MEDIUM 0
LOW LOW 0
INFO INFO 0
TRACE TRACE 0
TOTAL TOTAL 0
Metric Values
Files scanned placeholder 1
Files parsed placeholder 1
Files failed to scan placeholder 0
Total executed queries placeholder 47
Queries failed to execute placeholder 0
Execution time placeholder 0

@cx-andre-pereira cx-andre-pereira marked this pull request as ready for review September 29, 2025 10:43
@cx-andre-pereira cx-andre-pereira requested a review from a team as a code owner September 29, 2025 10:43
Copy link
Contributor

@cx-artur-ribeiro cx-artur-ribeiro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey André, just found a typo but besides that, all good to me 😄

Copy link
Contributor

@cx-artur-ribeiro cx-artur-ribeiro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@cx-andre-pereira cx-andre-pereira merged commit 457d358 into master Oct 8, 2025
26 checks passed
@cx-andre-pereira cx-andre-pereira deleted the AST-114931-FN-Missing_resources_for_terraform_azure_queries branch October 8, 2025 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

azure PR related with Azure Cloud query New query feature terraform Terraform query

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants