1. The `ENTRYPOINT` for the container will execute [run.sh](https://gitlab.com/gitlab-org/security-products/analyzers/license-finder/-/blob/191185c4303768c6d9a1431c35143501c06ee4d7/run.sh):
```Dockerfile
ENTRYPOINT ["/run.sh"]
```
1. This shell script sets up the runtime environment then invokes the `license_management` executable:
1. The `tool_box` determines the required version of tools (i.e Java, Ruby, Python etc) for the package manager and then installs it by looking in `/opt/toolcache/` for a matching `*.deb` file or falls back to `asdf` to install the tool from source.
1. After the tool(s) are installed the package manager class builds a list of dependencies identified in the project. If an `install_path` is provided then the files in this directory are scanned for software licenses.
1. Once all the dependencies and their licenses are identified a JSON report is generated for the desired version of the report. The `Report` class is backwards compatible and able to generate any previous version of the report.
1. The final JSON report is written to [gl-license-scanning-report.json](https://gitlab.com/gitlab-org/security-products/analyzers/license-finder/-/blob/191185c4303768c6d9a1431c35143501c06ee4d7/spec/fixtures/schema/v2.1.json) in the root of the project.
```json
{
"version": "2.1",
"licenses": [
{
"id": "MPL-2.0",
"name": "Mozilla Public License 2.0",
"url": "https://opensource.org/licenses/MPL-2.0"
}
],
"dependencies": [
{
"name": "rhino",
"version": "1.7.10",
"package_manager": "maven",
"path": "pom.xml",
"licenses": [
"MPL-2.0"
]
}
]
}
```
For additional information watch:
* License Compliance Past, Present and Future: https://youtu.be/j2TguACMvho
* Overview of the license approvals: https://youtu.be/e0qfNbnnI4c
* Overview of how license scanning works in GitLab CI: https://youtu.be/biC1t-7bMhg
* How to use the OSS Review Toolkit: https://youtu.be/dNmH_kYJ34g
## Opportunities for improvement
*[ ] Cache the [`.gitlab/cache`][cache-dir] directory in [License-Scanning.gitlab-ci.yml][ci-template] to speed up `prepare` step
* [ ] Make `--recursive` scan the default
*[ ] Override the `nodejs` plugin to install the [Linux Binaries][nodejs-binaries] instead of compiling from source code.
*[ ] Replace license detection engine with [license classifier][google-classifier] or [licensee][licensee]
* [ ] Run `prepare` step for each active package manager in parallel
* [ ] Store Debian packages for each tool in hosted Debian repository instead of storing in `/opt/toolcache`.
* Alternatives to consider:
*[Google License Classifier][google-classifier]
*[Licensed][licensed]
*[ORT][ort]
*[Scout][scout]
# Contributing
If you want to help, read the [contribution guidelines](CONTRIBUTING.md).
...
...
@@ -139,7 +320,9 @@ in [normalized-licenses.yml](https://gitlab.com/gitlab-org/security-products/ana