Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: N|Solid CI

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
CI:
name: CI with N|Solid ${{ matrix.nsolid-version }} (Node ${{ matrix.node-version }})
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18, 20, 22]
nsolid-version: [5]
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: Setup N|Solid ${{ matrix.node-version }}
uses: nodesource/setup-nsolid@v1
with:
node-version: ${{ matrix.node-version }}
nsolid-version: ${{ matrix.nsolid-version }}
- run: nsolid -vv
- run: npm ci || npm install
- run: npm run test

50 changes: 25 additions & 25 deletions commands/report.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,56 +139,56 @@ async function report (argv, _dir) {
const isNested = pkgName === nestedPkgName && pkgVersion === nestedPkgVersion

// Processing packages from NCM service
let includedCount = 0;
let skippedCount = 0;
// let includedCount = 0
// let skippedCount = 0

for (const { name, version, scores, published } of data) {
let maxSeverity = 0;
let license = {};
const failures = [];
let maxSeverity = 0
let license = {}
const failures = []

for (const score of scores) {
const severityValue = SEVERITY_RMAP.indexOf(score.severity);
const severityValue = SEVERITY_RMAP.indexOf(score.severity)

if (score.group !== 'compliance' &&
score.group !== 'security' &&
score.group !== 'risk') {
continue;
continue
}

if (severityValue > maxSeverity) {
maxSeverity = severityValue;
maxSeverity = severityValue
}

if (score.pass === false) {
failures.push(score);
hasFailures = true;
failures.push(score)
hasFailures = true
}

if (score.name === 'license') {
license = score;
license = score
}
}

// Modified approach to include ALL packages in the report
// Even packages with null/undefined versions will be included with a default version
let effectiveVersion = version;
let effectiveVersion = version
if (effectiveVersion === null || effectiveVersion === undefined) {
effectiveVersion = '0.0.0';
effectiveVersion = '0.0.0'
// Using default version 0.0.0 for package
}

// Skip nested packages with severity issues
if (isNested && !!maxSeverity) {
skippedCount++;
// skippedCount++
// Skipping nested package
continue;
continue
}

// Check if license has failed, which should upgrade to critical severity
const getLicenseScore = ({ pass }) => pass === false ? 0 : null;
// const getLicenseScore = ({ pass }) => pass === false ? 0 : null
if (license && license.pass === false) {
maxSeverity = 4;
maxSeverity = 4
}

// Add the package to our report
Expand All @@ -200,19 +200,19 @@ async function report (argv, _dir) {
failures,
license,
scores
});
includedCount++;
})

// includedCount++
}

// Package processing complete

pkgScores = moduleSort(pkgScores)

// Process whitelisted packages
const whitelisted = pkgScores.filter(pkg => whitelist.has(`${pkg.name}@${pkg.version}`))
.map(pkgScore => ({ ...pkgScore, quantitativeScore: score(pkgScore.scores, pkgScore.maxSeverity) }))

// Filter out whitelisted packages from the main package list
pkgScores = pkgScores.filter(pkg => !whitelist.has(`${pkg.name}@${pkg.version}`))
.map(pkgScore => ({ ...pkgScore, quantitativeScore: score(pkgScore.scores, pkgScore.maxSeverity) }))
Expand Down
Loading