Skip to content

Commit

Permalink
chore: update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
fraxken committed Aug 5, 2024
1 parent 049cfc9 commit f6dc22a
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 31 deletions.
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"@nodesecure/eslint-config": "^1.9.0",
"@types/lodash.set": "^4.3.9",
"@types/mock-fs": "^4.13.4",
"@types/node": "^20.11.5",
"@types/node": "^22.1.0",
"@types/pluralize": "^0.0.33",
"@types/sade": "^1.7.8",
"cross-env": "^7.0.3",
Expand All @@ -73,20 +73,20 @@
"eslint-plugin-prettier": "^5.1.3",
"mock-fs": "^5.2.0",
"prettier": "^3.2.4",
"rimraf": "^5.0.5",
"rimraf": "^6.0.1",
"ts-node": "^10.9.2",
"typescript": "^5.0.4"
},
"dependencies": {
"@nodesecure/i18n": "^3.5.0",
"@nodesecure/js-x-ray": "^6.3.0",
"@nodesecure/rc": "^1.5.0",
"@nodesecure/scanner": "^5.3.0",
"@nodesecure/i18n": "^4.0.1",
"@nodesecure/js-x-ray": "^7.3.0",
"@nodesecure/rc": "^3.0.0",
"@nodesecure/scanner": "^6.0.1",
"@nodesecure/vulnera": "^1.8.0",
"@openally/result": "^1.2.0",
"@slimio/async-cli-spinner": "^0.5.2",
"ajv": "^8.12.0",
"glob": "^10.3.10",
"glob": "^11.0.0",
"kleur": "^4.1.5",
"lodash.set": "^4.3.2",
"pluralize": "^8.0.0",
Expand Down
4 changes: 2 additions & 2 deletions src/analysis/extraction/extract.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// Import Third-party Dependencies
import { Scanner } from "@nodesecure/scanner";
import * as Scanner from "@nodesecure/scanner";
import { Strategy } from "@nodesecure/vuln";

// Import Internal Dependencies
import type { DependencyWarning } from "../types";

export interface CompactedScannerPayload {
warnings: Scanner.GlobalWarning[];
warnings: string[];
dependencies: {
warnings: DependencyWarning[];
vulnerabilities: WorkableVulnerability[];
Expand Down
3 changes: 1 addition & 2 deletions src/analysis/interpretation/checkable.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// Import Third-party Dependencies
import { Scanner } from "@nodesecure/scanner";
import { Strategy } from "@nodesecure/vuln";

// Import Internal Dependencies
Expand All @@ -17,7 +16,7 @@ export type CheckableFunction<T> = {

export type PipelineCheckFunctions = Array<
() => CheckableFunction<
Scanner.GlobalWarning | DependencyWarning | Strategy.StandardVulnerability
string | DependencyWarning | Strategy.StandardVulnerability
>
>;

Expand Down
8 changes: 5 additions & 3 deletions src/analysis/interpretation/interpret.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { describe, it } from "node:test";

// Import Third-party Dependencies
import * as JSXRay from "@nodesecure/js-x-ray";
import { Scanner } from "@nodesecure/scanner";
import * as Scanner from "@nodesecure/scanner";
import { Strategy } from "@nodesecure/vuln";

// Import Internal Dependencies
Expand Down Expand Up @@ -35,7 +35,9 @@ const kDefaultScannerPayload: Scanner.Payload = {
rootDependencyName: "pkg",
warnings: [],
dependencies: {},
flaggedAuthors: [],
highlighted: {
contacts: []
},
scannerVersion: "1.0.0",
vulnerabilityStrategy: "npm"
};
Expand All @@ -58,7 +60,7 @@ describe("Pipeline check workflow", () => {
it("should make the pipeline fail", () => {
const scannerPayload: Scanner.Payload = {
...kDefaultScannerPayload,
warnings: [["warning1"], ["warning2"]]
warnings: ["warning1", "warning2"]
};

const { status } = runPayloadInterpreter(
Expand Down
4 changes: 2 additions & 2 deletions src/analysis/interpretation/interpret.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Import Third-party Dependencies
import type { Warning } from "@nodesecure/js-x-ray";
import type { Scanner } from "@nodesecure/scanner";
import * as Scanner from "@nodesecure/scanner";
import set from "lodash.set";

// Import Internal Dependencies
Expand Down Expand Up @@ -29,7 +29,7 @@ import {
} from "./warnings.js";

export interface InterpretedScannerPayload {
warnings: Scanner.GlobalWarning;
warnings: string[];
dependencies: {
warnings: DependencyWarningWithMode[];
vulnerabilities: WorkableVulnerability[];
Expand Down
4 changes: 2 additions & 2 deletions src/analysis/interpretation/vulnerabilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ const kSeverities = {
low: 1,
info: 0,
all: 0
};
} as const;

const kDefaultSeverity = 0;

function fromSeverityToNumber(
severity: Maybe<Strategy.Severity | "all">
severity: Maybe<"info" | "low" | "medium" | "high" | "critical" | "all">
): number {
if (severity !== undefined) {
return kSeverities[severity];
Expand Down
5 changes: 2 additions & 3 deletions src/analysis/interpretation/warnings.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Import Third-party Dependencies
import { Warning } from "@nodesecure/js-x-ray";
import type { Scanner } from "@nodesecure/scanner";
import { match } from "ts-pattern";

// Import Internal Dependencies
Expand All @@ -11,8 +10,8 @@ import type { DependencyWarning } from "../types";
import { fromBooleanToCheckResult, CheckableFunction } from "./checkable.js";

export function checkGlobalWarnings(
warnings: Scanner.GlobalWarning[]
): CheckableFunction<Scanner.GlobalWarning> {
warnings: string[]
): CheckableFunction<string> {
return {
result: fromBooleanToCheckResult(warnings.length > 0),
data: {
Expand Down
1 change: 1 addition & 0 deletions src/analysis/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Import Third-party Dependencies
import { Warning } from "@nodesecure/js-x-ray";

export type DependencyWarning = {
Expand Down
8 changes: 4 additions & 4 deletions src/reporting/reporters/internal/scanner.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Import Third-party Dependencies
import { Logger, Scanner, ScannerLoggerEvents } from "@nodesecure/scanner";
import { Logger, Payload, ScannerLoggerEvents } from "@nodesecure/scanner";
import Spinner from "@slimio/async-cli-spinner";
import pluralize from "pluralize";
import ms from "pretty-ms";
Expand Down Expand Up @@ -72,7 +72,7 @@ export function reportScannerLoggerEvents(logger: Logger): void {
});
}

function reportScannerDependencies(payload: Scanner.Payload): void {
function reportScannerDependencies(payload: Payload): void {
const { dependencies } = payload;
const numberOfDeps = Object.keys(dependencies).length;
consolePrinter.util
Expand All @@ -89,10 +89,10 @@ function reportScannerDependencies(payload: Scanner.Payload): void {
function reportScannerAnalysis(_payload: unknown): (log: Logger) => Generator {
return function* report(
logger: Logger
): Generator<undefined, never, Scanner.Payload> {
): Generator<undefined, never, Payload> {
while (true) {
reportScannerLoggerEvents(logger);
reportScannerDependencies((yield) as Scanner.Payload);
reportScannerDependencies((yield) as Payload);
}
};
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// Import Third-party Dependencies
import { Scanner } from "@nodesecure/scanner";
import pluralize from "pluralize";

// Import Internal Dependencies
Expand All @@ -11,7 +10,7 @@ import { Nsci } from "../../../../configuration/index.js";

import { buildOutcomeStatsConsoleMessage } from "./util.js";

export function reportGlobalWarnings(warnings: Scanner.GlobalWarning): void {
export function reportGlobalWarnings(warnings: string[]): void {
if (warnings.length > 0) {
consolePrinter.font
.error(
Expand Down
7 changes: 3 additions & 4 deletions src/reporting/run.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Import Third-party Dependencies
import * as scanner from "@nodesecure/scanner";
import type { Scanner } from "@nodesecure/scanner";
import * as Scanner from "@nodesecure/scanner";
import * as vuln from "@nodesecure/vuln";

// Import Internal Dependencies
Expand Down Expand Up @@ -35,13 +34,13 @@ async function runScannerAnalysis(
* data for reporting to the Generator.
*/
const initScannerReporter = scannerReporter.report(void 0);
const logger = new scanner.Logger();
const logger = new Scanner.Logger();
const sequentialReporterWithLogger = initScannerReporter(logger);

// First step of the reporting
sequentialReporterWithLogger.next();

const payload = await scanner.cwd(
const payload = await Scanner.cwd(
runtimeConfig.rootDir,
{
vulnerabilityStrategy: strategy
Expand Down

0 comments on commit f6dc22a

Please sign in to comment.