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

Fix fetch URL for exception.json and update license files #54

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

fjssilva
Copy link

The script license-text-extractor.ps1 was wrongly fetching an old version of the file exception.json that only contained a small number of license exceptions.

This fixes the NuGetGallery issue #10225. As stated in the issue, I only require the missing text for the exception Universal-FOSS-exception-1.0 but, given how license files are updated in this repository, all missing licenses and other changes were automatically applied to this patch.

@fjssilva fjssilva requested a review from a team as a code owner October 25, 2024 15:41
Copy link

@fjssilva please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@dotnet-policy-service agree [company="{your company}"]

Options:

  • (default - no company specified) I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.
@dotnet-policy-service agree
  • (when company given) I am making Submissions in the course of work for my employer (or my employer has intellectual property rights in my Submissions by contract or applicable law). I have permission from my employer to make Submissions and enter into this Agreement on behalf of my employer. By signing below, the defined term “You” includes me and my employer.
@dotnet-policy-service agree company="Microsoft"
Contributor License Agreement

Contribution License Agreement

This Contribution License Agreement ( “Agreement” ) is agreed to by the party signing below ( “You” ),
and conveys certain license rights to the .NET Foundation ( “.NET Foundation” ) for Your contributions to
.NET Foundation open source projects. This Agreement is effective as of the latest signature date below.

1. Definitions.

“Code” means the computer software code, whether in human-readable or machine-executable form,
that is delivered by You to .NET Foundation under this Agreement.

“Project” means any of the projects owned or managed by .NET Foundation and offered under a license
approved by the Open Source Initiative (www.opensource.org).

“Submit” is the act of uploading, submitting, transmitting, or distributing code or other content to any
Project, including but not limited to communication on electronic mailing lists, source code control
systems, and issue tracking systems that are managed by, or on behalf of, the Project for the purpose of
discussing and improving that Project, but excluding communication that is conspicuously marked or
otherwise designated in writing by You as “Not a Submission.”

“Submission” means the Code and any other copyrightable material Submitted by You, including any
associated comments and documentation.

2. Your Submission. You must agree to the terms of this Agreement before making a Submission to any
Project. This Agreement covers any and all Submissions that You, now or in the future (except as
described in Section 4 below), Submit to any Project.

3. Originality of Work. You represent that each of Your Submissions is entirely Your
original work. Should You wish to Submit materials that are not Your original work,
You may Submit them separately to the Project if You (a) retain all copyright and
license information that was in the materials as you received them, (b) in the
description accompanying your Submission, include the phrase "Submission
containing materials of a third party:" followed by the names of the third party and any
licenses or other restrictions of which You are aware, and (c) follow any other
instructions in the Project's written guidelines concerning Submissions.

4. Your Employer. References to “employer” in this Agreement include Your employer or anyone else
for whom You are acting in making Your Submission, e.g. as a contractor, vendor, or agent. If Your
Submission is made in the course of Your work for an employer or Your employer has intellectual
property rights in Your Submission by contract or applicable law, You must secure permission from Your
employer to make the Submission before signing this Agreement. In that case, the term “You” in this
Agreement will refer to You and the employer collectively. If You change employers in the future and
desire to Submit additional Submissions for the new employer, then You agree to sign a new Agreement
and secure permission from the new employer before Submitting those Submissions.

5. Licenses.

a. Copyright License. You grant .NET Foundation, and those who receive the Submission directly
or indirectly from .NET Foundation, a perpetual, worldwide, non-exclusive, royalty-free, irrevocable
license in the Submission to reproduce, prepare derivative works of, publicly display, publicly perform,
and distribute the Submission and such derivative works, and to sublicense any or all of the foregoing
rights to third parties.

b. Patent License. You grant .NET Foundation, and those who receive the Submission directly or
indirectly from .NET Foundation, a perpetual, worldwide, non-exclusive, royalty-free, irrevocable license
under Your patent claims that are necessarily infringed by the Submission or the combination of the
Submission with the Project to which it was Submitted to make, have made, use, offer to sell, sell and
import or otherwise dispose of the Submission alone or with the Project.

c. Other Rights Reserved. Each party reserves all rights not expressly granted in this Agreement.
No additional licenses or rights whatsoever (including, without limitation, any implied licenses) are
granted by implication, exhaustion, estoppel or otherwise.

