You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: implement license resolution and identification (#403)
* feat: implement license resolution and identification
* feat: calculate compatibility from backend information
---------
Signed-off-by: Ruben Romero Montes <rromerom@redhat.com>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
The proxy URL should be in the format: `http://host:port` or `https://host:port`. The API will automatically use the appropriate protocol (HTTP or HTTPS) based on the proxy URL provided.
373
380
</p>
374
381
382
+
<h4>License resolution and dependency license compliance</h4>
383
+
<p>
384
+
The client can resolve the <strong>project license</strong> from the manifest (e.g. <code>package.json</code> <code>license</code>, <code>pom.xml</code> <code><licenses></code>) and from a <code>LICENSE</code> or <code>LICENSE.md</code> file in the project, and report when they differ. For <strong>component analysis</strong>, you can optionally run a license check: the client fetches dependency licenses from the backend (by purl) and reports dependencies whose licenses are incompatible with the project license. See <ahref="docs/license-resolution-and-compliance.md">License resolution and compliance</a> for design and behavior. To disable the check on component analysis, set <code>TRUSTIFY_DA_LICENSE_CHECK=false</code> or pass <code>licenseCheck: false</code> in the options.
385
+
</p>
386
+
375
387
<h4>Customizing Executables</h4>
376
388
<p>
377
389
This project uses each ecosystem's executable for creating dependency trees. These executables are expected to be
Note: The `license` command shows only your project's license. For dependency license information, use component analysis.
81
+
82
+
## Analysis Report Fields
83
+
84
+
When license checking is enabled, component analysis includes a `licenseSummary` field:
85
+
86
+
```javascript
87
+
{
88
+
// ... standard analysis fields (providers, etc.) ...
89
+
"licenseSummary": {
90
+
"projectLicense": {
91
+
"manifest": {
92
+
"spdxId":"Apache-2.0",
93
+
"category":"PERMISSIVE",
94
+
"name":"Apache License 2.0",
95
+
"identifiers": ["Apache-2.0"]
96
+
},
97
+
"file": {
98
+
"spdxId":"Apache-2.0",
99
+
"category":"PERMISSIVE",
100
+
"name":"Apache License 2.0",
101
+
"identifiers": ["Apache-2.0"]
102
+
},
103
+
"mismatch":false
104
+
},
105
+
"incompatibleDependencies": [
106
+
{
107
+
"purl":"pkg:maven/org.example/gpl-lib@1.0.0",
108
+
"licenses": ["GPL-3.0"],
109
+
"category":"STRONG_COPYLEFT",
110
+
"reason":"Dependency license(s) are incompatible with the project license."
111
+
}
112
+
]
113
+
}
114
+
}
115
+
```
116
+
117
+
**Note:** Dependency license information (for all dependencies, not just incompatible ones) is available in the standard backend response under the `licenses` field. The `licenseSummary` only includes project license details and flagged incompatibilities.
118
+
119
+
## Common Scenarios
120
+
121
+
### Mismatch Between Manifest and LICENSE File
122
+
123
+
If your `package.json` says `"license": "MIT"` but your LICENSE file contains Apache-2.0 text, the component analysis report will show:
124
+
```json
125
+
{
126
+
"licenseSummary": {
127
+
"projectLicense": {
128
+
"manifest": {
129
+
"spdxId": "MIT",
130
+
"category": "PERMISSIVE",
131
+
"name": "MIT License"
132
+
},
133
+
"file": {
134
+
"spdxId": "Apache-2.0",
135
+
"category": "PERMISSIVE",
136
+
"name": "Apache License 2.0"
137
+
},
138
+
"mismatch": true
139
+
},
140
+
"incompatibleDependencies": []
141
+
}
142
+
}
143
+
```
144
+
145
+
**Action:** Update your manifest or LICENSE file to match.
146
+
147
+
### Incompatible Dependencies
148
+
149
+
If you have a permissive-licensed project (MIT, Apache) but depend on GPL-licensed libraries, they’ll appear in `incompatibleDependencies`.
150
+
151
+
**Action:** Review the flagged dependencies and consider:
152
+
- Finding alternative libraries with compatible licenses
153
+
- Consulting legal counsel if the dependency is necessary
154
+
- Understanding how you’re using the dependency (linking, distribution, etc.)
155
+
156
+
## SBOM Integration
157
+
158
+
Project license information is automatically included in generated SBOMs (CycloneDX format) in the root component’s `licenses` field.
0 commit comments