Fix SPDX import error handling, enforce LICENSEDB_ONLY mode, and introduce LicenseDB-based resolution#3933
Open
sharad-31 wants to merge 7 commits intoeclipse-sw360:mainfrom
Open
Fix SPDX import error handling, enforce LICENSEDB_ONLY mode, and introduce LicenseDB-based resolution#3933sharad-31 wants to merge 7 commits intoeclipse-sw360:mainfrom
sharad-31 wants to merge 7 commits intoeclipse-sw360:mainfrom
Conversation
Signed-off-by: Sharad <sharadgupta8171@gmail.com>
Signed-off-by: Sharad <sharadgupta8171@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This pull request introduces a LicenseDB-driven license resolution mechanism and enforces strict LICENSEDB_ONLY mode restrictions across license and obligation operations.
In addition, it improves the robustness of the SPDX license import workflow and includes configuration and development environment enhancements to support local development and testing.
Changes
1. LicenseDB-Based License Resolution & Policy Enforcement
Introduced centralized license resolution via
LicenseResolutionServiceAdded
LicenseSourcePolicyandLicenseSourceModeto control behavior using:sw360.license.source.mode
Supported modes:
Refactored license creation:
Updated integration points to ensure:
2. Enforcement of LICENSEDB_ONLY Restrictions
Added validation guards to prevent:
Introduced helper methods:
Applied in:
Behavior:
3. LicenseDB Integration Abstraction
Added
LicenseDbClientinterface:Optional fetchLicenseById(String licenseId);
Added
NoopLicenseDbClient:4. SPDX License Import Improvements
Updated:
licenses-core/src/main/java/org/eclipse/sw360/licenses/db/LicenseDatabaseHandler.java
Improvements:
addOrOverwriteLicenses(...)
.setRequestStatus(requestStatus)
Result:
5. Security Enhancements
Added:
@PreAuthorize("hasAuthority('WRITE')")
Applied to:
POST /licenses/upload
Ensures only authorized users can upload licenses
6. Configuration & Development Improvements
Docker:
Added docker-compose.override.yml with:
COUCHDB_USER=sw360
COUCHDB_PASSWORD=sw360fossie
Keycloak:
Added orgmapping.properties for organization mapping tests
Maven:
Updated keycloak/pom.xml to avoid unnecessary plugin execution in IDE
VSCode:
Added .vscode/settings.json for Java configuration
7. Code Cleanup
Removed unused imports from:
backend/attachments/src/test/java/org/eclipse/sw360/attachments/TestAttachmentClient.java
Minor formatting improvements
Behavior Changes
LICENSEDB_ONLY Mode:
LEGACY Mode:
SPDX Import:
Issue
Related to: #3781
This PR contributes to making LicenseDB the single source of truth for license and obligation data in SW360.
Suggest Reviewer
@GMishx
@deo002
How To Test
Set:
sw360.license.source.mode=LICENSEDB_ONLY
Verify:
Set:
sw360.license.source.mode=LEGACY
Verify:
Trigger SPDX import:
Run locally:
docker-compose up
Verify CouchDB works
Run Keycloak tests:
Validate org mapping behavior
Checklist
Must: