umax / trivy-plugin-sonarqube Goto Github PK
View Code? Open in Web Editor NEWA Trivy plugin that converts JSON report to SonarQube format
License: Apache License 2.0
A Trivy plugin that converts JSON report to SonarQube format
License: Apache License 2.0
Hi
I know it´s not related to the plugin but i would like to know if you had sucess uploading the reports to sonarqube.
I dont have erros but external issues are being ignored by the scanner.
./trivy image -f json -o results.json nexus-12:8443/maven3-trivy-scanner:qual
./trivy sonarqube results.json > sonarqube.json
./trivy sonarqube sonarqube.json -- filePath=Dockerfile > sonarqube.json
sonar-scanner -Dsonar.login= -Dsonar.password= -Dsonar.projectKey=otrs-ticket-admin-web-qual -Dsonar.projectKey=otrs-ticket-admin-web-qual -Dsonar.sources=.
-Dsonar.externalIssuesReportPaths=C:\Users\Herman.Maleiane\Downloads\sonar-scanner-4.8.0.2856-windows\bin\sonarqube.json
Imported 0 issues in 0 files
INFO: External issues ignored for 1 unknown files, including: Dockerfile
INFO: Sensor Import external issues report (done) | time=74ms
{
"issues": [
{
"engineId": "Trivy",
"ruleId": "CVE-2011-3374",
"type": "VULNERABILITY",
"severity": "MINOR",
"primaryLocation": {
"message": "It was found that apt-key in apt, all versions, do not correctly validate gpg keys with the master keyring, leading to a potential man-in-the-middle attack.",
"filePath": "Dockerfile"
}
},
{
"engineId": "Trivy",
"ruleId": "CVE-2019-18276",
"type": "VULNERABILITY",
"severity": "MINOR",
"primaryLocation": {
"message": "An issue was discovered in disable_priv_mode in shell.c in GNU Bash through 5.0 patch 11. By default, if Bash is run with its effective UID not equal to its real UID, it will drop privileges by setting its effective UID to its real UID. However, it does so incorrectly. On Linux and other systems that support \"saved UID\" functionality, the saved UID is not dropped. An attacker with command execution in the shell can use \"enable -f\" for runtime loading of a new builtin, which can be a shared object that calls setuid() and therefore regains privileges. However, binaries running with an effective UID of 0 are unaffected.",
"filePath": "Dockerfile"
}
}
The problem is in the attribute filepath
Thanks in advance
Trivy version 0.49.1
SonarQube version 10.4
After converting trivy filesystem report and running sonar-scanner
- it gives Warning that report format is deprecated.
INFO: Sensor Import external issues report
WARN: External issues were imported with a deprecated format which will be removed soon. Please switch to the newest format to fully benefit from Clean Code: https://docs.sonarsource.com/sonarqube/10.4/analyzing-source-code/importing-external-issues/generic-issue-import-format/
INFO: Imported 5 issues in 1 file
INFO: Sensor Import external issues report (done) | time=29ms
I successfully use this on my Linux nodes but have problems on the windows ones. I get the following error when I try to use it.
plugin error: exit: fork/exec C:\Windows\system32\config\systemprofile\.trivy\plugins\sonarqube\sonarqube.py: %1 is not a valid Win32 application.
09:32:18 At D:\Jenkins_data\workspace\bkslb\sonar-test@tmp\durable-375653e6\powershellWrapper.ps1:3 char:1
09:32:18 + & powershell -NoProfile -NonInteractive -ExecutionPolicy Bypass -Comm ...
09:32:18 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
09:32:18 + CategoryInfo : NotSpecified: (Error: plugin e...32 application.:String) [], RemoteException
09:32:18 + FullyQualifiedErrorId : NativeCommandError
09:32:18
09:32:18 Usage:
09:32:18 trivy sonarqube [flags]
...
Python is installed and is in the PATH environment variable. I'm severly limited when it comes to windows :-) The only thing I can imagine is the shebang
#!/usr/bin/env python3
It looks very 'Linuxy'
Happy for any help I can get
/Thomas
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.