Skip to content

Conversation

@paulmedynski
Copy link
Contributor

@paulmedynski paulmedynski commented Aug 5, 2025

  • Adhere to strict CodeQL suppression format.

@paulmedynski paulmedynski added this to the 7.0-preview1 milestone Aug 5, 2025
@Copilot Copilot AI review requested due to automatic review settings August 5, 2025 14:54
@paulmedynski paulmedynski requested a review from a team as a code owner August 5, 2025 14:54
Copy link
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

This PR adds a CodeQL suppression comment to address a security analysis warning about DefaultAzureCredential instantiation in production code. The change restructures the comment placement to comply with CodeQL's requirement that suppression comments appear on the same line as the flagged code.

  • Moved CodeQL suppression comment to the same line as the DefaultAzureCredential instantiation
  • Added explanatory documentation about CodeQL suppression placement requirements
  • Split the credential instantiation and return statement for better code organization
Comments suppressed due to low confidence (1)

src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/ActiveDirectoryAuthenticationProvider.cs:599

  • The variable name 'cred' is too abbreviated and unclear. Consider using a more descriptive name like 'credential' or 'azureCredential' to improve code readability.
                DefaultAzureCredential cred = new(defaultAzureCredentialOptions); // CodeQL [SM05137] See above for justification.

- Adjusted CodeQL suppression to meet the strict requirements of where it may appear relative to the flagged code.
- Adding catch for macOS socket error to log and ignore.
@codecov
Copy link

codecov bot commented Aug 6, 2025

Codecov Report

❌ Patch coverage is 28.57143% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 64.58%. Comparing base (18becfe) to head (40359b1).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
.../Data/SqlClient/ManagedSni/SniTcpHandle.netcore.cs 16.66% 10 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3542      +/-   ##
==========================================
+ Coverage   60.32%   64.58%   +4.25%     
==========================================
  Files         270      270              
  Lines       62098    62110      +12     
==========================================
+ Hits        37463    40113    +2650     
+ Misses      24635    21997    -2638     
Flag Coverage Δ
netcore 67.85% <28.57%> (+5.70%) ⬆️
netfx 64.47% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@cheenamalhotra
Copy link
Member

This will be back-ported to release branches as well?

@paulmedynski
Copy link
Contributor Author

Yes, we can backport for the ReceiveTimeout change. The CodeQL part is benign on non-default branches AFAIK.

@paulmedynski paulmedynski merged commit 55cc333 into main Aug 7, 2025
237 checks passed
@paulmedynski paulmedynski deleted the dev/paul/codeql branch August 7, 2025 18:18
paulmedynski added a commit that referenced this pull request Aug 8, 2025
…3542)

* Task 37261: [S360] [SM05137] DefaultAzureCredential use in Production

- Adjusted CodeQL suppression to meet the strict requirements of where it may appear relative to the flagged code.

* Task 37261: [S360] [SM05137] DefaultAzureCredential use in Production

- Adding catch for macOS socket error to log and ignore.
paulmedynski added a commit that referenced this pull request Aug 8, 2025
…3542)

* Task 37261: [S360] [SM05137] DefaultAzureCredential use in Production

- Adjusted CodeQL suppression to meet the strict requirements of where it may appear relative to the flagged code.

* Task 37261: [S360] [SM05137] DefaultAzureCredential use in Production