6. Representations and Warranties. You represent that You are legally entitled to grant the above
licenses. You represent that each of Your Submissions is entirely Your original work (except as You may
have disclosed under Section 3 ). You represent that You have secured permission from Your employer to
make the Submission in cases where Your Submission is made in the course of Your work for Your
employer or Your employer has intellectual property rights in Your Submission by contract or applicable
law. If You are signing this Agreement on behalf of Your employer, You represent and warrant that You
have the necessary authority to bind the listed employer to the obligations contained in this Agreement.
You are not expected to provide support for Your Submission, unless You choose to do so. UNLESS
REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING, AND EXCEPT FOR THE WARRANTIES
EXPRESSLY STATED IN SECTIONS 3, 4, AND 6 , THE SUBMISSION PROVIDED UNDER THIS AGREEMENT IS
PROVIDED WITHOUT WARRANTY OF ANY KIND, INCLUDING, BUT NOT LIMITED TO, ANY WARRANTY OF
NONINFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.

7. Notice to .NET Foundation. You agree to notify .NET Foundation in writing of any facts or
circumstances of which You later become aware that would make Your representations in this
Agreement inaccurate in any respect.

8. Information about Submissions. You agree that contributions to Projects and information about
contributions may be maintained indefinitely and disclosed publicly, including Your name and other
information that You submit with Your Submission.

9. Governing Law/Jurisdiction. This Agreement is governed by the laws of the State of Washington, and
the parties consent to exclusive jurisdiction and venue in the federal courts sitting in King County,
Washington, unless no federal subject matter jurisdiction exists, in which case the parties consent to
exclusive jurisdiction and venue in the Superior Court of King County, Washington. The parties waive all
defenses of lack of personal jurisdiction and forum non-conveniens.

10. Entire Agreement/Assignment. This Agreement is the entire agreement between the parties, and
supersedes any and all prior agreements, understandings or communications, written or oral, between
the parties relating to the subject matter hereof. This Agreement may be assigned by .NET Foundation.

.NET Foundation dedicates this Contribution License Agreement to the public domain according to the Creative Commons CC0 1.

