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

Find license by embedded license text #2147

Closed
coheigea opened this issue Sep 18, 2023 · 2 comments · Fixed by #2213
Closed

Find license by embedded license text #2147

coheigea opened this issue Sep 18, 2023 · 2 comments · Fixed by #2213
Labels
enhancement New feature or request

Comments

@coheigea
Copy link
Contributor

coheigea commented Sep 18, 2023

For Java archives, we have the option of retrieving licenses either directly from the META-INF/MANIFEST.MF if Bundle-License is defined (OSGi) or from the pom.xml if it's build with Maven (#2115). However many projects are built with Gradle and are not OSGi bundles. Instead, these projects typically might include a license in the META-INF directory (for example the Spring framework includes the ASLv2 in META-INF/license.txt).

So what I'd like to do would be for Java archives to check for either a LICENSE or LICENSE.txt (case insensitive) in either the root directory or in META-INF and parse it for a license. I'm happy to contribute this - but do we have any existing code which can detect what license is in a license text file?

@coheigea coheigea added the enhancement New feature or request label Sep 18, 2023
@kzantow
Copy link
Contributor

kzantow commented Sep 18, 2023

Hi @coheigea -- take a look at the Go cataloger: https://github.com/anchore/syft/blob/main/syft/pkg/cataloger/golang/licenses.go#L178 how we parse text files to identify the appropriate license

@coheigea
Copy link
Contributor Author

Thanks @kzantow that's helpful, I got something working locally. I'll wait for contributing it until @spiffcs has updated #2115

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants