Skip to content

Conversation

@cx-ricardo-jesus
Copy link
Contributor

@cx-ricardo-jesus cx-ricardo-jesus commented Jul 11, 2025

Reason for Proposed Changes

  • The query Website with Client Certificate Auth Disabled (ARM), currently return's a positive result however, it should not return this positive result if the application is using the HTTP/2 protocol(field siteConfig.http20Enabled set to true).
  • I also found a query on the Terraform Platform that verifies if the Azure App Service has the client certificate enabled called Azure App Service Client Certificate Disabled, which is analog to the query that I mentioned on the first point and also return's a vulnerability when the client certificate is enabled but does not recognize the http2_enabled field (if this field is set to true it should not return the vulnerability).

Proposed Changes

  • In order to fix this bug, is added an extra verification on both policies (not is_using_http2_protocol) that verifies if the resource has the HTTP/2 protocol set on true.
  • This is_using_http2_protocol auxiliar function that i created in order to do the verification, only checks, inside the properties of the resources, if they have a field called http20Enabled set to true and, if it that is the case it returns true.
  • On the policies, if the auxiliar function that i described above, return's a false result (if does not have a http20Enabled field set to true), it produces a positive result.
  • I also added two extra negative tests. The first one called negative3.bicep, has the field clientCertEnabled set to false which now, after the changes that i made should not return a vulnerability because it has also the http20Enabled field set to true.
  • The other negative test, called negative4.bicep, also has the field http20Enabled set to true but, in this case, it does not have the property clientCertEnabled defined but, because is using the HTTP/2 protocol does not return a vulnerability.
  • On the Azure App Service Client Certificate Disabled query I only added two extra verification's to both first two policies that, check's if the HTTP/2 protocol is enabled and other verification using the http2_defined_to_false helper function which is only used to verify if the http2_enabled field is defined and set to false, useful to return a different result on the keyExpectedValue and keyExpectedValue result fields when the fields client_cert_enabled and http2_enabled are both defined and set to true on the third new policy.
  • I also added 2 negative tests on this last query, with the HTTP/2 protocol enabled and with the client_cert_enabled set to false and the other negative test is with the client_cert_enabled field not defined and the HTTP/2 protocol enabled.
  • Added one extra positive text with the client_cert_enabled and http2_enabled field both defined and set to false.

I submit this contribution under the Apache-2.0 license.

@cx-ricardo-jesus cx-ricardo-jesus requested a review from a team as a code owner July 11, 2025 13:22
@github-actions github-actions bot added community Community contribution bug Something isn't working query New query feature arm Azure Resource Manager query labels Jul 11, 2025
@cx-ricardo-jesus cx-ricardo-jesus changed the title fix(query): fixed false positive when the application is using the HTTP/2 protocol fix(query): fixed false positive for Website with Client Certificate Auth Disabled (ARM) Jul 14, 2025
@cx-ricardo-jesus cx-ricardo-jesus changed the title fix(query): fixed false positive for Website with Client Certificate Auth Disabled (ARM) fix(query): fixed false positive for website with client certificate auth disabled Jul 14, 2025
Copy link
Contributor

@cx-eduardo-semanas cx-eduardo-semanas 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-ricardo-jesus cx-ricardo-jesus marked this pull request as draft July 18, 2025 13:21
@github-actions github-actions bot added terraform Terraform query azure PR related with Azure Cloud labels Jul 21, 2025
@cx-ricardo-jesus cx-ricardo-jesus marked this pull request as ready for review July 21, 2025 11:37
@cx-ricardo-jesus cx-ricardo-jesus changed the title fix(query): fixed false positive for website with client certificate auth disabled fix(query): fixed false positive for website with client certificate auth disabled and azure app service client certificate disabled Jul 21, 2025
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

Copy link
Contributor

@cx-eduardo-semanas cx-eduardo-semanas 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-ricardo-jesus cx-ricardo-jesus merged commit 28803b3 into Checkmarx:master Jul 30, 2025
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arm Azure Resource Manager query azure PR related with Azure Cloud bug Something isn't working community Community contribution query New query feature terraform Terraform query

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants