SonarQube Plugin leveraging the SCANOSS Java SDK to perform scans, compatible with SonarQube 10.x.
- High Precision Snippet Matching (HPSM)
- SBOM Ingestion
- Copyleft License Count
- Copyright Declarations Count
- Vulnerability Count
- Undeclared Components
NOTE: Some information may require a SCANOSS Premium subscription.
To build the plugin JAR file, call:
mvn clean package
The JAR will be deployed to target/scanoss-sonar-plugin-VERSION.jar
. Copy this to your SonarQube's extensions/plugins/
directory, and re-start SonarQube.
Once the plugin has been copied into SonarQube, restart Sonar and proceed to configure the SCANOSS plugin as needed.
- Scan API URL : SCANOSS API Endpoint with format "http(s)://host:ip".
- Scan API Token: SCANOSS API token.
- Custom Certificate Chain: The custom certificate chain pem value.
- SCANOSS SBOM IDENTIFY: SCANOSS SBOM identify filename. Default: blank (disabled).
- SCANOSS SBOM IGNORE: SCANOSS SBOM ignore filename. Default: blank (disabled).
- SCANOSS HPSM: Use High Precision Snippet Matching algorithm (Only available with premium subscription).
NOTE: SBOM IDENTIFY and SBOM IGNORE are mutually exclusive, and only property SBOM IDENTIFY will be considered if both are set.
The plugin identifies Undeclared Components that are not listed in the SBOM IDENTIFY file.
To activate this feature, ensure that you have configured the SBOM IDENTIFY file and set up the following Quality Profile.
- Navigate to the Quality Profile tab.
- In the desired language section, create a new profile named "SCANOSS Way".
- Within the "SCANOSS Way" profile, include a new activity.
- Search for the "Undeclared Component" activity in the SCANOSS Analyser repository.
- Activate the "Undeclared Component" activity to add it to the "SCANOSS Way" profile.
- Navigate to your project.
- Click on Project Settings and select Quality Profiles option.
- Click on "Add language".
- Choose "text" language and select "SCANOSS Way" profile.
To run a scan, execute the following command:
export SONARQUBE_URL=host.docker.internal:9000
export PROJECT_KEY=[PROJECT_KEY]
export myAuthenticationToken=[AUTH_TOKEN]
docker run \
--rm \
--add-host=host.docker.internal:host-gateway \
-e SONAR_HOST_URL="http://${SONARQUBE_URL}" \
-e SONAR_SCANNER_OPTS="-Dsonar.projectKey=${PROJECT_KEY}" \
-e SONAR_TOKEN="${myAuthenticationToken}" \
-v "$(pwd):/usr/src" \
sonarsource/sonar-scanner-cli -Dsonar.java.binaries=target
Access to the Sonar Web API requires a user-type token. Refer to the SonarQube API documentation https://next.sonarqube.com/sonarqube/web_api.
Following header in your request is required: Authorization: Bearer [TOKEN]
-
This endpoint lists all available metrics and can be filtered to find all SCANOSS metrics
https://{SONARQUBE_URL}/api/metrics/search?ps=500
-
This endpoint shows details of the given metrics
https://{SONARQUBE_URL}/api/measures/component?component=integration-sonarqube&metricKeys=copyleft_license_count,copyright_count,vulnerability_count
-
This endpoint allows searching of created issues given a Rule ID
https://{SONARQUBE_URL}/api/issues/search?rules=SCANOSS:UndeclaredComponent