Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change | Remove some unneeded references and update Azure.Identity #2577

Merged
merged 2 commits into from
Jun 26, 2024

Conversation

ErikEJ
Copy link
Contributor

@ErikEJ ErikEJ commented Jun 17, 2024

fixes #2048
fixes #2574
fixes #2568

removes explicit ref to Microsoft.Identity.Client

fixes dotnet#2048

removes explicit ref to Microsoft.Identity.Client
@ErikEJ
Copy link
Contributor Author

ErikEJ commented Jun 17, 2024

@JRahnama FYI

@ErikEJ ErikEJ changed the title Remove some unneeded references Remove some unneeded references and update Azure.Identity Jun 17, 2024
@JRahnama JRahnama changed the title Remove some unneeded references and update Azure.Identity Change | Remove some unneeded references and update Azure.Identity Jun 17, 2024
@JRahnama JRahnama added this to the 6.0-preview1 milestone Jun 17, 2024
@JRahnama JRahnama added the 💡 Enhancement New feature request label Jun 17, 2024
Copy link
Contributor

@David-Engel David-Engel left a comment

Choose a reason for hiding this comment

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

  1. Why the removal of the reference to Microsoft.Extensions.Caching.Memory?
  2. We should keep the reference to Microsoft.Identity.Client as we have a direct reference to it in the ActiveDirectoryAuthenticationProvider..
  3. I'm fine with the reference change to Azure.Identity in the test projects.

@ErikEJ
Copy link
Contributor Author

ErikEJ commented Jun 18, 2024

@David-Engel

re 1: Does not seem to be needed in the Ref projects !?

re 2: Azure.Identity references Microsoft.Identity.Client, so you do not need the explicit reference

Copy link

codecov bot commented Jun 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 72.56%. Comparing base (55f48c5) to head (cf29a2a).

Current head cf29a2a differs from pull request most recent head 91030e5

Please upload reports for the commit 91030e5 to get more accurate results.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2577      +/-   ##
==========================================
- Coverage   72.58%   72.56%   -0.03%     
==========================================
  Files         310      310              
  Lines       61688    61688              
==========================================
- Hits        44779    44765      -14     
- Misses      16909    16923      +14     
Flag Coverage Δ
addons 92.88% <ø> (ø)
netcore 76.45% <ø> (+0.01%) ⬆️
netfx 70.44% <ø> (-0.05%) ⬇️

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.

@David-Engel
Copy link
Contributor

re 2: Azure.Identity references Microsoft.Identity.Client, so you do not need the explicit reference

I realize we have an indirect reference through Azure.Identity (AI). But that seems conceptually wrong when we directly reference Microsoft.Identity.Client (MIC) in the code. The way you are proposing makes if feel like we are saying that consumers of MDS only need MIC because AI needs MIC. I've always favored defining direct dependencies explicitly, but I couldn't find much in the way of documented "best practice" here. My preference isn't a strong one since it works fine either way. I admit, it's cleaner your proposed way.

@ErikEJ
Copy link
Contributor Author

ErikEJ commented Jun 19, 2024

I admit, it's cleaner your proposed way.

Thanks! Also, even if MDS wants to reference a specific version of MIC, the version that AI uses will always win if it is newer, and if MIC version is newer than the one used by AI, you might put yourself in an unsupported scenario.

@cheenamalhotra
Copy link
Member

cheenamalhotra commented Jun 26, 2024