- Adding catch for macOS socket error to log and ignore.
cheenamalhotra pushed a commit that referenced this pull request Aug 11, 2025
…3542) (#3550)

* Task 37261: [S360] [SM05137] DefaultAzureCredential use in Production

- Adjusted CodeQL suppression to meet the strict requirements of where it may appear relative to the flagged code.

* Task 37261: [S360] [SM05137] DefaultAzureCredential use in Production

- Adding catch for macOS socket error to log and ignore.
cheenamalhotra pushed a commit that referenced this pull request Aug 12, 2025
… CI failures (#3551)

* Add CodeQL suppression for DefaultAzureCredential use in Production (#3542)

* Task 37261: [S360] [SM05137] DefaultAzureCredential use in Production

- Adjusted CodeQL suppression to meet the strict requirements of where it may appear relative to the flagged code.

* Task 37261: [S360] [SM05137] DefaultAzureCredential use in Production

- Adding catch for macOS socket error to log and ignore.

* Fixed SniTcpHandle -> SNITCPHandle class case difference.
paulmedynski added a commit that referenced this pull request Sep 8, 2025
…3542)

  - Adjusted CodeQL suppression to meet the strict requirements of where it may appear relative to the flagged code.
  - Adding catch for macOS socket error to log and ignore.
paulmedynski added a commit that referenced this pull request Sep 8, 2025
…3542)

  - Adjusted CodeQL suppression to meet the strict requirements of where it may appear relative to the flagged code.
  - Adding catch for macOS socket error to log and ignore.
mdaigle added a commit that referenced this pull request Oct 8, 2025
* User Story 38467: Backport mac server name fix

- Backported part of #3494 and #3591:
  - Added configurable test jobs timeout, defaulting to 90 minutes.
  - Reduced generated database names to 96 chars to try to fix macOS test failures.

* User Story 38481: Fix unique db object name issues

- Fixed the unique name generators to:
  - Keep max lengths to 30 and 96 characters respectively.
  - Ensure uniqueness at the start of the names.
  - Added link to database identifier syntax.

* User Story 38481: Fix unique db object name issues

- Removed DateOnly tests that aren't supported on 5.1.

* Add CodeQL suppression for DefaultAzureCredential use in Production (#3542)
  - Adjusted CodeQL suppression to meet the strict requirements of where it may appear relative to the flagged code.
  - Adding catch for macOS socket error to log and ignore.

* - Added back some blocks that were removed by cherry-picks.
- Added console diagnostics to see when Enclave tables are dropped.

* - Fixed typo in code that only gets compiled when building on Windows (eek!)

* Tests | Remove hardcoded credentials from ManualTests (#3204)

* Initial removal of CertificateUtility.CreateCertificate

One test implied that DataTestUtility.AKVUrl would point to an RSA key which aligned with the certificate's private key. Switching this to dynamically generate the key in places.

* Hotfix for Azure Key Vault tests

* Removed hardcoded references to Azure Key Vault key

* Removed hardcoded references to CertificateUtilityWin

These were mostly related to generating CSP keys.

* Code review changes

* Reorder properties and constructors
* Move AEConnectionStringProviderWithCspParameters to its own file
* Tweak to the AKV token acquisition

* Code review

Redundant bracket, alphabetised the ManualTesting csproj

* Update src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/TestFixtures/SQLSetupStrategy.cs

Let's try @edwardneal's idea

Co-authored-by: Edward Neal <55035479+edwardneal@users.noreply.github.com>

* Update src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/TestFixtures/SQLSetupStrategy.cs

Co-authored-by: Edward Neal <55035479+edwardneal@users.noreply.github.com>

* Fixes as per @edwardneal's suggestions

* Fix as per @edwardneal's suggestion

* Fix missing `new`

Co-authored-by: Edward Neal <55035479+edwardneal@users.noreply.github.com>

* Update src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/TestFixtures/SQLSetupStrategyAzureKeyVault.cs

Co-authored-by: Edward Neal <55035479+edwardneal@users.noreply.github.com>

* Update src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/TestFixtures/SQLSetupStrategyAzureKeyVault.cs

Co-authored-by: Edward Neal <55035479+edwardneal@users.noreply.github.com>

* Address comment that we don't need a CspParameters object as part of the test arguments
* Move test arguments into property (the class was only used in a single location)
* Cleanup test code
* Tweak default provider discovery code to handle edge cases a bit better

* Address comment regarding readonly member variables
Apply long line chomping

* Addressing the last of the comments.

---------

Co-authored-by: Edward Neal <55035479+edwardneal@users.noreply.github.com>

* Update test utilities target frameworks. Fix compilation issues.

* Construct valid X500 distinguished name.

* Print rsa key type for debugging.

* Clean up net version ifdefs to fix certificate exportability.

---------

Co-authored-by: Benjamin Russell <russellben@microsoft.com>
Co-authored-by: Edward Neal <55035479+edwardneal@users.noreply.github.com>
Co-authored-by: Malcolm Daigle <mdaigle@microsoft.com>
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