This use case describes how to configure Xray to scan an environment and generate a detailed license report, helping teams ensure compliance, manage risks, and support legal audits..
Step 1: Define a License Policy in Xray
π Goal: Ensure all artifacts and dependencies comply with legal and internal policies.
- Navigate to JFrog Platform β Xray.
- Go to Security & Compliance β Policies.
- Click "Create Policy", selecting "License" as the policy type.
- Configure the policy:
- Name:
License Compliance Policy - Description: Identifies all software licenses used in the environment.
- Allowed Licenses: Select approved licenses (e.g., MIT, Apache-2.0, BSD).
- Restricted Licenses: Select licenses that violate company policy (e.g., GPL-3.0, AGPL-3.0).
- Actions:
- β Generate Report (Creates a full license report).
- β Fail Build (Blocks CI/CD if non-compliant licenses are detected).
- β Notify Compliance Team (Email/Slack alerts for restricted licenses).
- Name:
- Click Save.
Step 3: Generate a License Report
π Goal: Run a scan and create a report listing all licenses used in the environment.
- Navigate to Xray β Reports.
- Click "Generate Report" β "License Report".
- Select Scope:
- β Repositories: Choose all relevant repositories.
- β Builds: Include all software builds.
- β Packages: Scan all dependency types.
- Define Filters:
- β Include all licenses (Allowed, Restricted, Unknown).
- β Export as CSV or JSON for external analysis.
- Click "Generate" to create the report.
Step 4: Review and Analyze the Report
π Goal: Examine license usage and identify any compliance risks.
Example Report Output (CSV/JSON)
| Package Name | Version | License | Compliance Status | Risk Level |
|---|---|---|---|---|
| log4j | 2.14.1 | Apache-2.0 | β Compliant | Low |
| express | 4.17.1 | MIT | β Compliant | Low |
| openssl | 1.0.1 | OpenSSL License | β οΈ Restricted | Medium |
| my-library | 1.2.3 | GPL-3.0 | β Non-Compliant | High |
β Compliance Actions Based on Report Findings:
- If Only Allowed Licenses Are Found: Approve software for deployment.
- If Restricted Licenses Exist: Evaluate and obtain legal approval.
- If Non-Compliant Licenses Exist: Block deployment and seek alternatives.
Step 5: Automate Report Generation in CI/CD
π Goal: Ensure license reports are automatically generated in the build pipeline.
Jenkins Pipeline Example (Xray API Call for License Report Generation)
shCopyEditcurl -u user:password -X POST "https://artifactory.example.com/xray/api/v1/reports" \
-H "Content-Type: application/json" \
-d '{
"name": "License Compliance Report",
"resources": {
"type": "repository",
"names": ["maven-central", "npm-registry"]
},
"filters": {
"licenses": ["ALL"]
},
"output": {
"format": "csv",
"destination": "artifactory://reports"
}
}'
β Expected Outcome:
- A license compliance report is generated for all scanned artifacts.
- The report is stored in Artifactory for review.
- If non-compliant licenses are found, the build fails, and the compliance team is notified.