I would be ok with removing MIC since we'll never remove AI blindly without considering adding MIC again if it's removed (as we won't be able to compile anyways). In Java world, adding dependencies explicitly for APIs used is required, but that doesn't seem to be in .NET.

@JRahnama JRahnama merged commit f91dc82 into dotnet:main Jun 26, 2024
145 of 148 checks passed
@Ruud-cb
Copy link

Ruud-cb commented Jul 22, 2024

There is a vulnerability detected in [email protected], any chance this will also be patched in Microsoft.Data.SqlClient/5.1.x?

                    "VulnerabilityID": "CVE-2024-38095",
                    "PkgName": "System.Formats.Asn1",
                    "PkgIdentifier": {
                        "PURL": "pkg:nuget/[email protected]",
                        "UID": "c4caf253e24636e4"
                    },
                    "InstalledVersion": "5.0.0",
                    "FixedVersion": "6.0.1, 8.0.1",
                    "Status": "fixed",
                    "Layer": {
                        "DiffID": "sha256:3357da3fec4c9d45210b22e1b208983a625130f26f37192f121048132be4d097"
                    },
                    "SeveritySource": "ghsa",
                    "PrimaryURL": "https://avd.aquasec.com/nvd/cve-2024-38095",
                    "DataSource": {
                        "ID": "ghsa",
                        "Name": "GitHub Security Advisory NuGet",
                        "URL": "https://github.com/advisories?query=type%3Areviewed+ecosystem%3Anuget"
                    },
                    "Title": "dotnet: DoS when parsing X.509 Content and ObjectIdentifiers",
                    "Description": ".NET and Visual Studio Denial of Service Vulnerability",
                    "Severity": "HIGH",
                    "CweIDs": [
                        "CWE-20"
                    ],

@ErikEJ
Copy link
Contributor Author

ErikEJ commented Jul 22, 2024

@Ruud-cb what patch version are you proposing? See #2048

@Ruud-cb
Copy link

Ruud-cb commented Jul 22, 2024

@ErikEJ coming from #2048 as well, as per #2576 it is a unused reference, (also in the current version 5.2.1 is perhaps the question), so if System.Security.Cryptography.Cng is not needed then it should be removed in the current version so that the above vulnerability is resolved as well if I'm not mistaken..

@ErikEJ
Copy link
Contributor Author

ErikEJ commented Jul 22, 2024

@Ruud-cb They are only un-used in 6.0, not in 5.0 (due to removal of .NET Standard target)

@Ruud-cb
Copy link

Ruud-cb commented Jul 22, 2024

@ErikEJ Strange, my app.deps.json after build in .NET 8 refers to sql client 5.1.5 that uses System.Security.Cryptography.Cng

      "Microsoft.Data.SqlClient/5.1.5": {
        "dependencies": {
          "Azure.Identity": "1.10.3",
          "Microsoft.Data.SqlClient.SNI.runtime": "5.1.1",
          "Microsoft.Identity.Client": "4.56.0",
          "Microsoft.IdentityModel.JsonWebTokens": "7.7.1",
          "Microsoft.IdentityModel.Protocols.OpenIdConnect": "7.7.1",
          "Microsoft.SqlServer.Server": "1.0.0",
          "System.Configuration.ConfigurationManager": "6.0.1",
          "System.Diagnostics.DiagnosticSource": "8.0.0",
          "System.Runtime.Caching": "6.0.0",
          "System.Security.Cryptography.Cng": "5.0.0",
          "System.Security.Principal.Windows": "5.0.0",
          "System.Text.Encoding.CodePages": "6.0.0",
          "System.Text.Encodings.Web": "8.0.0"
        },
      },
        
        ...

      "System.Security.Cryptography.Cng/5.0.0": {
        "dependencies": {
          "System.Formats.Asn1": "5.0.0"
        }
      },

Seems that the project is not using the latest 5.2.1 version, I don't reference the package directly so I guess Microsoft.EntityFrameworkCore.* 8.0.7 is not using that version yet? Not sure if the package is removed in5.2.*?

@ErikEJ
Copy link
Contributor Author

ErikEJ commented Jul 22, 2024

@Ruud-cb The package is only removed in Microsoft.Data.SqlClient 6.0, and it cannot be removed in Microsoft.Data.SqlClient 5.x

deepaksa1 added a commit to deepaksa1/SqlClient that referenced this pull request Jul 22, 2024
* Updating Azure.Identity version to 1.11.3 (dotnet#2526)

* Fix | Clone of SqlConnection should include AccessTokenCallback (dotnet#2525)

* Enhancement | Add trace logs for packet size (dotnet#2522)

* Merged PR 4583: eng | Fix policheck errors.

Fix policheck errors.

Sample pipeline run which did not have policheck errors:

https://sqlclientdrivers.visualstudio.com/ADO.Net/_build/results?buildId=88114&view=sariftools.scans.build-tab

Related work items: #30279

* Doc | Fix SNI dependencies of 5.1 and 5.2 release notes (dotnet#2537)

* Change | Separate tests for NetFx and NetCore - NetFx-Only Connection String Properties (dotnet#2466)

* Adding TransparentNetworkIpResolution to list of unsupported on platform connection string error messages
Splitting unit test for netfx-only connection string properties such that test does not fail on netcore

* Remove DeprecatedSynonymCount since referencing the unsupported array is not possible

* Fix | Enhance certificate validation (dotnet#2487)

* Hotfix v5.2.1 Release notes (dotnet#2534)

* Improve AccessTokenCallback sample code (dotnet#2543)

* Merged PR 4621: eng | Fix policheck

* Fix | Adjust path for .AssemblyAttributes in obj folder (dotnet#2550)

* Fix | Fixed GenerateSspiClientContext to retry negotiation with default port (dotnet#2559)

* Strong typed diagnostics (dotnet#2226)

* Fix | Replaced System.Runtime.Caching with Microsoft.Extensions.Caching.Memory (dotnet#2493)

* Add | Add SourceLink translation (dotnet#2552)

* Add | Cache TokenCredential objects to take advantage of token caching (dotnet#2380)

* Merged common code base for SqlUtil.cs (dotnet#2533)

* Add scope trace for GenerateSspiClientContext (dotnet#2497)

* Address conflicts (dotnet#2562)

* Addressing conflict (dotnet#2560)

* Merge SqlColumnEncryptionCertificateStoreProvider (dotnet#2521)

* Add | No-op if engineedition is 6 or 11 due to lack of support for ASSEMBLYPROPERTY function (dotnet#2593)

* Change | Remove some unneeded references and update Azure.Identity (dotnet#2577)

* Add test for issue 2456 (dotnet#2457)

* Merged common code base for AlwaysEncryptedKeyConverter (dotnet#2538)

* Merged AlwaysEncryptedKeyConverter.CrossPlatform and AlwaysEncryptedKeyConverter.Cng.

* 3 Small Changes (dotnet#2594)

* * Port sqlclientx datasource changes
* Remove link to missing nuget.config file
* Remove root namespaces from sqlclient csproj files

* Test to see if namespace changes are breaking the pr build

* Reinstate removing the root namespace and fix resource filename generation

* Test fixes to accommodate recent infra changes (dotnet#2646)

* Test fixes to accomodate recent infra changes

* Fix - Don't error when using infinte connect timeout and Entra auth (dotnet#2651)

* eng | Add delay signed to official builds (dotnet#2653)

* eng | Initial YAML CI pipeline (dotnet#2575)

* Fix | Fix decrypt failure to drain data (dotnet#2618)

* [Scheduled Run] Localized resource files from OneLocBuild

* eng | Add Delay sign to ref csprojs (dotnet#2684)

* [Scheduled Run] Localized resource files from OneLocBuild

* [Scheduled Run] Localized resource files from OneLocBuild

---------

Co-authored-by: Javad Rahnama <[email protected]>
Co-authored-by: David Engel <[email protected]>
Co-authored-by: Aris Rellegue <[email protected]>
Co-authored-by: DavoudEshtehari <[email protected]>
Co-authored-by: Benjamin Russell <[email protected]>
Co-authored-by: Aris Rellegue <[email protected]>
Co-authored-by: dauinsight <[email protected]>
Co-authored-by: Scott Addie <[email protected]>
Co-authored-by: Daniel Au <[email protected]>
Co-authored-by: Wraith <[email protected]>
Co-authored-by: SqlClient Azure DevOps <[email protected]>
Co-authored-by: Edward Neal <[email protected]>
Co-authored-by: Erik Ejlskov Jensen <[email protected]>
Co-authored-by: David Engel <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💡 Enhancement New feature request
Projects
None yet
5 participants