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

Handle OSS licenses and attribution #2917

Closed
guydc opened this issue Mar 13, 2024 · 19 comments · Fixed by #3407
Closed

Handle OSS licenses and attribution #2917

guydc opened this issue Mar 13, 2024 · 19 comments · Fixed by #3407
Assignees
Labels
area/ci CI and build related issues documentation Improvements or additions to documentation
Milestone

Comments

@guydc
Copy link
Contributor

guydc commented Mar 13, 2024

Description:
Envoy Gateway should adhere to CNCF guidelines for dependency licenses. As an Apache-2.0 project, EG may have licensing implications from using copyleft dependencies that are licensed under GPLv3.

Some projects enforce these guidelines using tools like go-licenses, e.g. cilium. Automated validation of of approved licenses should be a part of the PR approval flow.

Additionally, the CNCF guidelines for OSS attribution should be followed, by generating and maintaining the appropriate documentation.

@guydc guydc added the triage label Mar 13, 2024
@arkodg
Copy link
Contributor

arkodg commented Mar 13, 2024

is this something that can be built into the openssf tooling ?

@guydc
Copy link
Contributor Author

guydc commented Mar 13, 2024

Not sure. At this time, the openssf license validation only checks that a license for the project exists.

There's this issue: ossf/scorecard#3840, but if focuses on the license in use by the project, not its dependencies. There's this issue: ossf/scorecard#2531 that deals with dependencies.

IMHO, this should be a reusable CNCF util, as it's meant to enforce CNCF-specific requirements.

@guydc guydc added documentation Improvements or additions to documentation area/ci CI and build related issues and removed triage labels Mar 15, 2024
@shahar-h
Copy link
Contributor

shahar-h commented Apr 2, 2024

Please assign me

@guydc
Copy link
Contributor Author

guydc commented Apr 2, 2024

@shahar-h - there are two options that we discussed in this context:

  • Making permissive dependency license checks part of the OSSF project
  • Trying to build a common CNCF util

@shahar-h
Copy link
Contributor

shahar-h commented Apr 2, 2024

@guydc FOSSA is commonly used by CNCF projects: cncf/foundation#109

@arkodg
Copy link
Contributor

arkodg commented Apr 3, 2024

+1 for FOSSA, will reach out to CNCF to get a key

@shahar-h
Copy link
Contributor

shahar-h commented Apr 7, 2024

@arkodg @guydc
I tested FOSSA on my EG fork repo and have some questions/insights:

  1. FOSSA free license supports max 5 dependency depth levels, where business/enterprise license have no limit. EG dependency depth level is 9. Can you tell which license CNCF work with?
  2. In order to trigger FOSSA scan also on PRs api key must be hardcoded in the workflow, since GitHub prevents PRs from forks from accessing secrets by default. It is possible to create push only API token that only allow to update builds. See:
    FOSSA scan enabled distribution/distribution#3396 (comment)
    https://docs.fossa.com/docs/api-reference#push-only-api-token
    We have 2 options here:
    1. Trigger FOSSA scan only on push to main events, which will allow us to read the token from secret.
    2. Trigger FOSSA scan only on internal PRs, which will allow us to read the token from secret. See related thread.
    3. Trigger FOSSA scan also on PRs and expose push-only api token, which is a common practice in CNCF repos.
      WDYT?
  3. I used FOSSA official GH action , which can be used in 2 modes:
    1. Non-blocking - scans dependencies, uploads report to server but doesn't wait for completion.
    2. Blocking - scans dependencies, uploads report to server and polling the server for status until it's completed.
      I guess that we want to work in blocking mode in order to fail the build on any new issue.
  4. The scan found some issues, which all look false positives. I can share my analysis if needed. Because of this I think we should start with non-blocking mode, triage all issues and then switch to blocking mode.

@shahar-h
Copy link
Contributor

shahar-h commented Apr 9, 2024

Update: FOSSA scan was done against some default license policy which is not compliant with CNCF policy.
Since I can't change the policy in the free version I go over scan results and found 2 license violations:

  • github.com/hashicorp/errwrap
  • github.com/hashicorp/go-multierror

Both declare MPL-2.0 license which is not included in CNCF approved licenses list.

