-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
Build licenses.txt with trivy #35659
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
base: main
Are you sure you want to change the base?
Conversation
|
I've moved the make target that generates as a dependency of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MIT license says:
[...]
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
This doesn't carry either of those so IMO we would not be compliant with MIT license. I haven't reviewed apache-2.0, MPL-2 and whatever else there is apart from BSD0 which has no obligations.
I don't think this applies to someone using software as a dependency, or otherwise 99.9% of software would violate this clause. I think there may be ways to obtain license text out of trivy, but last I checked, this is complicated and error-prone. |
|
Seems there is some problem with |
|
I don't know what is up with |
No software in the world packages their dependency's license texts. Not GitHub, not Gitlab, not Forgejo (which has entirely removed the licence.txt file). Why exactly would we have to? I think you should reconsider your stance (and block). |
I believe it’s compliant to include the license file only in the binary, as long as the product provides a clear and easily accessible link to it. However, in practice, some license scanners may not automatically detect this information. To address that, we could add a license notice in the repository that explains how to generate the license file. |
Actually there are no ways to obtain the license text with trivy. There is a |
|
See
Because copyright and licensing? The fact that many applications skip this doesn't mean it is compliant with license or right. |
|
The outputting of licence text was always purely voluntarely from Gitea's side, there was never any hard requirement for it. If there is a way to do it with trivy, I would add it, but sadly, this is not supported currently. |
|
To be clear on this, I approve this as well once I'll be certain or convinced it's compliant with the obligation from licenses or at the very least not a regression in this area.
I understand it as outputting to the end user through frontend, which is true. However there is a hard requirement for carrying it in general. SPDX does have fields for copyright and license text from what I see and SBOM with those filled would IMO meet all of obligations from licenses. Sadly trivy does not fill those out. Deduped list of obligations looks as follows (omitting dual licensed ones because it's just a OR/AND on two from the list)Taken mostly from reading the obligations from the license text and skimming https://tldrlegal.com
|
|
One thing I may change is the format, because SPDX is too verbose imho for something that's only meant to be read by end users effectively. I think a simple table-like view would also suffice and be much more concise. Like for example: |
|
I have double checked my understanding of obligations from MIT, BSD3 and ISC licenses and it's a hard NACK from compliance standpoint. Neither of those proposed formats carry what is required by the license. If anything I was informed that the current format is not sufficient in the first place as it does not meet the obligations from BSD-3-clause (in particular the 2nd clause because we do not distribute it in documentation or other materials provided with the distribution). MIT license, emphasis mineCopyright Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ISC license, emphasis mineCopyright Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. THE SOFTWARE IS PROVIDED “AS IS” AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. BSD-3-Clause license, emphasis mineCopyright Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Use trivy to generate licenses.txt at build time. This removes the generated content in the repo and completely moves the file generation to build time, ran right before webpack. On my machine, this generation currently takes 2.7s.
The new output format is SPDX, which brings the benefit that it is machine-parseable while still being human-readable. The format does not include the verbatim license text, but imho that is also not needed because most dependencies license can be classified.
Fixes: #33749
Example output format