Skip to content

Conversation

@erdembayar
Copy link
Contributor

@erdembayar erdembayar commented Jul 12, 2023

Bug

Fixes: https://github.com/NuGet/Client.Engineering/issues/2372

Regression? Last working version:

Description

Recently #5289 upgraded System.Security.Cryptography.Pkcs to non-vulnerable version, still GC alert persists.

GC alert is no longer present in CI build after this fix: https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=8058016&view=logs&j=cb98efd6-7062-56ef-f642-0176540bbe0a&t=f95ba3d8-e30a-5687-3fc7-3bc14bb0710b&l=2327

PR Checklist

  • PR has a meaningful title

  • PR has a linked issue.

  • Described changes

  • Tests

    • Automated tests added
    • OR
    • Test exception
    • OR
    • N/A
  • Documentation

    • Documentation PR or issue filled
    • OR
    • N/A

@erdembayar erdembayar marked this pull request as ready for review July 12, 2023 03:46
@erdembayar erdembayar requested a review from a team as a code owner July 12, 2023 03:46
<PackageReference Include="Microsoft.Build.Utilities.Core" ExcludeAssets="runtime" GeneratePathProperty="true" />
<!-- System.Security.Cryptography.Xml is a dependency of Microsoft.Build.Tasks.Core. Therefore, we have assigned the same ExcludeAssets value. -->
<PackageReference Include="System.Security.Cryptography.Xml" ExcludeAssets="Runtime" />
<PackageReference Include="System.Security.Cryptography.Pkcs" />
Copy link
Contributor Author

Choose a reason for hiding this comment

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

No ExcludeAssets="runtime" here otherwise IlMerge fails.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here is the difference between current branch and dev for deps.json file.
Please note here 2 screenshots:
Left side current branch and right is dev branch.

image
2.
image

Copy link
Contributor

@donnie-msft donnie-msft left a comment

Choose a reason for hiding this comment

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

I believe this looks OK, although I'm not sure why the ILMerge issue came up because of this change? I suppose the worst side effect is there's a change in nuget.exe payload with this package, but I hope someone else understands the cause and its implications better than I do.

Ideally, @zivkan would be the best to approve in case he knows more having recently looked at this package and CG.

Also, there's a lot of build links in the description, but those will all be lost in a short timeframe, as they expire. Consider putting whatever detail you want directly into the PR.

zivkan
zivkan previously approved these changes Jul 12, 2023
Copy link
Member

@zivkan zivkan left a comment

Choose a reason for hiding this comment

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

I missed this in my own PR because I didn't expect CG to be "green" when there's an alert in the PR build. I see that in official builds that the component detection task is orange.

@erdembayar can you please figure out why official and PR builds behave differently (I'm sure it's related to some build variable), and fix the PR pipeline to also be orange, so we can more easily see when our PRs don't fix CG issues correctly.

@zivkan zivkan dismissed their stale review July 12, 2023 08:29

as per my review comments, I think this might actually cause insertion failures in the .NET SDK

@erdembayar
Copy link
Contributor Author

erdembayar commented Jul 12, 2023

@erdembayar can you please figure out why official and PR builds behave differently (I'm sure it's related to some build variable), and fix the PR pipeline to also be orange, so we can more easily see when our PRs don't fix CG issues correctly.

It was env var cfsNugetWarnLevel making the difference. I copied it from official to private pipeline.
Now it's properly raising the GC warning in private pipeline with dev branch.

Env vars in both private and public pipelines looks almost identical, not sure what is making one to flag and not the other one. I'll inquire offline.

@erdembayar
Copy link
Contributor Author

@erdembayar can you please figure out why official and PR builds behave differently (I'm sure it's related to some build variable), and fix the PR pipeline to also be orange, so we can more easily see when our PRs don't fix CG issues correctly.

I inquired about this, below is answer:

This is happening due to Production/Non-Production classification differences in both pipelines.  The partial task failure (orange build) will only occur if there’s a due date on the alert. 
Due dates are only applicable to production build. 

That means we couldn't up light up orange build in private pipeline unless we classify as production, I believe we're not going to do it, because it would cause ton of other unnecessary compliance warnings.

@erdembayar erdembayar requested review from nkolev92 and zivkan July 13, 2023 23:17
Copy link
Contributor Author

@erdembayar erdembayar left a comment

Choose a reason for hiding this comment

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

@nkolev92
I added deps.json file comparison for each changes after latest change. Please review again.



<ItemGroup Condition=" '$(IsCore)' == 'true' ">
<PackageReference Include="System.Security.Cryptography.Pkcs" ExcludeAssets="Compile"/>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@nkolev92
Here is the difference between current branch and dev for deps.json file.
Left side current branch and right is dev branch.

image

<PackageReference Include="Microsoft.Build.Utilities.Core" ExcludeAssets="runtime" GeneratePathProperty="true" />
<!-- System.Security.Cryptography.Xml is a dependency of Microsoft.Build.Tasks.Core. Therefore, we have assigned the same ExcludeAssets value. -->
<PackageReference Include="System.Security.Cryptography.Xml" ExcludeAssets="Runtime" />
<PackageReference Include="System.Security.Cryptography.Pkcs" />
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here is the difference between current branch and dev for deps.json file.
Please note here 2 screenshots:
Left side current branch and right is dev branch.

image
2.
image

<PackageReference Include="Microsoft.Build.Utilities.Core" ExcludeAssets="runtime" />
<!-- System.Security.Cryptography.Xml is a dependency of Microsoft.Build.Tasks.Core. Therefore, we have assigned the same ExcludeAssets value. -->
<PackageReference Include="System.Security.Cryptography.Xml" ExcludeAssets="runtime" />
<PackageReference Include="System.Security.Cryptography.Pkcs" ExcludeAssets="compile" />
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here is the difference between current branch and dev for deps.json file.
Left side current branch and right is dev branch.

image
2.
image

@aortiz-msft aortiz-msft self-requested a review July 17, 2023 18:16
Copy link
Contributor

@aortiz-msft aortiz-msft left a comment

Choose a reason for hiding this comment

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

LGTM

@erdembayar erdembayar merged commit 64b8cd1 into dev Jul 18, 2023
@erdembayar erdembayar deleted the dev-eryondon-fix-pkcs-gc-warning6 branch July 18, 2023 00:05
martinrrm pushed a commit that referenced this pull request Jul 25, 2023
* Override vulnerable transitive dependency to fix GC alerts
aortiz-msft pushed a commit that referenced this pull request Jul 25, 2023
…#5332)

* Address component government alerts (#5308)

* Override vulnerable transitive dependency to fix GC alerts

* Update System.Security.Cryptography.Pkcs version (#5289)

---------

Co-authored-by: Erick Yondon <[email protected]>
Co-authored-by: Andy Zivkovic <[email protected]>
jeffkl pushed a commit that referenced this pull request Aug 1, 2023
* Override vulnerable transitive dependency to fix GC alerts
jeffkl pushed a commit that referenced this pull request Aug 1, 2023
* Override vulnerable transitive dependency to fix GC alerts
martinrrm added a commit that referenced this pull request Aug 14, 2023
…#5332)

* Address component government alerts (#5308)

* Override vulnerable transitive dependency to fix GC alerts

* Update System.Security.Cryptography.Pkcs version (#5289)

---------

Co-authored-by: Erick Yondon <[email protected]>
Co-authored-by: Andy Zivkovic <[email protected]>
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.

6 participants