Both dependencies are transitive and used by helm.sh/helm/v3, which is used by egctl.
Anyway there is an open PR that removes both dependencies and targeted to 3.15.0 release.

BTW osv-scanner which is used by OpenSSF for vulnerability scanning also supports license scanning. I tested it and it found the same violations with some few false positives. The problem that it's still experimental. We can consider using it in the future.

@arkodg can please refer to my questions in the previous comment? Did you manage to get FOSSA api key?

@arkodg
Copy link
Contributor

arkodg commented Apr 9, 2024

thanks for digging into this @shahar-h !
+1 on non blocking scans until we fix all

I'm still waiting to hear back from CNCF, will reach out again

@shahar-h
Copy link
Contributor

shahar-h commented Apr 9, 2024

Thanks, and what about the second point(api token)?

@arkodg
Copy link
Contributor

arkodg commented Apr 9, 2024

Thanks, and what about the second point(api token)?

yeah read the context from the distribution PR, CNCF + FOSSA is a +1 with that approach so we can just follow it, also include them in the PR, to make sure we're doing the right thing

@RobertKielty
Copy link

RobertKielty commented Apr 10, 2024

@Xunzhuo logged a CNCF Service Desk request.

I invited (most) all of the maintainers to join the CNCF Organizaion on FOSSA.

FOSSA Invites are valid for 48 hours. https://docs.fossa.com/docs/inviting-users

@Xunzhuo please spread the word and ask the invitees to accept their invitations.

I need just one maintainer to accept the invite who can then add repos following these instructions:

https://docs.fossa.com/docs/quick-import

Any issues reach out to me on CNCF Slack or update the Service Request.

@arkodg
Copy link
Contributor

arkodg commented Apr 10, 2024

thanks @RobertKielty, I do have access to the API key, will share it with you @shahar-h
From a quick glance, There are ways to integrate into FOSSA

  1. run scans on FOSSA on every merge
  2. run scans on PRs using our GHA

2 makes sense here so we can proactively catch any violations

@shahar-h
Copy link
Contributor

shahar-h commented Apr 30, 2024

Regarding osv-scanner option, there are a few gaps:

@arkodg
Copy link
Contributor

arkodg commented May 1, 2024

thanks for driving this work @shahar-h !

For other following this issue wanted to highlight why Envoy Gateway is trying to adopt osv-scanner over FOSSA

  • FOSSA is a SaaS tool that has its own notion of user management, for a open source project, which is a collection of loosely coupled maintainers, managing users in multiple places (apart from GH) adds maintenance burden
  • reviewing issues/violations must be done in the FOSSA platform instead of within GH where user roles are already assigned to view the right apps
  • the FOSSA token is tied to a email/user, Envoy Gateway does not have any bot emails, and after chatting with @phlax even Envoy Proxy is trying to move away from managing bot emails, this adds more maintenance once that user leaves the project

having said this, if we cannot achieve the goal of license scanning via osv-scanner , we may need to move to FOSSA

@shahar-h
Copy link
Contributor

shahar-h commented May 2, 2024

A more detailed context about osv-scanner gaps:
Current scan results:
image

@RobertKielty
Copy link

@shahar-h I note your work and comments with interest!

I will pass your feedback back to the Project Team in the CNCF.

One way of testing your work with osv-scanner is to add the same project to the team I created on FOSSA and manualy run the scan there to compare the results that osv-scanner produces.

@guydc
Copy link
Contributor Author

guydc commented May 2, 2024

This was discussed in the community meeting. For the time being, we can proceed with:

  • Implement an async, non-blocking osv scan workflow action
  • Create another issue to track all of the aforementioned limitations and their status. When all issues are resolved, we can turn on enforcement.

@shahar-h
Copy link
Contributor

shahar-h commented May 6, 2024

There is an additional issue: osv license scan can only be run together with vulnerability scan. Since we want to run vulnerability scan recursively(to be aligned with ossf-scorecard) but license scan only on root folder(I guess we don't care about dependencies licenses in tools and site folders) we either need an option to run license scan independently or ask support for a dedicated recursive flag for each scan. See related issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ci CI and build related issues documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants