Skip to content

[RecoveryServices] Bypass CodeQL check#29349

Merged
VeryEarly merged 1 commit intomainfrom
VeryEarly-patch-3
Mar 31, 2026
Merged

[RecoveryServices] Bypass CodeQL check#29349
VeryEarly merged 1 commit intomainfrom
VeryEarly-patch-3

Conversation

@VeryEarly
Copy link
Copy Markdown
Collaborator

@VeryEarly VeryEarly commented Mar 31, 2026

Updated ServerCertificateValidationCallback comment to include CodeQL warning and documentation link.

No Changelog.md needed, this is to bypass false positive codeql check.

Description

Mandatory Checklist

  • SHOULD update ChangeLog.md file(s) appropriately
    • Update src/{{SERVICE}}/{{SERVICE}}/ChangeLog.md.
      • A snippet outlining the change(s) made in the PR should be written under the ## Upcoming Release header in the past tense.
    • Should not change ChangeLog.md if no new release is required, such as fixing test case only.
  • SHOULD regenerate markdown help files if there is cmdlet API change. Instruction
  • SHOULD have proper test coverage for changes in pull request.
  • SHOULD NOT adjust version of module manually in pull request

Updated ServerCertificateValidationCallback comment to include CodeQL warning and documentation link.
Copilot AI review requested due to automatic review settings March 31, 2026 06:09
@azure-client-tools-bot-prd
Copy link
Copy Markdown

Thanks for your contribution! The pull request validation has started. Please revisit this comment for updated status.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates an inline comment in the RecoveryServices Backup service client adapter to annotate a CodeQL warning related to ServicePointManager.ServerCertificateValidationCallback, including a documentation link.

Changes:

  • Added a CodeQL warning identifier and Microsoft Learn link to the existing ServerCertificateValidationCallback assignment comment.


// Temp code to be able to test internal env.
ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
ServicePointManager.ServerCertificateValidationCallback = delegate { return true; }; // CodeQL [SM02184] Settings on ServicePointManager no longer affect SslStream or HttpClient: https://learn.microsoft.com/en-us/dotnet/api/system.net.servicepointmanager?view=net-10.0
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

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

ServicePointManager.ServerCertificateValidationCallback = delegate { return true; }; disables TLS certificate validation globally for the process, which is a critical security risk and can affect unrelated network calls in the same PowerShell session. Please gate this behind an explicit internal/test-only switch (e.g., environment variable/config + default off) and avoid a global override (prefer a per-client HttpClientHandler.ServerCertificateCustomValidationCallback when constructing the Microsoft.Rest.ServiceClient).

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@copilot check the justification in comment, this project is using httpclient which will not be affected by the ServicePointManager config

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Confirmed. The clients here are AutoRest.ServiceClient<TClient> instances backed by HttpClient (created via CreateArmClient). Per the .NET docs, ServicePointManager settings no longer affect HttpClient or SslStream in modern .NET, so the CodeQL warning (SM02184) is a false positive in this context. The suppression comment on line 53 already captures this justification.

@VeryEarly VeryEarly enabled auto-merge (squash) March 31, 2026 06:50
@VeryEarly VeryEarly changed the title Bypass CodeQL check [RecoveryServices] Bypass CodeQL check Mar 31, 2026
@VeryEarly VeryEarly disabled auto-merge March 31, 2026 06:50
@VeryEarly VeryEarly enabled auto-merge (squash) March 31, 2026 06:50
@VeryEarly VeryEarly merged commit b0ed80f into main Mar 31, 2026
18 checks passed
@VeryEarly VeryEarly deleted the VeryEarly-patch-3 branch March 31, 2026 07:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants