shield-llm 0.16.1 → 0.17.0

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.
@@ -1357,6 +1357,7 @@ function describeNotExecuted(byCategory, categories = NOT_EXECUTED_CATEGORIES) {
1357
1357
 
1358
1358
  // ../../packages/shared/src/attack-error.ts
1359
1359
  var MAX_ATTACK_ERROR_ITEMS = 50;
1360
+ var MAX_ATTACK_ERROR_WIRE_ITEMS = 2500;
1360
1361
  function categorizeAttackError(error, rateLimited) {
1361
1362
  if (rateLimited) return "rate_limited";
1362
1363
  if (error?.startsWith(NOT_JUDGED_PREFIX)) return "judge_error";
@@ -1379,7 +1380,7 @@ function categorizeAttackError(error, rateLimited) {
1379
1380
  if (/\b4\d\d\b/.test(e)) return "blocked";
1380
1381
  return "other";
1381
1382
  }
1382
- function summarizeAttackErrors(attacks) {
1383
+ function summarizeAttackErrors(attacks, itemCap = MAX_ATTACK_ERROR_ITEMS) {
1383
1384
  const all = [];
1384
1385
  const byCategory = {};
1385
1386
  for (const a of attacks) {
@@ -1392,7 +1393,7 @@ function summarizeAttackErrors(attacks) {
1392
1393
  const items = [
1393
1394
  ...all.filter((it) => it.category === "judge_error"),
1394
1395
  ...all.filter((it) => it.category !== "judge_error")
1395
- ].slice(0, MAX_ATTACK_ERROR_ITEMS);
1396
+ ].slice(0, itemCap);
1396
1397
  return { total: all.length, byCategory, items };
1397
1398
  }
1398
1399
 
@@ -9536,7 +9537,7 @@ function parseImportFile(textContent, format) {
9536
9537
  }
9537
9538
 
9538
9539
  // package.json
9539
- var version = "0.16.1";
9540
+ var version = "0.17.0";
9540
9541
 
9541
9542
  // src/config/schema.ts
9542
9543
  import { z as z3 } from "zod";
@@ -11279,65 +11280,17 @@ var Scanner = class {
11279
11280
  });
11280
11281
  }
11281
11282
  }
11282
- for (const customTest of customTests) {
11283
- const resumed = done.get(`custom_${customTest.name}`);
11284
- if (resumed) {
11285
- results.push(resumed);
11286
- this.emit({
11287
- type: "attack:complete",
11288
- result: resumed,
11289
- index: attackIndex,
11290
- total: totalAttacks
11291
- });
11292
- attackIndex++;
11293
- continue;
11294
- }
11295
- if (authFailed) {
11296
- const skip = {
11297
- id: `custom_${customTest.name}`,
11298
- name: customTest.name,
11299
- severity: customTestSeverity(customTest),
11300
- vulnerable: false,
11301
- prompt: customTest.prompt,
11302
- response: "",
11303
- durationMs: 0,
11304
- error: SKIP_AUTH
11305
- };
11306
- results.push(skip);
11307
- this.emit({
11308
- type: "attack:complete",
11309
- result: skip,
11310
- index: attackIndex,
11311
- total: totalAttacks
11312
- });
11313
- attackIndex++;
11314
- continue;
11315
- }
11316
- this.emit({
11317
- type: "attack:start",
11318
- attack: {
11319
- id: `custom_${customTest.name}`,
11320
- name: customTest.name,
11321
- severity: customTestSeverity(customTest)
11322
- },
11323
- index: attackIndex,
11324
- total: totalAttacks
11325
- });
11326
- const result = await this.executeCustomTest(customTest);
11327
- results.push(result);
11328
- await store?.record(result);
11329
- if (result.authFailed) authFailed = true;
11330
- this.emit({
11331
- type: "attack:complete",
11332
- result,
11333
- index: attackIndex,
11334
- total: totalAttacks
11335
- });
11336
- attackIndex++;
11337
- if (attackIndex < totalAttacks && this.currentDelayMs > 0) {
11338
- await sleep(this.currentDelayMs);
11339
- }
11340
- }
11283
+ const custom = await this.runCustomTests(
11284
+ customTests,
11285
+ done,
11286
+ store,
11287
+ attackIndex,
11288
+ totalAttacks,
11289
+ authFailed
11290
+ );
11291
+ results.push(...custom.results);
11292
+ authFailed = custom.authFailed;
11293
+ attackIndex += customTests.length;
11341
11294
  const recovery = await rejudgePass(results, {
11342
11295
  evaluator: this.evaluator,
11343
11296
  inputs: this.rejudgeInputs,
@@ -11602,6 +11555,102 @@ var Scanner = class {
11602
11555
  // ──────────────────────────────────────────────
11603
11556
  // Custom Test Execution
11604
11557
  // ──────────────────────────────────────────────
11558
+ /**
11559
+ * Custom tests through the same adaptive pool as the single-turn attacks
11560
+ * (lot C slice 3): they ran one at a time, so an account's 300 tests took
11561
+ * 300 target round trips and 300 judge calls end to end. Up to the
11562
+ * current AIMD cap run at once (`concurrency`, 1 with an MCP harness); a
11563
+ * 429 shrinks it as in the attack phase. Results keep the tests' order.
11564
+ * Refused credentials stop new launches and the rest are skipped; a
11565
+ * breaker trip or throttle keeps its historical behaviour here (custom
11566
+ * tests still run).
11567
+ */
11568
+ async runCustomTests(customTests, done, store, firstIndex, totalAttacks, authFailedBefore) {
11569
+ let authFailed = authFailedBefore;
11570
+ const out = new Array(
11571
+ customTests.length
11572
+ );
11573
+ const pending = [];
11574
+ customTests.forEach((test, i) => {
11575
+ const resumed = done.get(`custom_${test.name}`);
11576
+ if (!resumed) {
11577
+ pending.push(i);
11578
+ return;
11579
+ }
11580
+ out[i] = resumed;
11581
+ this.emit({
11582
+ type: "attack:complete",
11583
+ result: resumed,
11584
+ index: firstIndex + i,
11585
+ total: totalAttacks
11586
+ });
11587
+ });
11588
+ this.inConcurrentPhase = true;
11589
+ let next = 0;
11590
+ await new Promise((resolve2, reject) => {
11591
+ let active = 0;
11592
+ const pump = () => {
11593
+ while (active < this.aimdLimit && next < pending.length && !authFailed) {
11594
+ const idx = pending[next++];
11595
+ active++;
11596
+ void this.runOneCustomTest(
11597
+ customTests[idx],
11598
+ firstIndex + idx,
11599
+ totalAttacks,
11600
+ store
11601
+ ).then((result) => {
11602
+ out[idx] = result;
11603
+ if (result.authFailed) authFailed = true;
11604
+ active--;
11605
+ pump();
11606
+ }, reject);
11607
+ }
11608
+ if (active === 0 && (next >= pending.length || authFailed)) resolve2();
11609
+ };
11610
+ pump();
11611
+ });
11612
+ this.inConcurrentPhase = false;
11613
+ customTests.forEach((test, i) => {
11614
+ if (out[i]) return;
11615
+ const skip = {
11616
+ id: `custom_${test.name}`,
11617
+ name: test.name,
11618
+ severity: customTestSeverity(test),
11619
+ vulnerable: false,
11620
+ prompt: test.prompt,
11621
+ response: "",
11622
+ durationMs: 0,
11623
+ error: SKIP_AUTH
11624
+ };
11625
+ out[i] = skip;
11626
+ this.emit({
11627
+ type: "attack:complete",
11628
+ result: skip,
11629
+ index: firstIndex + i,
11630
+ total: totalAttacks
11631
+ });
11632
+ });
11633
+ return { results: out, authFailed };
11634
+ }
11635
+ /** One custom test in the pool: pace, send, judge, record, report. */
11636
+ async runOneCustomTest(test, index, totalAttacks, store) {
11637
+ this.emit({
11638
+ type: "attack:start",
11639
+ attack: {
11640
+ id: `custom_${test.name}`,
11641
+ name: test.name,
11642
+ severity: customTestSeverity(test)
11643
+ },
11644
+ index,
11645
+ total: totalAttacks
11646
+ });
11647
+ if (this.currentDelayMs > 0) await sleep(this.currentDelayMs);
11648
+ const result = await this.executeCustomTest(test);
11649
+ await store?.record(result);
11650
+ if (!result.error && !result.rateLimited) this.handleSuccess();
11651
+ this.emit({ type: "attack:complete", result, index, total: totalAttacks });
11652
+ return result;
11653
+ }
11605
11654
  async executeCustomTest(test) {
11606
11655
  const startTime = Date.now();
11607
11656
  const session = this.targetClient.createSession();
@@ -13270,6 +13319,8 @@ export {
13270
13319
  NOT_EXECUTED_CATEGORIES,
13271
13320
  formatShareAboveLimit,
13272
13321
  describeNotExecuted,
13322
+ MAX_ATTACK_ERROR_ITEMS,
13323
+ MAX_ATTACK_ERROR_WIRE_ITEMS,
13273
13324
  summarizeAttackErrors,
13274
13325
  serializeAttack,
13275
13326
  deserializeAttack,
package/dist/cli.js CHANGED
@@ -19,6 +19,8 @@ import {
19
19
  IMPORT_SOURCES,
20
20
  JUDGE_OUTAGE_REASON_PREFIX,
21
21
  LAYER_META,
22
+ MAX_ATTACK_ERROR_ITEMS,
23
+ MAX_ATTACK_ERROR_WIRE_ITEMS,
22
24
  MUTATORS,
23
25
  McpHarness,
24
26
  NOT_EXECUTED_CATEGORIES,
@@ -91,7 +93,7 @@ import {
91
93
  summarizeObfuscationVariants,
92
94
  version,
93
95
  withoutScoredApartVariants
94
- } from "./chunk-SLKNCJV5.js";
96
+ } from "./chunk-24WGTB3E.js";
95
97
 
96
98
  // src/load-env.ts
97
99
  var PROTECTED_ENV_KEYS = [
@@ -988,6 +990,44 @@ function buildRetestOutcome(results, findingByResultId) {
988
990
  }
989
991
  return outcome;
990
992
  }
993
+ var VERIFY_BATCH_ITEMS = 200;
994
+ var VERIFY_BATCH_BYTES = 3.5 * 1024 * 1024;
995
+ function verifyBatches(entries, maxItems = VERIFY_BATCH_ITEMS, maxBytes = VERIFY_BATCH_BYTES) {
996
+ const batches = [];
997
+ let batch = [];
998
+ let bytes = 0;
999
+ for (const e of entries) {
1000
+ const size = Buffer.byteLength(JSON.stringify(e), "utf8") + 1;
1001
+ if (batch.length > 0 && (batch.length >= maxItems || bytes + size > maxBytes)) {
1002
+ batches.push(batch);
1003
+ batch = [];
1004
+ bytes = 0;
1005
+ }
1006
+ batch.push(e);
1007
+ bytes += size;
1008
+ }
1009
+ if (batch.length > 0) batches.push(batch);
1010
+ return batches;
1011
+ }
1012
+ async function postVerifyBatches(entries, post) {
1013
+ let total = null;
1014
+ let sent = 0;
1015
+ for (const batch of verifyBatches(entries)) {
1016
+ const res = await post(batch);
1017
+ if (!res.ok) {
1018
+ const error = sent > 0 ? `${res.error} (${sent} of ${entries.length} verdicts were recorded before it)` : res.error;
1019
+ return { response: total, error };
1020
+ }
1021
+ total = {
1022
+ updated: (total?.updated ?? 0) + res.response.updated,
1023
+ fixed: (total?.fixed ?? 0) + res.response.fixed,
1024
+ stillVulnerable: (total?.stillVulnerable ?? 0) + res.response.stillVulnerable,
1025
+ notFound: [...total?.notFound ?? [], ...res.response.notFound]
1026
+ };
1027
+ sent += batch.length;
1028
+ }
1029
+ return { response: total, error: null };
1030
+ }
991
1031
  function emptyNeighbourPlan() {
992
1032
  return { extraAttacks: [], byFinding: /* @__PURE__ */ new Map() };
993
1033
  }
@@ -1959,31 +1999,48 @@ async function retestCommand(scanId, opts) {
1959
1999
  let verify = null;
1960
2000
  let verifyError = null;
1961
2001
  if (outcome.verifications.length > 0) {
1962
- try {
1963
- const res = await fetch(
1964
- `${credentials.apiUrl}/api/cli/reports/${encodeURIComponent(scanId)}/verify`,
1965
- {
1966
- method: "POST",
1967
- headers: {
1968
- "Content-Type": "application/json",
1969
- Authorization: `Bearer ${credentials.apiKey}`
1970
- },
1971
- body: JSON.stringify({
1972
- targetUrl: shownTarget,
1973
- results: outcome.verifications
1974
- })
2002
+ let suspended = false;
2003
+ const sent = await postVerifyBatches(
2004
+ outcome.verifications,
2005
+ async (batch) => {
2006
+ try {
2007
+ const res = await fetch(
2008
+ `${credentials.apiUrl}/api/cli/reports/${encodeURIComponent(scanId)}/verify`,
2009
+ {
2010
+ method: "POST",
2011
+ headers: {
2012
+ "Content-Type": "application/json",
2013
+ Authorization: `Bearer ${credentials.apiKey}`
2014
+ },
2015
+ body: JSON.stringify({
2016
+ targetUrl: shownTarget,
2017
+ results: batch
2018
+ })
2019
+ }
2020
+ );
2021
+ if (await reportIfSuspended(res, credentials.apiUrl)) {
2022
+ suspended = true;
2023
+ return { ok: false, error: "account suspended" };
2024
+ }
2025
+ if (!res.ok) {
2026
+ const body = await res.text().catch(() => "");
2027
+ return {
2028
+ ok: false,
2029
+ error: `HTTP ${res.status}: ${body.slice(0, 200)}`
2030
+ };
2031
+ }
2032
+ return { ok: true, response: await res.json() };
2033
+ } catch (err) {
2034
+ return {
2035
+ ok: false,
2036
+ error: err instanceof Error ? err.message : "Unknown error"
2037
+ };
1975
2038
  }
1976
- );
1977
- if (await reportIfSuspended(res, credentials.apiUrl)) return;
1978
- if (!res.ok) {
1979
- const body = await res.text().catch(() => "");
1980
- verifyError = `HTTP ${res.status}: ${body.slice(0, 200)}`;
1981
- } else {
1982
- verify = await res.json();
1983
2039
  }
1984
- } catch (err) {
1985
- verifyError = err instanceof Error ? err.message : "Unknown error";
1986
- }
2040
+ );
2041
+ if (suspended) return;
2042
+ verify = sent.response;
2043
+ verifyError = sent.error;
1987
2044
  }
1988
2045
  const fixed = outcome.verifications.filter((v) => !v.vulnerable);
1989
2046
  const stillVulnerable = outcome.verifications.filter((v) => v.vulnerable);
@@ -3116,37 +3173,112 @@ function incompleteScan(report, judged, total, budgetReason = null) {
3116
3173
  }
3117
3174
 
3118
3175
  // src/commands/scan.ts
3119
- function buildUploadVulnerabilities(attacks) {
3120
- return scoredAttacks(attacks).map((a) => ({
3121
- // attackId lets the backend validate against its known catalogue + the
3122
- // user's custom tests, rejecting fabricated vulnerability rows.
3123
- attackId: a.id,
3124
- name: a.name,
3125
- severity: a.severity,
3126
- vulnerabilityType: a.id,
3127
- vulnerable: a.vulnerable,
3128
- description: a.name,
3129
- evidence: a.prompt && a.response ? JSON.stringify({
3130
- prompt: a.prompt,
3131
- response: excerpt(a.response, 2e3)
3132
- }) : a.response ? JSON.stringify({
3133
- prompt: "",
3134
- response: excerpt(a.response, 2e3)
3135
- }) : void 0,
3136
- status: a.vulnerable ? "DETECTED" : "PASSED",
3137
- evaluationMethod: a.llmEvaluation?.evaluationMethod,
3138
- // The judge that produced this verdict (backend meta.judgeId): the server
3139
- // composes the scan's judgeVersion from these instead of guessing.
3140
- judgeId: a.llmEvaluation?.judgeId,
3141
- confidence: a.llmEvaluation?.confidence,
3142
- reasoning: a.llmEvaluation?.reasoning,
3143
- captureStatus: a.captureStatus ?? "captured",
3144
- // Problems outside this attack's target, as the server's judge bounded
3145
- // them. Absent when there are none (and from an older server).
3146
- ...a.llmEvaluation?.incidental?.length && {
3147
- incidentalFindings: a.llmEvaluation.incidental
3176
+ function buildUploadVulnerabilities(attacks, responseMax = {
3177
+ detected: 2e3,
3178
+ passed: 2e3
3179
+ }) {
3180
+ return scoredAttacks(attacks).map((a) => {
3181
+ const keep = a.vulnerable ? responseMax.detected : responseMax.passed;
3182
+ return {
3183
+ // attackId lets the backend validate against its known catalogue + the
3184
+ // user's custom tests, rejecting fabricated vulnerability rows.
3185
+ attackId: a.id,
3186
+ name: a.name,
3187
+ severity: a.severity,
3188
+ vulnerabilityType: a.id,
3189
+ vulnerable: a.vulnerable,
3190
+ description: a.name,
3191
+ evidence: a.prompt && a.response ? JSON.stringify({
3192
+ prompt: a.prompt,
3193
+ response: excerpt(a.response, keep)
3194
+ }) : a.response ? JSON.stringify({
3195
+ prompt: "",
3196
+ response: excerpt(a.response, keep)
3197
+ }) : void 0,
3198
+ status: a.vulnerable ? "DETECTED" : "PASSED",
3199
+ evaluationMethod: a.llmEvaluation?.evaluationMethod,
3200
+ // The judge that produced this verdict (backend meta.judgeId): the server
3201
+ // composes the scan's judgeVersion from these instead of guessing.
3202
+ judgeId: a.llmEvaluation?.judgeId,
3203
+ confidence: a.llmEvaluation?.confidence,
3204
+ reasoning: a.llmEvaluation?.reasoning,
3205
+ captureStatus: a.captureStatus ?? "captured",
3206
+ // Problems outside this attack's target, as the server's judge bounded
3207
+ // them. Absent when there are none (and from an older server).
3208
+ ...a.llmEvaluation?.incidental?.length && {
3209
+ incidentalFindings: a.llmEvaluation.incidental
3210
+ }
3211
+ };
3212
+ });
3213
+ }
3214
+ function buildUploadAttackErrors(attacks) {
3215
+ const summary = summarizeAttackErrors(attacks, MAX_ATTACK_ERROR_WIRE_ITEMS);
3216
+ return summary ? { items: summary.items, complete: true } : void 0;
3217
+ }
3218
+ var UPLOAD_BYTE_BUDGET = 9.5 * 1024 * 1024;
3219
+ var EVIDENCE_STEPS = [
3220
+ { detected: 2e3, passed: 2e3 },
3221
+ { detected: 2e3, passed: 200 },
3222
+ { detected: 1e3, passed: 200 },
3223
+ { detected: 500, passed: 200 },
3224
+ { detected: 200, passed: 200 }
3225
+ ];
3226
+ function buildUploadPayload(report, scanId, attackPackVersion) {
3227
+ const testsRun = scoredAttacks(report.attacks).length;
3228
+ const attackErrors = buildUploadAttackErrors(report.attacks);
3229
+ let payload;
3230
+ for (const responseMax of EVIDENCE_STEPS) {
3231
+ payload = {
3232
+ scanId,
3233
+ targetUrl: report.target,
3234
+ chatbotType: "api",
3235
+ summary: `CLI scan \u2014 ${report.config.preset} preset \u2014 ${testsRun}/${report.config.totalAttacks} tests`,
3236
+ testsRun,
3237
+ testsTotal: report.config.totalAttacks,
3238
+ durationMs: report.durationMs,
3239
+ preset: report.config.preset,
3240
+ ...attackPackVersion && { attackPackVersion },
3241
+ ...attackErrors && { attackErrors },
3242
+ vulnerabilities: buildUploadVulnerabilities(report.attacks, responseMax)
3243
+ };
3244
+ if (Buffer.byteLength(JSON.stringify(payload)) <= UPLOAD_BYTE_BUDGET) break;
3245
+ }
3246
+ return payload;
3247
+ }
3248
+ var BUSY_TRIES = 6;
3249
+ var BUSY_MIN_TOTAL_MS = 13e4;
3250
+ var BUSY_HARD_TRIES = 12;
3251
+ var BUSY_MAX_WAIT_MS = 12e4;
3252
+ var BUSY_DEFAULT_WAIT_MS = 3e4;
3253
+ async function postWithBusyRetry(post, sleep2 = (ms) => new Promise((r) => setTimeout(r, ms)), random = Math.random) {
3254
+ let res = await post();
3255
+ let waited = 0;
3256
+ for (let tries = 1; res.status === 503 && tries < BUSY_HARD_TRIES && (tries < BUSY_TRIES || waited < BUSY_MIN_TOTAL_MS); tries += 1) {
3257
+ const after = Number(res.headers.get("retry-after"));
3258
+ const base = Number.isFinite(after) && after > 0 ? after * 1e3 : BUSY_DEFAULT_WAIT_MS;
3259
+ const wait = Math.min(Math.round(base * (0.5 + random())), BUSY_MAX_WAIT_MS);
3260
+ await res.text().catch(() => void 0);
3261
+ await sleep2(wait);
3262
+ waited += wait;
3263
+ res = await post();
3264
+ }
3265
+ return res;
3266
+ }
3267
+ function slowUploadMessage(status) {
3268
+ if (status !== 504) return null;
3269
+ return "The upload took longer than the server allows (120 s) to arrive. Check the network connection between this machine and the server, then run the same command again: the scan resumes from its checkpoint.";
3270
+ }
3271
+ function refusedLongErrorList(status, body) {
3272
+ return status === 400 && body.includes("attackErrors");
3273
+ }
3274
+ function withLegacyErrorList(payload) {
3275
+ if (!payload.attackErrors) return payload;
3276
+ return {
3277
+ ...payload,
3278
+ attackErrors: {
3279
+ items: payload.attackErrors.items.slice(0, MAX_ATTACK_ERROR_ITEMS)
3148
3280
  }
3149
- }));
3281
+ };
3150
3282
  }
3151
3283
  var INCOMPLETE_CODES = /* @__PURE__ */ new Set(["judge_unavailable", "not_executed"]);
3152
3284
  var NOT_STORED_CODE = "no_verdict";
@@ -3175,32 +3307,22 @@ var IncompleteRejection = class extends Error {
3175
3307
  var NotStoredRejection = class extends Error {
3176
3308
  };
3177
3309
  async function uploadReportToBackend(report, credentials, scanId, attackPackVersion) {
3178
- const vulnerabilities = buildUploadVulnerabilities(report.attacks);
3179
- const testsRun = scoredAttacks(report.attacks).length;
3180
- const attackErrorSummary = summarizeAttackErrors(report.attacks);
3181
- const payload = {
3182
- scanId,
3183
- targetUrl: report.target,
3184
- chatbotType: "api",
3185
- summary: `CLI scan \u2014 ${report.config.preset} preset \u2014 ${testsRun}/${report.config.totalAttacks} tests`,
3186
- testsRun,
3187
- testsTotal: report.config.totalAttacks,
3188
- durationMs: report.durationMs,
3189
- preset: report.config.preset,
3190
- ...attackPackVersion && { attackPackVersion },
3191
- ...attackErrorSummary && {
3192
- attackErrors: { items: attackErrorSummary.items }
3193
- },
3194
- vulnerabilities
3195
- };
3196
- const res = await fetch(`${credentials.apiUrl}/api/cli/reports`, {
3310
+ const payload = buildUploadPayload(report, scanId, attackPackVersion);
3311
+ const post = (body) => fetch(`${credentials.apiUrl}/api/cli/reports`, {
3197
3312
  method: "POST",
3198
3313
  headers: {
3199
3314
  "Content-Type": "application/json",
3200
3315
  Authorization: `Bearer ${credentials.apiKey}`
3201
3316
  },
3202
- body: JSON.stringify(payload)
3317
+ body: JSON.stringify(body)
3203
3318
  });
3319
+ let res = await postWithBusyRetry(() => post(payload));
3320
+ if (res.status === 400) {
3321
+ const refusal2 = await res.clone().text().catch(() => "");
3322
+ if (refusedLongErrorList(res.status, refusal2)) {
3323
+ res = await postWithBusyRetry(() => post(withLegacyErrorList(payload)));
3324
+ }
3325
+ }
3204
3326
  if (!res.ok) {
3205
3327
  if (await isAccountSuspended(res)) {
3206
3328
  await res.text().catch(() => void 0);
@@ -3211,6 +3333,8 @@ async function uploadReportToBackend(report, credentials, scanId, attackPackVers
3211
3333
  if (incomplete) throw new IncompleteRejection(incomplete);
3212
3334
  const notStored = notStoredRejection(res.status, body);
3213
3335
  if (notStored) throw new NotStoredRejection(notStored);
3336
+ const slow = slowUploadMessage(res.status);
3337
+ if (slow) throw new Error(slow);
3214
3338
  throw new Error(
3215
3339
  `HTTP ${res.status}: ${printableServerText(body.slice(0, 200))}`
3216
3340
  );
@@ -3275,8 +3399,9 @@ function resolveMutateSelection(value) {
3275
3399
  const unknown = [];
3276
3400
  for (const id of ids) {
3277
3401
  const m = getMutator(id);
3278
- if (m) mutators.push(m);
3279
- else unknown.push(id);
3402
+ if (m) {
3403
+ if (!mutators.includes(m)) mutators.push(m);
3404
+ } else unknown.push(id);
3280
3405
  }
3281
3406
  return { mutators, unknown };
3282
3407
  }
package/dist/index.js CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  formatSarif,
9
9
  loadConfig,
10
10
  loadSystemPrompt
11
- } from "./chunk-SLKNCJV5.js";
11
+ } from "./chunk-24WGTB3E.js";
12
12
  export {
13
13
  ConfigError,
14
14
  ConfigSchema,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shield-llm",
3
- "version": "0.16.1",
3
+ "version": "0.17.0",
4
4
  "description": "AI chatbot security scanner — automated red teaming for LLMs",
5
5
  "type": "module",
6
6
  "publishConfig": {