@@ -0,0 +1,7 @@
{

Choose a reason for hiding this comment

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

Was the license already supported by us? Otherwise, we need to triage the case by case. Not sure what this license for? Same applies for others.

Copy link
Author

@fjssilva fjssilva Oct 30, 2024

Choose a reason for hiding this comment

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

I don't think this is a matter of licenses being supported or not. This repository keeps and maintains replicas of the licences and exceptions hold in https://spdx.org/licenses/ and https://spdx.org/licenses/exceptions-index.html. The script license-text-extractor.ps1 in this repository does all the cloning and updating work. It was only a matter of chance (bug) that this script was stuck on downloading the exceptions from an old commit in the SPDX GitHub repository. Once I fixed the script, all newer license exception files were downloaded and processed automatically.

Same applies to all new files added in this patch. Actually, you can replicate this fix quite easily: just fix the script license-text-extractor.ps1 as I did and run it.

Choose a reason for hiding this comment

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

Let's scope to Universal-FOSS-exception-1.0 license. We need approval for new licenses on a case-by-case basis. Let's solve one problem at the time, there're not simple documents, actual legal document, we need to be careful.

Choose a reason for hiding this comment

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

Some license supported by https://spdx.org/licenses/ doesn't mean we should immediately accept it.

@@ -1,7 +0,0 @@
{

Choose a reason for hiding this comment

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

Why this one was deleted?

Copy link
Author

Choose a reason for hiding this comment

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

Same as before, the script license-text-extractor.ps1 did it, not me.

Copy link
Author

Choose a reason for hiding this comment

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

But, digging into the details, the reason why it was deleted is because this license is now deprecated and the extractor script skips those https://github.com/NuGet/NuGet.Licenses/blob/main/src/NuGet.Licenses/license-text-extractor.ps1#L19.

Before my fix, the list of license exceptions was wrongly taken from https://raw.githubusercontent.com/spdx/license-list-data/45d10da0366f5fa931f60f3931fd23d5fb708de5/json/exceptions.json, where Nokia-Qt-exception-1.1 wasn't deprecated yet, and now it is deprecated in the current/latest https://raw.githubusercontent.com/spdx/license-list-data/main/json/exceptions.json.

Choose a reason for hiding this comment

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

Considering we assume that packages never mutate once published, and I believe it extends to embedded data like license too. What happens if the package Nokia123 was published with the Nokia-Qt-exception-1.1.json license 5 years ago and the license is deleted now? Suddenly, it turns into a package without any license. Now, any enterprise consuming that package is in limbo or has to constantly check if it still has a license. Instead, regardless of what happens, the package should always keep its original license. Please correct me if I'm wrong.

Copy link
Author

Choose a reason for hiding this comment

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

I don't disagree with you. But then, INHO, the license extractor tool should be fixed to not exclude deprecated licenses. Not my call.

Choose a reason for hiding this comment

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

We can't focus on extractor tool right now due to high priority work we have scheduled right now. This isn't ideal and you're welcome to contribute fixing the tool.

@@ -15,7 +15,7 @@ Write-Host "Found $($licenseIds.Count) licenses."
# The SPDX version that client uses is here: https://github.com/NuGet/NuGet.Client/blob/release-6.4.x/src/NuGet.Core/NuGet.Packaging/Licenses/NuGetLicenseData.cs
# Make note of the release label in the NuGet.Client URL above! This should match the version of NuGet.Packaging that NuGet.Licenses.csproj depends on.
Write-Host "Fetching exception IDs..."
$exceptionResponseData = Invoke-RestMethod "https://raw.githubusercontent.com/spdx/license-list-data/45d10da0366f5fa931f60f3931fd23d5fb708de5/json/exceptions.json"

Choose a reason for hiding this comment

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

I think we should use specific latest commit hash instead of just main.

Choose a reason for hiding this comment

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

^ @NuGet/gallery-team
What do you think?

Copy link
Author

Choose a reason for hiding this comment

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

Note that this change was made in line with https://github.com/NuGet/NuGet.Licenses/blob/main/src/NuGet.Licenses/license-text-extractor.ps1#L10, which also downloads the licenses list from main.

Choose a reason for hiding this comment

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

I'll wait for @joelverhagen and @agr's feedback on this since they created the extractor tool.

Copy link
Contributor

@agr agr Nov 4, 2024

Choose a reason for hiding this comment

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

The comment starting at line 14 explains why specific version has to be used for exceptions. We can't just grab latest from main, we have to align with the snapshot used by the version of the NuGet.Packaging package referenced by the project.

Copy link
Author

Choose a reason for hiding this comment

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

The comment just says "The expression analyzer is a bit sensitive for unknown license exceptions...", it doesn't explain what the issues actually are. Anyway, I'm trying to connect the dots here, so, according to what you just explained, the licences (exceptions) in this repository must match the license list version "bb0099c", which, AFAICT, come from the SPDX snapshot https://github.com/spdx/license-list-data/tree/38193d69ba3e0b9e84f94ebc23c6e3a2bd9b0bec. If so, then the URL to download the exceptions from must be https://raw.githubusercontent.com/spdx/license-list-data/38193d69ba3e0b9e84f94ebc23c6e3a2bd9b0bec/json/exceptions.json. Correct?

I have to ask, though: if this is the case, then why you don't do the same with the main licences file? Note how so many have changes since the last time the license files were updated in this repository and new ones were added too. Wouldn't this hit the same problem as with the exceptions?

Also, the (potential) issue related to the deprecated exception Nokia-Qt-exception-1.1 will remain because this exception is already deprecated in the license list version "bb0099c".

Copy link
Contributor

@agr agr left a comment

Choose a reason for hiding this comment

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

We can't just blindly grab the latest version of exception data. It has to align with the NuGet.Packaging supported list.
Specifically, the concern is, if I remember correctly, that we shouldn't have any exceptions client doesn't know about. And it seems the package haven't updated its list of licenses/exceptions for a while (the snapshot referenced in the code haven't changed for a while). I'll ask the client folks if they can sync the list, then we can pull the changes here and update the list on our end.

However, it seems the package "knows" about the Universal-FOSS-exception-1.0 exception, so maybe, just changing the URL to use the bb0099c snapshot, the client expects would be enough.

@fjssilva
Copy link
Author

fjssilva commented Nov 5, 2024

We can't just blindly grab the latest version of exception data. It has to align with the NuGet.Packaging supported list. Specifically, the concern is, if I remember correctly, that we shouldn't have any exceptions client doesn't know about. And it seems the package haven't updated its list of licenses/exceptions for a while (the snapshot referenced in the code haven't changed for a while). I'll ask the client folks if they can sync the list, then we can pull the changes here and update the list on our end.

So, exceptions are the issue? No problem at all in having (main) licenses the client doesn't know about? BTW, all fine by me. I'm just pointing it out because it sounds strange to me, especially because NuGetLicenseData.cs does refer to a specific license list version...

However, it seems the package "knows" about the Universal-FOSS-exception-1.0 exception, so maybe, just changing the URL to use the bb0099c snapshot, the client expects would be enough.

Yes, it seems so. However, mind that running the extractor tool with this snapshot will still remove the exception Nokia-Qt-exception-1.1, if I'm not mistaken.

@agr
Copy link
Contributor

agr commented Nov 6, 2024

I don't remember the details, but the API of the licenses service assumes that SPDX license expression is passed as the query path. If the expression contains more than one element, a page is displayed with links to individual elements (licenses or exceptions). However, standalone exception name is not a valid SPDX license expression (exceptions can only follow the WITH keyword). To work around that, the first thing the code does is comparing the "expression" with a known exception list. That known exception list comes from NuGet.Packaging. If that lookup fails it tries to parse the whole path as license expression, using, again NuGet.Packaging. In either case, the presence of exceptions NuGet.Packaging doesn't know about would cause a failure.

The 38193d69ba3e0b9e84f94ebc23c6e3a2bd9b0bec snapshot from SPDX repo seems to be the right one to use in this case to align with NuGet.Packaging version the project uses.

I also looked through all the exceptions specified in license expressions for packages, and it seems none use Nokia-Qt-exception-1.1, so it shouldn't break anything.

@fjssilva
Copy link
Author

fjssilva commented Nov 6, 2024

Thanks @agr. FYI, this PR is a consequence of the missing page in Licensing information for the MySQL.Data package. As you can see, the links are rendered properly but the Universal-FOSS-exception-1.0 links to nowhere.

So, IIUC, what I should do next is to rework this patch so that it downloads the exceptions from the snapshot 38193d69ba3e0b9e84f94ebc23c6e3a2bd9b0bec (license list version bb0099c) and run the license extractor tool, right?

Just one remark: if I do so, the patch will also include all the new new licenses (not only exceptions) and changes in some of the existing license files, same as what you see already on this PR since the licenses are downloaded from main. Is this what you expect?

@agr
Copy link
Contributor

agr commented Nov 6, 2024

Yes, please update the exception snapshot. Pulling new licenses is fine.

For completeness, I sent the PR to update NuGet.Packaging to sync the license list to its today's state, so when the package update is published, we'd enable those to be actually used for new packages. This would require re-sync of exceptions, but we'll sort it out later.

@fjssilva
Copy link
Author

fjssilva commented Nov 6, 2024

PR updated. The extractor tool now downloads from the snapshot 38193d69ba3e0b9e84f94ebc23c6e3a2bd9b0bec and the tool was re-run.

Copy link
Contributor

@agr agr left a comment

Choose a reason for hiding this comment

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

Thank you!

I verified that those are all the changes that are available in SPDX repo and spot checked several licenses that the changes brought in are indeed the license template maintenance.

@agr
Copy link
Contributor

agr commented Nov 7, 2024

@fjssilva, you'd need to agree to CLA in order for this PR to be unblocked for merging.

@erdembayar
Copy link

@fjssilva, you'd need to agree to CLA in order for this PR to be unblocked for merging.

@fjssilva
Please check above, you need to agree CLA in order to continue.
image

@fjssilva
Copy link
Author

@erdembayar I know that, but I can't sign the CLA without my company's (Oracle) acceptance, and for that I need to involve our legal team, which may lead to a long bureaucratic process.

@erdembayar
Copy link

@erdembayar I know that, but I can't sign the CLA without my company's (Oracle) acceptance, and for that I need to involve our legal team, which may lead to a long bureaucratic process.

I don't know what the best way is for you. Is there anything owned by Oracle in this PR?

@fjssilva fjssilva closed this Nov 18, 2024
@fjssilva
Copy link
Author

@dotnet-policy-service agree company="Oracle America, Inc."

@fjssilva fjssilva reopened this Nov 18, 2024
@fjssilva
Copy link
Author

@microsoft-github-policy-service agree company="Oracle America, Inc."

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.

3 participants