Socket
Socket
Sign inDemoInstall

snyk-to-html

Package Overview
Dependencies
21
Maintainers
1
Versions
55
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.9.2 to 1.10.0

dist/lib/types.d.ts

3

dist/index.js

@@ -15,2 +15,3 @@ #!/usr/bin/env node

.option('-d, --debug', 'Runs the CLI in debug mode')
.option('-a, --actionable-remediation', 'Display actionable remediation info if available')
.parse(process.argv);

@@ -46,3 +47,3 @@ let template;

}
snyk_to_html_1.SnykToHtml.run(source, template, !!program.summary, onReportOutput);
snyk_to_html_1.SnykToHtml.run(source, !!program.actionableRemediation, template, !!program.summary, onReportOutput);
function onReportOutput(report) {

@@ -49,0 +50,0 @@ if (output) {

#!/usr/bin/env node
declare class SnykToHtml {
static run(dataSource: string, hbsTemplate: string, summary: boolean, reportCallback: (value: string) => void): void;
static runAsync(source: string, template: string, summary: boolean): Promise<string>;
static run(dataSource: string, remediation: boolean, hbsTemplate: string, summary: boolean, reportCallback: (value: string) => void): void;
static runAsync(source: string, remediation: boolean, template: string, summary: boolean): Promise<string>;
}
export { SnykToHtml };
#!/usr/bin/env node
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const _ = require("@snyk/lodash");
const chalk_1 = require("chalk");

@@ -8,8 +9,7 @@ const debugModule = require("debug");

const Handlebars = require("handlebars");
const _ = require("lodash");
const marked = require("marked");
const moment = require("moment");
const path = require("path");
const vuln_1 = require("./vuln");
const debug = debugModule('snyk-to-html');
const severityMap = { low: 0, medium: 1, high: 2 };
const defaultRemediationText = '## Remediation\nThere is no remediation at the moment';

@@ -48,13 +48,13 @@ function readFile(filePath, encoding) {

class SnykToHtml {
static run(dataSource, hbsTemplate, summary, reportCallback) {
static run(dataSource, remediation, hbsTemplate, summary, reportCallback) {
SnykToHtml
.runAsync(dataSource, hbsTemplate, summary)
.runAsync(dataSource, remediation, hbsTemplate, summary)
.then(reportCallback)
.catch(handleInvalidJson);
}
static async runAsync(source, template, summary) {
static async runAsync(source, remediation, template, summary) {
const promisedString = source ? readFile(source, 'utf8') : readInputFromStdin();
return promisedString
.then(promisedParseJSON)
.then(data => processData(data, template, summary));
.then(data => processData(data, remediation, template, summary));
}

@@ -70,3 +70,3 @@ }

severity: vuln.severity,
severityValue: severityMap[vuln.severity],
severityValue: vuln_1.severityMap[vuln.severity],
description: vuln.description || 'No description available.',

@@ -109,3 +109,8 @@ fixedIn: vuln.fixedIn,

}
async function generateTemplate(data, template, summary) {
async function generateTemplate(data, template, remediation, summary) {
if (remediation && data.remediation) {
data.showRemediations = remediation;
data.unresolved = groupVulns(data.remediation.unresolved);
data.upgrades = vuln_1.getUpgrades(data.remediation.upgrade, data.vulnerabilities);
}
const vulnMetadata = groupVulns(data.vulnerabilities);

@@ -119,2 +124,4 @@ const sortedVulns = _.orderBy(vulnMetadata.vulnerabilities, ['metadata.severityValue', 'metadata.name'], ['desc', 'desc']);

await registerPeerPartial(template, 'vuln-card');
await registerPeerPartial(template, 'actionable-remediations');
await registerPeerPartial(template, 'remediation-card');
const htmlTemplate = await compileTemplate(template);

@@ -137,5 +144,5 @@ return htmlTemplate(data);

}
async function processData(data, template, summary) {
async function processData(data, remediation, template, summary) {
const mergedData = Array.isArray(data) ? mergeData(data) : data;
return generateTemplate(mergedData, template, summary);
return generateTemplate(mergedData, template, remediation, summary);
}

@@ -142,0 +149,0 @@ async function readInputFromStdin() {

@@ -27,3 +27,3 @@ {

"handlebars": "^4.7.3",
"lodash": "^4.17.15",
"@snyk/lodash": "^4.17.15-patch",
"marked": "^0.8.1",

@@ -58,3 +58,3 @@ "moment": "^2.24.0",

},
"version": "1.9.2"
"version": "1.10.0"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc