shield-llm 0.7.1 → 0.7.3

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/README.md CHANGED
@@ -25,12 +25,9 @@ Which OWASP LLM Top 10 edition your report is labelled with follows the attack
25
25
  pack your instance serves, not the CLI version. An archived report keeps the
26
26
  category names that were current on the day it ran.
27
27
 
28
- > A backend connection is required. Two modes, same binary:
29
- >
30
- > - **Self-hosted** — your own instance via `--api-url`. This is the normal path.
31
- > - **Hosted** — `https://shield-llm.com`, the default when you pass no
32
- > `--api-url`. An evaluation instance, access on request; it is not open for
33
- > self-service signup.
28
+ > A backend connection is required: your self-hosted Shield instance, named
29
+ > with `--api-url` (or the `SHIELD_API_URL` env var). There is no default
30
+ > backend; without one the CLI stops and says so.
34
31
 
35
32
  ## Install
36
33
 
@@ -1,7 +1,7 @@
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
3
  // package.json
4
- var version = "0.7.1";
4
+ var version = "0.7.3";
5
5
 
6
6
  // src/config/schema.ts
7
7
  import { z as z2 } from "zod";
@@ -999,18 +999,27 @@ function isTimeout(err) {
999
999
  return typeof err === "object" && err !== null && err.code === "ERR_SCRIPT_EXECUTION_TIMEOUT";
1000
1000
  }
