Compare commits
No commits in common. "main" and "v1.0.1" have entirely different histories.
47
index.js
47
index.js
@ -25,53 +25,40 @@ async function readAudit() {
|
||||
|
||||
|
||||
const severities = {
|
||||
info: 'LOW',
|
||||
low: 'LOW',
|
||||
moderate: 'MEDIUM',
|
||||
high: 'MEDIUM',
|
||||
critical: 'HIGH',
|
||||
info: 'INFO',
|
||||
low: 'MINOR',
|
||||
moderate: 'MINOR',
|
||||
high: 'CRITICAL',
|
||||
critical: 'BLOCKER',
|
||||
};
|
||||
|
||||
|
||||
async function main() {
|
||||
const pnpmAudit = await readAudit()
|
||||
const rules = []
|
||||
const issues = []
|
||||
for (const advice of Object.values(pnpmAudit.advisories || [])) {
|
||||
rules.push({
|
||||
id: `${advice.id}`,
|
||||
name: advice.github_advisory_id || advice.npm_advisory_id || `rule_${advice.id}`,
|
||||
description: `<h1>${advice.module_name} ${advice.vulnerable_versions}</h1>
|
||||
<h2>${advice.title || ''}</h2>
|
||||
issues.push({
|
||||
"engineId": "pnpm-audit",
|
||||
"ruleId": advice.id,
|
||||
"severity": severities[advice.severity],
|
||||
"type": "VULNERABILITY",
|
||||
"efforMinutes": 0,
|
||||
"primaryLocation": {
|
||||
"message": `${advice.module_name} ${advice.vulnerable_versions}
|
||||
${advice.title || ''}
|
||||
|
||||
Overview:
|
||||
<pre>
|
||||
${advice.overview || ''}
|
||||
</pre>
|
||||
|
||||
References:
|
||||
<pre>
|
||||
${advice.references || ''}
|
||||
</pre>
|
||||
`,
|
||||
cleanCodeAttribute: "TRUSTWORTHY",
|
||||
engineId: "pnpm-audit",
|
||||
impacts: [{
|
||||
softwareQuality: "SECURITY",
|
||||
severity: severities[advice.severity],
|
||||
}]
|
||||
})
|
||||
issues.push({
|
||||
ruleId: `${advice.id}`,
|
||||
efforMinutes: 0,
|
||||
primaryLocation: {
|
||||
message: advice.title,
|
||||
filePath: "pnpm-lock.yaml",
|
||||
"filePath": "pnpm-lock.yaml",
|
||||
},
|
||||
secondaryLocations: []
|
||||
"secondaryLocations": []
|
||||
})
|
||||
}
|
||||
console.log(JSON.stringify({ rules, issues }, null, 2))
|
||||
console.log(JSON.stringify({ issues }, null, 2))
|
||||
}
|
||||
|
||||
main()
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "pnpm-audit-sonar",
|
||||
"version": "1.1.0",
|
||||
"version": "1.0.1",
|
||||
"description": "Convert PNPM audit to Sonar compatible format",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
Loading…
x
Reference in New Issue
Block a user