Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jul 25, 2025

The NETStandard.Library package was incorrectly showing "License: Unknown" instead of the correct "MIT" license, causing false positive policy violations.

Problem

When PackageGuard analyzed projects using NETStandard.Library 2.0.3, it would report:

Policy violations found:

NETStandard.Library 2.0.3
- License: Unknown
- Feed: nuget.org (https://api.nuget.org/v3/index.json)

This occurred because the NETStandard.Library package metadata doesn't include proper license information, causing all license fetching strategies to fail and default to "Unknown".

Solution

Added specific handling for NETStandard.Library in the CorrectLicenseUrlsForMisbehavingPackagesFetcher class, following the same pattern as existing NUnit package handling:

if (package.Name.Equals("NETStandard.Library", StringComparison.InvariantCultureIgnoreCase))
{
    package.License = "MIT";
    package.RepositoryUrl = "https://github.com/dotnet/standard";
}

Result

Projects using NETStandard.Library will now correctly show:

NETStandard.Library 2.0.3
- License: MIT
- Feed: nuget.org (https://api.nuget.org/v3/index.json)

This eliminates false positive policy violations for projects legitimately using the .NET Standard Library.

Testing

Added comprehensive test case NETStandard_Library_should_have_MIT_license() to verify the fix works correctly and prevent regressions.

Fixes #56.

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/microsoft/codecoverage/license
    • Triggering command: /usr/lib/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/packageguard/packageguard/Src/PackageGuard.Specs/bin/Release/net8.0/PackageGuard.Specs.runtimeconfig.json --depsfile /home/REDACTED/work/packageguard/packageguard/Src/PackageGuard.Specs/bin/Release/net8.0/PackageGuard.Specs.deps.json /home/REDACTED/work/packageguard/packageguard/Src/PackageGuard.Specs/bin/Release/net8.0/testhost.dll --port 38789 --endpoint 127.0.0.1:038789 --role client --parentprocessid 4011 --telemetryoptedin false (http block)
  • https://api.github.com/repos/nunit/nunit/license
    • Triggering command: /usr/lib/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/packageguard/packageguard/Src/PackageGuard.Specs/bin/Release/net8.0/PackageGuard.Specs.runtimeconfig.json --depsfile /home/REDACTED/work/packageguard/packageguard/Src/PackageGuard.Specs/bin/Release/net8.0/PackageGuard.Specs.deps.json /home/REDACTED/work/packageguard/packageguard/Src/PackageGuard.Specs/bin/Release/net8.0/testhost.dll --port 38789 --endpoint 127.0.0.1:038789 --role client --parentprocessid 4011 --telemetryoptedin false (http block)
  • https://api.github.com/repos/xunit/xunit/license
    • Triggering command: /usr/lib/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/packageguard/packageguard/Src/PackageGuard.Specs/bin/Release/net8.0/PackageGuard.Specs.runtimeconfig.json --depsfile /home/REDACTED/work/packageguard/packageguard/Src/PackageGuard.Specs/bin/Release/net8.0/PackageGuard.Specs.deps.json /home/REDACTED/work/packageguard/packageguard/Src/PackageGuard.Specs/bin/Release/net8.0/testhost.dll --port 38789 --endpoint 127.0.0.1:038789 --role client --parentprocessid 4011 --telemetryoptedin false (http block)
    • Triggering command: /usr/lib/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/packageguard/packageguard/Src/PackageGuard.Specs/bin/Release/net8.0/PackageGuard.Specs.runtimeconfig.json --depsfile /home/REDACTED/work/packageguard/packageguard/Src/PackageGuard.Specs/bin/Release/net8.0/PackageGuard.Specs.deps.json /home/REDACTED/work/packageguard/packageguard/Src/PackageGuard.Specs/bin/Release/net8.0/testhost.dll --port 33767 --endpoint 127.0.0.1:033767 --role client --parentprocessid 5327 --telemetryoptedin false (http block)
  • www.nuget.org
    • Triggering command: /usr/lib/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/packageguard/packageguard/Src/PackageGuard.Specs/bin/Release/net8.0/PackageGuard.Specs.runtimeconfig.json --depsfile /home/REDACTED/work/packageguard/packageguard/Src/PackageGuard.Specs/bin/Release/net8.0/PackageGuard.Specs.deps.json /home/REDACTED/work/packageguard/packageguard/Src/PackageGuard.Specs/bin/Release/net8.0/testhost.dll --port 38789 --endpoint 127.0.0.1:038789 --role client --parentprocessid 4011 --telemetryoptedin false (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] NETStandard.Library is not properly detected Fix NETStandard.Library license detection - correctly identify as MIT license Jul 25, 2025
Copilot AI requested a review from dennisdoomen July 25, 2025 19:40
@dennisdoomen dennisdoomen changed the title Fix NETStandard.Library license detection - correctly identify as MIT license Fix NETStandard.Library license detection Jul 26, 2025
@dennisdoomen dennisdoomen marked this pull request as ready for review July 26, 2025 06:32
@github-actions
Copy link

Test Results

46 tests  +1   46 ✅ +1   50s ⏱️ +13s
 2 suites ±0    0 💤 ±0 
 2 files   ±0    0 ❌ ±0 

Results for commit 7203215. ± Comparison against base commit 86673f1.

@coveralls
Copy link

coveralls commented Jul 26, 2025

Pull Request Test Coverage Report for Build 16537072718

Details

  • 6 of 6 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.2%) to 76.148%

Totals Coverage Status
Change from base Build 16529841367: 0.2%
Covered Lines: 504
Relevant Lines: 673

💛 - Coveralls

@dennisdoomen dennisdoomen enabled auto-merge (squash) July 26, 2025 06:38
@dennisdoomen dennisdoomen merged commit 7849617 into main Jul 26, 2025
2 checks passed
@dennisdoomen dennisdoomen added the bug Something isn't working label Jul 26, 2025
@dennisdoomen dennisdoomen deleted the copilot/fix-56-2 branch July 31, 2025 19:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NETStandard.Library is not properly detected

3 participants