Skip to content
Merged
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
20 changes: 8 additions & 12 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "secure-inline-scan-action",
"version": "6.2.0",
"version": "6.2.1",
"description": "This actions performs image analysis on locally built container image and posts the result of the analysis to Sysdig Secure.",
"main": "index.js",
"scripts": {
Expand Down
12 changes: 5 additions & 7 deletions src/domain/scanresult/ScanResult.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export class ScanResult {
private readonly policies: Map<string, Policy> = new Map();
private readonly policyBundles: Map<string, PolicyBundle> = new Map();
private readonly acceptedRisks: Map<string, AcceptedRisk> = new Map();
private readonly evaluationResult: EvaluationResult;

constructor(
public readonly scanType: ScanType,
Expand All @@ -44,7 +45,8 @@ export class ScanResult {
sizeInBytes: bigint,
architecture: Architecture,
labels: Record<string, string>,
createdAt: Date
createdAt: Date,
evaluationResult: EvaluationResult
) {
this.metadata = new Metadata(
pullString,
Expand All @@ -56,6 +58,7 @@ export class ScanResult {
labels,
createdAt
);
this.evaluationResult = evaluationResult;
}

addLayer(digest: string, index: number, size: bigint | null, command: string): Layer {
Expand Down Expand Up @@ -196,11 +199,6 @@ export class ScanResult {
}

getEvaluationResult(): EvaluationResult {
for (const policy of this.getPolicies()) {
if (policy.getEvaluationResult().isFailed()) {
return EvaluationResult.Failed;
}
}
return EvaluationResult.Passed;
return this.evaluationResult;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
// Helper interfaces to provide better typing than `any` for vulnerabilities and risks
export class JsonScanResultV1ToScanResultAdapter {
public toScanResult(report: JsonScanResultV1): ScanResult {
const scanResult = this.createScanResult(report.result.metadata);
const scanResult = this.createScanResult(report);
const reportResult = report.result;

this.addLayers(reportResult, scanResult);
Expand All @@ -29,7 +29,8 @@ export class JsonScanResultV1ToScanResultAdapter {
return scanResult;
}

private createScanResult(metadata: ReportMetadata): ScanResult {
private createScanResult(report: JsonScanResultV1): ScanResult {
const metadata = report.result.metadata;
return new ScanResult(
ScanType.Docker, // Assuming Docker scan type as in the Rust code
metadata.pullString,
Expand All @@ -39,7 +40,8 @@ export class JsonScanResultV1ToScanResultAdapter {
BigInt(metadata.size),
Architecture.fromString(metadata.architecture),
metadata.labels ?? {},
new Date(metadata.createdAt)
new Date(metadata.createdAt),
EvaluationResult.fromString(report.result.policies.globalEvaluation)
);
}

Expand Down
Loading
Loading