shield-llm 0.5.3 → 0.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-CWJWN44I.js → chunk-S2OWXRK6.js} +5 -1
- package/dist/cli.js +28 -6
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { createRequire as __cjs_createRequire } from "module"; import { fileURLToPath as __cjs_fileURLToPath } from "url"; import { dirname as __cjs_dirname } from "path"; const __filename = __cjs_fileURLToPath(import.meta.url); const __dirname = __cjs_dirname(__filename); const require = __cjs_createRequire(import.meta.url);
|
|
2
2
|
|
|
3
|
+
// package.json
|
|
4
|
+
var version = "0.5.4";
|
|
5
|
+
|
|
3
6
|
// src/config/schema.ts
|
|
4
7
|
import { z as z2 } from "zod";
|
|
5
8
|
|
|
@@ -9052,7 +9055,7 @@ function formatSarif(report) {
|
|
|
9052
9055
|
tool: {
|
|
9053
9056
|
driver: {
|
|
9054
9057
|
name: "Shield LLM",
|
|
9055
|
-
version
|
|
9058
|
+
version,
|
|
9056
9059
|
informationUri: "https://shield-llm.com",
|
|
9057
9060
|
rules: vulnerableAttacks.map((a) => {
|
|
9058
9061
|
const structured = getStructuredRemediation(a.id);
|
|
@@ -9115,6 +9118,7 @@ function buildMessage(attack) {
|
|
|
9115
9118
|
}
|
|
9116
9119
|
|
|
9117
9120
|
export {
|
|
9121
|
+
version,
|
|
9118
9122
|
summarizeAttackErrors,
|
|
9119
9123
|
deserializeAttack,
|
|
9120
9124
|
deserializeMultiTurnAttack,
|
package/dist/cli.js
CHANGED
|
@@ -26,8 +26,9 @@ import {
|
|
|
26
26
|
parseSegmentKey,
|
|
27
27
|
parseSnapshot,
|
|
28
28
|
resolveOfflinePosition,
|
|
29
|
-
summarizeAttackErrors
|
|
30
|
-
|
|
29
|
+
summarizeAttackErrors,
|
|
30
|
+
version
|
|
31
|
+
} from "./chunk-S2OWXRK6.js";
|
|
31
32
|
|
|
32
33
|
// src/load-env.ts
|
|
33
34
|
try {
|
|
@@ -38,9 +39,6 @@ try {
|
|
|
38
39
|
// src/cli.ts
|
|
39
40
|
import { Command, CommanderError } from "commander";
|
|
40
41
|
|
|
41
|
-
// package.json
|
|
42
|
-
var version = "0.5.3";
|
|
43
|
-
|
|
44
42
|
// src/credentials.ts
|
|
45
43
|
import {
|
|
46
44
|
readFileSync,
|
|
@@ -1997,6 +1995,21 @@ function sanitizeReportForDisk(report, opts = {}) {
|
|
|
1997
1995
|
};
|
|
1998
1996
|
}
|
|
1999
1997
|
|
|
1998
|
+
// src/lib/output-path.ts
|
|
1999
|
+
var FORMAT_EXTENSIONS = {
|
|
2000
|
+
json: ".json",
|
|
2001
|
+
markdown: ".md",
|
|
2002
|
+
sarif: ".sarif",
|
|
2003
|
+
pdf: ".pdf"
|
|
2004
|
+
};
|
|
2005
|
+
function alignOutputExtension(file, format) {
|
|
2006
|
+
const ext = FORMAT_EXTENSIONS[format];
|
|
2007
|
+
if (!ext) return { path: file, changed: false };
|
|
2008
|
+
if (file.toLowerCase().endsWith(ext)) return { path: file, changed: false };
|
|
2009
|
+
const path = file.replace(/\.[^./\\]+$/, "") + ext;
|
|
2010
|
+
return { path, changed: path !== file };
|
|
2011
|
+
}
|
|
2012
|
+
|
|
2000
2013
|
// src/commands/scan.ts
|
|
2001
2014
|
async function uploadReportToBackend(report, credentials, scanId, attackPackVersion) {
|
|
2002
2015
|
const vulnerabilities = report.attacks.filter((a) => !a.error && !a.rateLimited).map((a) => ({
|
|
@@ -2366,7 +2379,16 @@ async function scanCommand(opts) {
|
|
|
2366
2379
|
}
|
|
2367
2380
|
}
|
|
2368
2381
|
const format = config.output?.format ?? opts.output;
|
|
2369
|
-
|
|
2382
|
+
let outputFile = config.output?.file ?? opts.outputFile;
|
|
2383
|
+
if (outputFile && format && opts.output && !opts.outputFile) {
|
|
2384
|
+
const aligned = alignOutputExtension(outputFile, format);
|
|
2385
|
+
if (aligned.changed) {
|
|
2386
|
+
info(
|
|
2387
|
+
`Output format is ${format}; writing to ${aligned.path} (config output.file was ${outputFile})`
|
|
2388
|
+
);
|
|
2389
|
+
outputFile = aligned.path;
|
|
2390
|
+
}
|
|
2391
|
+
}
|
|
2370
2392
|
if (format || outputFile) {
|
|
2371
2393
|
if (format === "pdf") {
|
|
2372
2394
|
const pdfPath = outputFile ?? `shield-report-${report.id.slice(0, 8)}.pdf`;
|
package/dist/index.js
CHANGED