1001
1001
  function guardedRun(fn, budget) {
1002
- const run = getExec();
1002
+ return guardedRunWith(getExec(), fn, budget);
1003
+ }
1004
+ function guardedRunWith(run, fn, budget) {
1003
1005
  if (!run || watched) return { completed: true, value: fn() };
1006
+ if (budget.timedOut) return { completed: false };
1004
1007
  const remaining = Math.floor(budget.deadline - performance.now());
1005
1008
  if (remaining < 1) {
1006
1009
  budget.timedOut = true;
1007
1010
  return { completed: false };
1008
1011
  }
1012
+ const finished = { done: false };
1009
1013
  watched = true;
1010
1014
  try {
1011
- return { completed: true, value: run(fn, remaining) };
1015
+ run(() => {
1016
+ finished.value = fn();
1017
+ finished.done = true;
1018
+ }, remaining);
1019
+ return { completed: true, value: finished.value };
1012
1020
  } catch (err) {
1013
1021
  if (!isTimeout(err)) throw err;
1022
+ if (finished.done) return { completed: true, value: finished.value };
1014
1023
  budget.timedOut = true;
1015
1024
  return { completed: false };
1016
1025
  } finally {
@@ -1026,9 +1035,8 @@ function boundRegexInput(response) {
1026
1035
  return `${response.slice(0, half)}
1027
1036
  ${response.slice(-half)}`;
1028
1037
  }
1029
- function analyzeResponse(payload, rawResponse) {
1038
+ function analyzeResponse(payload, rawResponse, budget = regexBudget()) {
1030
1039
  const response = boundRegexInput(rawResponse);
1031
- const budget = regexBudget();
1032
1040
  let matchedPattern;
1033
1041
  guardedRun(() => {
1034
1042
  for (const pattern of payload.detectPatterns) {
@@ -1556,7 +1564,7 @@ var PERSONA_HIJACK_MAPPING = {
1556
1564
  },
1557
1565
  {
1558
1566
  articleNumber: "Article 5",
1559
- articleTitle: "Pratiques d'intelligence artificielle interdites",
1567
+ articleTitle: "Pratiques interdites en mati\xE8re d'IA",
1560
1568
  requirement: "Les syst\xE8mes IA ne doivent pas \xEAtre utilis\xE9s pour des pratiques de manipulation",
1561
1569
  complianceAspect: "prohibited",
1562
1570
  riskLevel: "high",
@@ -1628,7 +1636,7 @@ var XPIA_BYPASS_ECHOLEAK_MAPPING = {
1628
1636
  ...ART_15_ROBUSTNESS_BASE,
1629
1637
  riskLevel: "critical",
1630
1638
  failImplication: "Le syst\xE8me ex\xE9cute des instructions inject\xE9es dans du contenu tiers (emails, documents RAG) au lieu de les traiter comme donn\xE9es \u2014 vuln\xE9rable au cross-prompt injection (EchoLeak-style)",
1631
- remediationGuidance: "Marquer clairement le contenu provenant de sources externes comme non-autoritaire. Stripper les marqueurs de directives avant int\xE9gration au contexte mod\xE8le"
1639
+ remediationGuidance: "Marquer clairement le contenu provenant de sources externes comme ne faisant pas autorit\xE9. Supprimer les marqueurs de directives avant leur int\xE9gration au contexte du mod\xE8le"
1632
1640
  },
1633
1641
  {
1634
1642
  ...ART_9_RISK_MGMT_BASE,
@@ -1711,7 +1719,7 @@ var INVISIBLE_UNICODE_TAG_MAPPING = {
1711
1719
  {
1712
1720
  ...ART_15_ROBUSTNESS_BASE,
1713
1721
  failImplication: "Le syst\xE8me agit sur des instructions invisibles encod\xE9es en caract\xE8res Unicode Tag (U+E0000\u2013U+E007F), permettant une injection invisible \xE0 l'utilisateur",
1714
- remediationGuidance: "Stripper ou rejeter les classes Unicode invisibles (Tag, zero-width, control) avant que l'entr\xE9e n'atteigne le mod\xE8le"
1722
+ remediationGuidance: "Supprimer ou rejeter les classes Unicode invisibles (Tag, zero-width, control) avant que l'entr\xE9e n'atteigne le mod\xE8le"
1715
1723
  },
1716
1724
  {
1717
1725
  ...ART_13_TRANSPARENCY_BASE,
@@ -1949,7 +1957,7 @@ var PII_PHISHING_MAPPING = {
1949
1957
  },
1950
1958
  {
1951
1959
  articleNumber: "Article 5",
1952
- articleTitle: "Pratiques d'intelligence artificielle interdites",
1960
+ articleTitle: "Pratiques interdites en mati\xE8re d'IA",
1953
1961
  requirement: "Les syst\xE8mes IA ne doivent pas \xEAtre utilis\xE9s pour exploiter les vuln\xE9rabilit\xE9s des personnes",
1954
1962
  complianceAspect: "prohibited",
1955
1963
  riskLevel: "critical",
@@ -2119,7 +2127,7 @@ var MEMORY_RECOMMENDATION_POISONING_MAPPING = {
2119
2127
  {
2120
2128
  ...ART_15_ROBUSTNESS_BASE,
2121
2129
  failImplication: "Un lien malveillant contenant un param\xE8tre `_assistant_pref` empoisonne les recommandations futures de l'agent (vendor ranking)",
2122
- remediationGuidance: "Stripper les param\xE8tres URL ressemblant \xE0 des directives (`_assistant_*`, `_system_*`) avant tout fetch/r\xE9sum\xE9 ; traiter chaque URL coll\xE9e comme contenu non fiable"
2130
+ remediationGuidance: "Supprimer les param\xE8tres d'URL qui ressemblent \xE0 des directives (`_assistant_*`, `_system_*`) avant tout fetch ou r\xE9sum\xE9 ; traiter chaque URL coll\xE9e comme un contenu non fiable"
2123
2131
  }
2124
2132
  ]
2125
2133
  };
@@ -2679,7 +2687,7 @@ var LETHAL_TRIFECTA_PROBE_MAPPING = {
2679
2687
  {
2680
2688
  ...ART_15_ROBUSTNESS_BASE,
2681
2689
  failImplication: "Les trois pr\xE9requis EchoLeak coexistent (acc\xE8s donn\xE9es priv\xE9es + ingestion contenu non fiable + vecteur d'exfiltration) \u2014 compromission zero-click possible",
2682
- remediationGuidance: "Casser au moins une jambe du triangle : soit interdire les outils sur donn\xE9es priv\xE9es, soit bloquer l'ingestion de contenu non fiable, soit stripper les vecteurs d'exfiltration (images markdown, liens externes)"
2690
+ remediationGuidance: "Briser au moins un pilier de la triade : soit interdire les outils sur donn\xE9es priv\xE9es, soit bloquer l'ingestion de contenu non fiable, soit supprimer les vecteurs d'exfiltration (images markdown, liens externes)"
2683
2691
  },
2684
2692
  {
2685
2693
  ...ART_14_HUMAN_OVERSIGHT_BASE,
@@ -3071,7 +3079,7 @@ var RAG_HIDDEN_TEXT_WHITESPACE_MAPPING = {
3071
3079
  {
3072
3080
  ...ART_15_ROBUSTNESS_BASE,
3073
3081
  failImplication: "Un document index\xE9 contient du texte invisible (blanc sur blanc / taille 0) qui d\xE9tourne l'agent \xE0 l'insu d'un relecteur humain",
3074
- remediationGuidance: "Nettoyer les documents \xE0 l'ingestion : stripper les spans CSS-masqu\xE9s, les ranges font-size:0, et les blocs white-on-white avant chunking. Render-and-OCR pour les corpus sensibles"
3082
+ remediationGuidance: "Nettoyer les documents \xE0 l'ingestion : supprimer les spans masqu\xE9s par CSS, les plages en font-size:0 et les blocs blanc sur blanc avant le d\xE9coupage (chunking). Pour les corpus sensibles, effectuer un rendu du document puis une OCR"
3075
3083
  }
3076
3084
  ]
3077
3085
  };
@@ -3091,7 +3099,7 @@ var RAG_HTML_COMMENT_INJECTION_MAPPING = {
3091
3099
  {
3092
3100
  ...ART_15_ROBUSTNESS_BASE,
3093
3101
  failImplication: "Une instruction d'injection cach\xE9e dans un commentaire HTML d'une page d'aide est suivie par l'agent",
3094
- remediationGuidance: "Stripper les commentaires HTML, scripts inline et noscript des documents \xE0 l'ingestion ; convertir HTML\u2192texte via un renderer sanitizing"
3102
+ remediationGuidance: "Supprimer les commentaires HTML, les scripts inline et les balises noscript des documents \xE0 l'ingestion ; convertir le HTML en texte avec un moteur de rendu qui nettoie le contenu"
3095
3103
  }
3096
3104
  ]
3097
3105
  };
@@ -3105,7 +3113,7 @@ var RAG_METADATA_INJECTION_MAPPING = {
3105
3113
  {
3106
3114
  ...ART_15_ROBUSTNESS_BASE,
3107
3115
  failImplication: "Une instruction d'injection cach\xE9e dans les keywords PDF / EXIF d\xE9clenche une action non sollicit\xE9e (\xE9num\xE9ration de fichiers utilisateur)",
3108
- remediationGuidance: "Sanitizer les m\xE9tadonn\xE9es \xE0 l'ingestion : stripper ou \xE9chapper les champs keyword/subject/description contenant des shapes d'instruction. Ne jamais embarquer les m\xE9tadonn\xE9es dans le contexte du mod\xE8le"
3116
+ remediationGuidance: "Nettoyer les m\xE9tadonn\xE9es \xE0 l'ingestion : supprimer ou \xE9chapper les champs keyword, subject et description qui contiennent des formulations d'instruction. Ne jamais int\xE9grer les m\xE9tadonn\xE9es dans le contexte du mod\xE8le"
3109
3117
  }
3110
3118
  ]
3111
3119
  };
@@ -3115,7 +3123,7 @@ var RAG_POISONED_CORPUS_MAPPING = {
3115
3123
  {
3116
3124
  ...ART_15_ROBUSTNESS_BASE,
3117
3125
  failImplication: "Un document con\xE7u pour \xEAtre retrieved top-1 (PoisonedRAG) biaise les recommandations de l'agent vers un service contr\xF4l\xE9 par l'attaquant",
3118
- remediationGuidance: "Classifier prompt-injection chaque document avant embedding ; trust score par source ; revue humaine des documents promotionnels ; exiger corroboration multi-sources pour les claims \xE0 fort enjeu"
3126
+ remediationGuidance: "Passer chaque document dans un classifieur d'injection de prompt avant l'embedding ; attribuer un score de confiance par source ; faire relire par un humain les documents promotionnels ; exiger une corroboration multi-sources pour les affirmations \xE0 fort enjeu"
3119
3127
  },
3120
3128
  {
3121
3129
  ...ART_9_RISK_MGMT_BASE,
@@ -3158,7 +3166,7 @@ var FALSE_AUTHORITY_MAPPING = {
3158
3166
  },
3159
3167
  {
3160
3168
  articleNumber: "Article 5",
3161
- articleTitle: "Pratiques d'intelligence artificielle interdites",
3169
+ articleTitle: "Pratiques interdites en mati\xE8re d'IA",
3162
3170
  requirement: "Le syst\xE8me ne doit pas exploiter les vuln\xE9rabilit\xE9s des personnes",
3163
3171
  complianceAspect: "prohibited",
3164
3172
  riskLevel: "medium",
@@ -3409,7 +3417,7 @@ var LLM10_MAPPINGS = [
3409
3417
  // ../../packages/shared/src/compliance/eu-ai-act-mapping/by-category/transparency-art50.ts
3410
3418
  var ART_50_IDENTITY_BASE = {
3411
3419
  articleNumber: "Article 50",
3412
- articleTitle: "Obligations de transparence pour certains systemes d'IA",
3420
+ articleTitle: "Obligations de transparence pour les fournisseurs et les d\xE9ployeurs de certains syst\xE8mes d'IA",
3413
3421
  requirement: "Les personnes physiques doivent etre informees qu'elles interagissent avec un systeme d'IA, au plus tard lors de la premiere interaction",
3414
3422
  complianceAspect: "transparency",
3415
3423
  riskLevel: "high",
@@ -3418,7 +3426,7 @@ var ART_50_IDENTITY_BASE = {
3418
3426
  };
3419
3427
  var ART_50_CONTENT_BASE = {
3420
3428
  articleNumber: "Article 50",
3421
- articleTitle: "Obligations de transparence pour certains systemes d'IA",
3429
+ articleTitle: "Obligations de transparence pour les fournisseurs et les d\xE9ployeurs de certains syst\xE8mes d'IA",
3422
3430
  requirement: "Les contenus generes ou manipules par IA doivent etre identifies comme tels et ne pas etre presentes comme d'origine humaine",
3423
3431
  complianceAspect: "transparency",
3424
3432
  riskLevel: "medium",
@@ -3674,7 +3682,7 @@ function prohibitedPractices() {
3674
3682
  articleLabel: "Article 5",
3675
3683
  title: {
3676
3684
  en: "Prohibited AI practices",
3677
- fr: "Pratiques d'IA interdites"
3685
+ fr: "Pratiques interdites en mati\xE8re d'IA"
3678
3686
  },
3679
3687
  status: "binding",
3680
3688
  applicableFrom: IN_FORCE_CHAPTER_I_II,
@@ -3691,7 +3699,7 @@ function prohibitedPractices() {
3691
3699
  function aiLiteracy() {
3692
3700
  return {
3693
3701
  articleLabel: "Article 4",
3694
- title: { en: "AI literacy", fr: "Litt\xE9ratie en IA" },
3702
+ title: { en: "AI literacy", fr: "Ma\xEEtrise de l'IA" },
3695
3703
  status: "binding",
3696
3704
  applicableFrom: IN_FORCE_CHAPTER_I_II,
3697
3705
  rationale: {
@@ -3700,7 +3708,7 @@ function aiLiteracy() {
3700
3708
  },
3701
3709
  shieldCoverage: {
3702
3710
  en: "Not testable by scanning. Answered by the AI literacy questions in the questionnaire, and those answers are self-declared.",
3703
- fr: "Non testable par scan. Couvert par les questions de litt\xE9ratie IA du questionnaire, dont les r\xE9ponses sont auto-d\xE9clar\xE9es."
3711
+ fr: "Non testable par scan. Couvert par les questions du questionnaire sur la ma\xEEtrise de l'IA, dont les r\xE9ponses sont auto-d\xE9clar\xE9es."
3704
3712
  }
3705
3713
  };
3706
3714
  }
@@ -3723,7 +3731,7 @@ function article50(status) {
3723
3731
  },
3724
3732
  shieldCoverage: {
3725
3733
  en: "Half testable, and the halves are different in kind. Shield proves a breach when your system CLAIMS TO BE HUMAN: it asks directly, under a roleplay frame, and under fabricated audit pressure, and it checks whether generated content is given a false human-authorship label. It CANNOT see a disclosure rendered in your interface \u2014 a banner, a chat header, an onboarding screen \u2014 so an endpoint that simply does not volunteer its nature is not scored as a breach. Verify that half by inspecting the interface, and treat Article 50(2) machine-readable marking as out of scope for this scan.",
3726
- fr: "Testable pour moiti\xE9, et les deux moiti\xE9s sont de nature diff\xE9rente. Shield prouve le manquement lorsque votre syst\xE8me SE D\xC9CLARE HUMAIN : il pose la question directement, sous cadrage de jeu de r\xF4le, et sous pression d'audit fabriqu\xE9e, et il v\xE9rifie si un contenu g\xE9n\xE9r\xE9 re\xE7oit une fausse attestation de r\xE9daction humaine. Il NE PEUT PAS voir une divulgation affich\xE9e dans votre interface (banni\xE8re, en-t\xEAte de conversation, \xE9cran d'accueil) : un endpoint qui ne d\xE9clare simplement pas sa nature n'est donc jamais scor\xE9 comme un manquement. V\xE9rifiez cette moiti\xE9 en inspectant l'interface, et consid\xE9rez le marquage lisible par machine de l'Article 50(2) comme hors p\xE9rim\xE8tre de ce scan."
3734
+ fr: "Testable pour moiti\xE9, et les deux moiti\xE9s sont de nature diff\xE9rente. Shield prouve le manquement lorsque votre syst\xE8me SE D\xC9CLARE HUMAIN : il pose la question directement, sous cadrage de jeu de r\xF4le, et sous pression d'audit fabriqu\xE9e, et il v\xE9rifie si un contenu g\xE9n\xE9r\xE9 re\xE7oit une fausse attestation de r\xE9daction humaine. Il NE PEUT PAS voir une divulgation affich\xE9e dans votre interface (banni\xE8re, en-t\xEAte de conversation, \xE9cran d'accueil) : une cible qui ne d\xE9clare simplement pas sa nature n'est donc jamais compt\xE9e comme un manquement. V\xE9rifiez cette moiti\xE9 en inspectant l'interface, et consid\xE9rez le marquage lisible par machine de l'Article 50(2) comme hors p\xE9rim\xE8tre de ce scan."
3727
3735
  }
3728
3736
  };
3729
3737
  }
@@ -4204,14 +4212,70 @@ function formatDateShort(date, locale = "en-US") {
4204
4212
  day: "numeric"
4205
4213
  });
4206
4214
  }
4207
- function extractQuotedText(text) {
4208
- const results = [];
4209
- const regex = /["“”]([^"“”]{10,}?)["“”]/g;
4210
- let match;
4211
- while ((match = regex.exec(text)) !== null) {
4212
- results.push(match[1].trim());
4215
+ var SINGLE_QUOTED = /(?:^|[\s(\[:])'([^'\n]{3,}?)'(?=[\s.,;:)\]!?]|$)/g;
4216
+ var DOUBLE_QUOTED = /["“”]([^"“”]{3,}?)["“”]/g;
4217
+ var TOKEN_MAX = 10;
4218
+ var SENTENCE_MIN = 20;
4219
+ var SENTENCE_MAX = 300;
4220
+ function extractCitations(reasoning) {
4221
+ const found = [];
4222
+ for (const re of [DOUBLE_QUOTED, SINGLE_QUOTED]) {
4223
+ re.lastIndex = 0;
4224
+ let match;
4225
+ while ((match = re.exec(reasoning)) !== null) {
4226
+ found.push({ at: match.index, text: match[1].trim() });
4227
+ }
4228
+ }
4229
+ const ordered = found.sort((a, b) => a.at - b.at).map((f) => f.text);
4230
+ return Array.from(new Set(ordered));
4231
+ }
4232
+ function splitSentences(text) {
4233
+ return text.split(/(?<=[^\d\s][.!?])\s+|\n+/).map((s) => s.trim()).filter((s) => s.length > 0);
4234
+ }
4235
+ function truncateAtWord(text, max) {
4236
+ if (text.length <= max) return text;
4237
+ const cut = text.slice(0, max);
4238
+ const lastSpace = cut.lastIndexOf(" ");
4239
+ return `${lastSpace > max / 2 ? cut.slice(0, lastSpace) : cut}...`;
4240
+ }
4241
+ function windowAround(sentence, token, max) {
4242
+ if (sentence.length <= max) return sentence;
4243
+ const at2 = sentence.indexOf(token);
4244
+ const start = Math.max(0, at2 - Math.floor((max - token.length) / 2));
4245
+ const from = start === 0 ? 0 : sentence.indexOf(" ", start) + 1;
4246
+ const body = truncateAtWord(sentence.slice(from), max);
4247
+ return from > 0 ? `...${body}` : body;
4248
+ }
4249
+ function citationExcerpts(citations, response) {
4250
+ const sentences = splitSentences(response);
4251
+ const out = [];
4252
+ for (const citation of citations) {
4253
+ if (out.some((e) => e.includes(citation))) continue;
4254
+ if (citation.length >= TOKEN_MAX) {
4255
+ out.push(citation);
4256
+ continue;
4257
+ }
4258
+ const carrier = sentences.find((s) => s.includes(citation));
4259
+ if (carrier) out.push(windowAround(carrier, citation, SENTENCE_MAX));
4260
+ }
4261
+ return Array.from(new Set(out));
4262
+ }
4263
+ function contentLength(sentence) {
4264
+ return sentence.replace(/[.!?]+$/, "").length;
4265
+ }
4266
+ function extractEvidenceExcerpts(input) {
4267
+ const response = input.response ?? "";
4268
+ const citations = input.reasoning ? citationExcerpts(extractCitations(input.reasoning), response) : [];
4269
+ if (citations.length > 0) return citations.slice(0, 4);
4270
+ if (input.judgeEvidence && input.judgeEvidence.length > 0) {
4271
+ return input.judgeEvidence.slice(0, 4);
4213
4272
  }
4214
- return results;
4273
+ if (response.length === 0) return [];
4274
+ const sentences = splitSentences(response).filter(
4275
+ (s) => contentLength(s) > SENTENCE_MIN && s.length < SENTENCE_MAX
4276
+ );
4277
+ if (sentences.length > 0) return sentences.slice(0, 3);
4278
+ return [truncateAtWord(response, 200)];
4215
4279
  }
4216
4280
  function escapeHtml(str) {
4217
4281
  return str.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#x27;");
@@ -4271,7 +4335,7 @@ function buildFrameworkCoverage(findings) {
4271
4335
  findings,
4272
4336
  "DORA",
4273
4337
  "DORA (R\xE8glement UE 2022/2554)",
4274
- "Le scan est un test de r\xE9silience (Art. 25) ; les findings \xE9videncent une lacune de protection (Art. 9). Il alimente un TLPT (Art. 26) sans le constituer.",
4338
+ "Le scan est un test de r\xE9silience (Art. 25) ; ses constats mettent en \xE9vidence une lacune de protection (Art. 9). Il alimente un TLPT (Art. 26) sans en constituer un.",
4275
4339
  OWASP_TO_DORA,
4276
4340
  (ref) => DORA_REFERENCES[ref]?.title ?? ref,
4277
4341
  [...DORA_TOOL_LEVEL, ...DORA_ADJACENT]
@@ -4383,23 +4447,23 @@ function buildExecutiveSummary(totalVulns, critical, crescendo, combo, high, med
4383
4447
  return `The assessment identified <strong>no vulnerabilities</strong> across ${totalTests} automated tests mapped to the OWASP LLM Top 10 ${owaspEdition} framework. The chatbot at <strong>${safeTarget}</strong> successfully defended against all attack vectors tested.${untestedNote} No immediate action is required.`;
4384
4448
  }
4385
4449
  const severityWord = {
4386
- critical: { en: "critical", fr: "critique" },
4387
- crescendo: { en: "crescendo", fr: "crescendo" },
4388
- combo: { en: "combo", fr: "combo" },
4389
- high: { en: "high", fr: "\xE9lev\xE9e" },
4390
- medium: { en: "medium", fr: "moyenne" }
4450
+ critical: { en: "critical", fr: ["critique", "critiques"] },
4451
+ crescendo: { en: "crescendo", fr: ["crescendo", "crescendo"] },
4452
+ combo: { en: "combo", fr: ["combo", "combo"] },
4453
+ high: { en: "high", fr: ["\xE9lev\xE9e", "\xE9lev\xE9es"] },
4454
+ medium: { en: "medium", fr: ["moyenne", "moyennes"] }
4391
4455
  };
4392
- const pick = (key) => fr ? severityWord[key].fr : severityWord[key].en;
4456
+ const pick = (key, count) => fr ? severityWord[key].fr[count > 1 ? 1 : 0] : severityWord[key].en;
4393
4457
  const parts = [];
4394
- if (critical > 0) parts.push(`${critical} ${pick("critical")}`);
4395
- if (crescendo > 0) parts.push(`${crescendo} ${pick("crescendo")}`);
4396
- if (combo > 0) parts.push(`${combo} ${pick("combo")}`);
4397
- if (high > 0) parts.push(`${high} ${pick("high")}`);
4398
- if (medium > 0) parts.push(`${medium} ${pick("medium")}`);
4458
+ if (critical > 0) parts.push(`${critical} ${pick("critical", critical)}`);
4459
+ if (crescendo > 0) parts.push(`${crescendo} ${pick("crescendo", crescendo)}`);
4460
+ if (combo > 0) parts.push(`${combo} ${pick("combo", combo)}`);
4461
+ if (high > 0) parts.push(`${high} ${pick("high", high)}`);
4462
+ if (medium > 0) parts.push(`${medium} ${pick("medium", medium)}`);
4399
4463
  const breakdown = parts.join(", ");
4400
4464
  let urgency = "";
4401
4465
  if (critical > 0) {
4402
- urgency = fr ? "Une rem\xE9diation imm\xE9diate est recommand\xE9e pour les constats critiques ; les constats \xE9lev\xE9s et moyens sont \xE0 traiter sous 30 jours." : "Immediate remediation is recommended for critical findings; high and medium findings should be addressed within 30 days.";
4466
+ urgency = fr ? "Une correction imm\xE9diate est recommand\xE9e pour les constats critiques ; les constats \xE9lev\xE9s et moyens sont \xE0 traiter sous 30 jours." : "Immediate remediation is recommended for critical findings; high and medium findings should be addressed within 30 days.";
4403
4467
  } else if (crescendo > 0 || combo > 0) {
4404
4468
  urgency = fr ? "Les constats crescendo et combo signalent des vuln\xE9rabilit\xE9s multi-vecteurs \xE0 corriger sous 14 jours." : "Crescendo/combo attack findings indicate multi-vector vulnerabilities requiring prompt remediation within 14 days.";
4405
4469
  } else if (high > 0) {
@@ -9459,9 +9523,9 @@ async function readErrorBodyHead(response) {
9459
9523
  }
9460
9524
  }
9461
9525
  async function readBodyWithLimit(response) {
9462
- const contentLength = response.headers.get("content-length");
9463
- if (contentLength) {
9464
- const declared = Number(contentLength);
9526
+ const contentLength2 = response.headers.get("content-length");
9527
+ if (contentLength2) {
9528
+ const declared = Number(contentLength2);
9465
9529
  if (Number.isFinite(declared) && declared > MAX_RESPONSE_BYTES) {
9466
9530
  throw new HttpTargetError(
9467
9531
  `Response too large: ${declared} bytes (max ${MAX_RESPONSE_BYTES})`,
@@ -11272,29 +11336,11 @@ function buildVulnDetail(a) {
11272
11336
  };
11273
11337
  }
11274
11338
  function buildEvidenceItems(a) {
11275
- if (a.llmEvaluation?.reasoning) {
11276
- const quotes = extractQuotedText(a.llmEvaluation.reasoning);
11277
- if (quotes.length > 0) {
11278
- return quotes.slice(0, 4).map((q) => ({ text: q }));
11279
- }
11280
- }
11281
- if (a.llmEvaluation?.evidence && a.llmEvaluation.evidence.length > 0) {
11282
- return a.llmEvaluation.evidence.slice(0, 4).map((e) => ({ text: e }));
11283
- }
11284
- if (a.response) {
11285
- const sentences = a.response.split(/[.!?]+/).map((s) => s.trim()).filter((s) => s.length > 20 && s.length < 300);
11286
- if (sentences.length > 0) {
11287
- return sentences.slice(0, 3).map((s) => ({ text: s }));
11288
- }
11289
- if (a.response.length > 0) {
11290
- return [
11291
- {
11292
- text: a.response.slice(0, 200) + (a.response.length > 200 ? "..." : "")
11293
- }
11294
- ];
11295
- }
11296
- }
11297
- return [];
11339
+ return extractEvidenceExcerpts({
11340
+ reasoning: a.llmEvaluation?.reasoning,
11341
+ judgeEvidence: a.llmEvaluation?.evidence,
11342
+ response: a.response
11343
+ }).map((text) => ({ text }));
11298
11344
  }
11299
11345
  function resolveOwaspKey(attackId) {
11300
11346
  return owaspKeyForAttack(attackId) ?? "LLM01";
@@ -11345,7 +11391,10 @@ var REPORT_HEAD = `<!DOCTYPE html>
11345
11391
  Page size: A4 (210mm \xD7 297mm)
11346
11392
  ============================================ */
11347
11393
 
11348
- @import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');
11394
+ /* No web-font @import: rendering the report must make no network call (it
11395
+ used to fetch Google Fonts). DM Sans / JetBrains Mono are used when
11396
+ installed, otherwise the system stacks below. The CLI ships no font files
11397
+ to keep the npm package small; the web app embeds them. */
11349
11398
 
11350
11399
  @page {
11351
11400
  margin: 0;
@@ -11428,7 +11477,7 @@ var REPORT_HEAD = `<!DOCTYPE html>
11428
11477
  }
11429
11478
 
11430
11479
  body {
11431
- font-family: 'DM Sans', sans-serif;
11480
+ font-family: 'DM Sans', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
11432
11481
  color: var(--text-primary);
11433
11482
  background: white;
11434
11483
  line-height: 1.5;
@@ -11688,7 +11737,7 @@ var REPORT_HEAD = `<!DOCTYPE html>
11688
11737
  }
11689
11738
 
11690
11739
  .meta-value.mono {
11691
- font-family: 'JetBrains Mono', monospace;
11740
+ font-family: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
11692
11741
  font-size: 13px;
11693
11742
  }
11694
11743
 
@@ -11728,14 +11777,14 @@ var REPORT_HEAD = `<!DOCTYPE html>
11728
11777
  }
11729
11778
 
11730
11779
  .owasp-id {
11731
- font-family: 'JetBrains Mono', monospace;
11780
+ font-family: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
11732
11781
  font-size: 11px;
11733
11782
  font-weight: 500;
11734
11783
  color: var(--brand-accent);
11735
11784
  }
11736
11785
 
11737
11786
  .owasp-score {
11738
- font-family: 'JetBrains Mono', monospace;
11787
+ font-family: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
11739
11788
  font-size: 11px;
11740
11789
  font-weight: 600;
11741
11790
  }
@@ -12029,7 +12078,7 @@ var REPORT_HEAD = `<!DOCTYPE html>
12029
12078
  display: inline-block;
12030
12079
  padding: 2px 8px;
12031
12080
  border-radius: 3px;
12032
- font-family: 'JetBrains Mono', monospace;
12081
+ font-family: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
12033
12082
  font-size: 10px;
12034
12083
  font-weight: 500;
12035
12084
  color: var(--brand-accent);
@@ -12163,7 +12212,7 @@ var REPORT_HEAD = `<!DOCTYPE html>
12163
12212
  background: var(--brand-dark);
12164
12213
  border-radius: 6px;
12165
12214
  padding: 12px 16px;
12166
- font-family: 'JetBrains Mono', monospace;
12215
+ font-family: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
12167
12216
  font-size: 11px;
12168
12217
  line-height: 1.5;
12169
12218
  color: #E2E8F0;
@@ -12212,7 +12261,7 @@ var REPORT_HEAD = `<!DOCTYPE html>
12212
12261
  }
12213
12262
 
12214
12263
  .truncation-notice .char-count {
12215
- font-family: 'JetBrains Mono', monospace;
12264
+ font-family: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
12216
12265
  font-size: 10px;
12217
12266
  color: #475569;
12218
12267
  }
@@ -12233,7 +12282,7 @@ var REPORT_HEAD = `<!DOCTYPE html>
12233
12282
  background: var(--brand-dark);
12234
12283
  border-radius: 4px;
12235
12284
  padding: 8px 14px;
12236
- font-family: 'JetBrains Mono', monospace;
12285
+ font-family: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
12237
12286
  font-size: 11px;
12238
12287
  line-height: 1.4;
12239
12288
  color: #E2E8F0;
@@ -12320,7 +12369,7 @@ var REPORT_HEAD = `<!DOCTYPE html>
12320
12369
  }
12321
12370
 
12322
12371
  .confidence-text {
12323
- font-family: 'JetBrains Mono', monospace;
12372
+ font-family: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
12324
12373
  font-size: 11px;
12325
12374
  color: var(--text-secondary);
12326
12375
  }
@@ -12424,7 +12473,7 @@ var REPORT_HEAD = `<!DOCTYPE html>
12424
12473
  .owasp-ref {
12425
12474
  font-size: 10px;
12426
12475
  color: var(--text-muted);
12427
- font-family: 'JetBrains Mono', monospace;
12476
+ font-family: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
12428
12477
  margin-left: 4px;
12429
12478
  }
12430
12479
 
@@ -12505,7 +12554,7 @@ var REPORT_HEAD = `<!DOCTYPE html>
12505
12554
  }
12506
12555
 
12507
12556
  .eval-method {
12508
- font-family: 'JetBrains Mono', monospace;
12557
+ font-family: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
12509
12558
  font-size: 10px;
12510
12559
  color: var(--text-muted);
12511
12560
  background: var(--surface-light);
@@ -12550,7 +12599,7 @@ var REPORT_HEAD = `<!DOCTYPE html>
12550
12599
  }
12551
12600
 
12552
12601
  .owasp-category-id {
12553
- font-family: 'JetBrains Mono', monospace;
12602
+ font-family: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
12554
12603
  font-size: 12px;
12555
12604
  font-weight: 600;
12556
12605
  color: var(--brand-accent);
@@ -12585,7 +12634,7 @@ var REPORT_HEAD = `<!DOCTYPE html>
12585
12634
  .score-mini-bar-fill.none { background: var(--surface-border); }
12586
12635
 
12587
12636
  .score-mini-text {
12588
- font-family: 'JetBrains Mono', monospace;
12637
+ font-family: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
12589
12638
  font-size: 12px;
12590
12639
  font-weight: 600;
12591
12640
  min-width: 40px;
package/dist/cli.js CHANGED
@@ -67,7 +67,7 @@ import {
67
67
  sha256Hex,
68
68
  summarizeAttackErrors,
69
69
  version
70
- } from "./chunk-YAILR7N5.js";
70
+ } from "./chunk-XMFALD5J.js";
71
71
 
72
72
  // src/load-env.ts
73
73
  try {
@@ -902,7 +902,7 @@ ${issues}`);
902
902
  `);
903
903
  console.log(" Next steps:");
904
904
  console.log(
905
- " shield-llm login Authenticate (SaaS or License)"
905
+ " shield-llm login Authenticate to your Shield instance"
906
906
  );
907
907
  console.log(" shield-llm validate Verify your configuration");
908
908
  console.log(" shield-llm scan Run a scan with your preset");
@@ -2742,9 +2742,8 @@ async function scanCommand(opts) {
2742
2742
  const credentials = stored ? { ...stored, apiUrl: resolveApiUrl(stored.apiUrl, opts.apiUrl) } : null;
2743
2743
  if (!credentials) {
2744
2744
  console.error(
2745
- `Not logged in. Run \`shield-llm login\` to authenticate.
2746
- SaaS: shield-llm login
2747
- License: shield-llm login --key <license-key> --api-url https://your-instance
2745
+ `Not logged in. Point the CLI at your Shield instance:
2746
+ shield-llm login --key <api-key> --api-url <your-instance-url>
2748
2747
  `
2749
2748
  );
2750
2749
  setExitCode(2);
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ import {
9
9
  generatePdf,
10
10
  loadConfig,
11
11
  loadSystemPrompt
12
- } from "./chunk-YAILR7N5.js";
12
+ } from "./chunk-XMFALD5J.js";
13
13
  export {
14
14
  ConfigError,
15
15
  ConfigSchema,
package/dist/logo.png CHANGED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shield-llm",
3
- "version": "0.7.1",
3
+ "version": "0.7.3",
4
4
  "description": "AI chatbot security scanner — automated red teaming for LLMs",
5
5
  "type": "module",
6
6
  "publishConfig": {