prae-cli 0.7.0 → 0.8.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.
@@ -1,50 +1,98 @@
1
1
  //#region ../kernel/src/frameworks.ts
2
- const FRAMEWORKS = { "owasp-llm-top-10-2026": {
3
- name: "OWASP Top 10 for LLM Applications — 2026",
4
- short: "OWASP LLM 2026",
5
- controls: {
6
- LLM01: {
7
- name: "Prompt Injection",
8
- summary: "Instructions in a prompt or in retrieved content alter what the model does."
9
- },
10
- LLM02: {
11
- name: "Sensitive Information Disclosure",
12
- summary: "Credentials, personal data or proprietary content reach the model or its output."
13
- },
14
- LLM03: {
15
- name: "Excessive Agency",
16
- summary: "The model can take actions, or holds permissions, beyond what its task needs."
17
- },
18
- LLM04: {
19
- name: "Supply Chain",
20
- summary: "A compromised model, dataset, plugin or dependency enters the application."
21
- },
22
- LLM05: {
23
- name: "Data and Model Poisoning",
24
- summary: "Training, fine-tuning or embedding data is manipulated to change behaviour."
25
- },
26
- LLM06: {
27
- name: "Unbounded Consumption",
28
- summary: "The application permits resource use without a limit, exhausting budget or service."
29
- },
30
- LLM07: {
31
- name: "Misinformation",
32
- summary: "The model produces false or misleading content that is acted on as if true."
33
- },
34
- LLM08: {
35
- name: "Hidden Context Exposure",
36
- summary: "System prompts, hidden instructions or internal context are revealed."
37
- },
38
- LLM09: {
39
- name: "Vector and Embedding Weaknesses",
40
- summary: "Retrieval stores are manipulated or leak across tenants and permissions."
41
- },
42
- LLM10: {
43
- name: "Improper Output Handling",
44
- summary: "Model output is passed to downstream systems without validation."
2
+ const FRAMEWORKS = {
3
+ "owasp-llm-top-10-2026": {
4
+ name: "OWASP Top 10 for LLM Applications — 2026",
5
+ short: "OWASP LLM 2026",
6
+ controls: {
7
+ LLM01: {
8
+ name: "Prompt Injection",
9
+ summary: "Instructions in a prompt or in retrieved content alter what the model does."
10
+ },
11
+ LLM02: {
12
+ name: "Sensitive Information Disclosure",
13
+ summary: "Credentials, personal data or proprietary content reach the model or its output."
14
+ },
15
+ LLM03: {
16
+ name: "Excessive Agency",
17
+ summary: "The model can take actions, or holds permissions, beyond what its task needs."
18
+ },
19
+ LLM04: {
20
+ name: "Supply Chain",
21
+ summary: "A compromised model, dataset, plugin or dependency enters the application."
22
+ },
23
+ LLM05: {
24
+ name: "Data and Model Poisoning",
25
+ summary: "Training, fine-tuning or embedding data is manipulated to change behaviour."
26
+ },
27
+ LLM06: {
28
+ name: "Unbounded Consumption",
29
+ summary: "The application permits resource use without a limit, exhausting budget or service."
30
+ },
31
+ LLM07: {
32
+ name: "Misinformation",
33
+ summary: "The model produces false or misleading content that is acted on as if true."
34
+ },
35
+ LLM08: {
36
+ name: "Hidden Context Exposure",
37
+ summary: "System prompts, hidden instructions or internal context are revealed."
38
+ },
39
+ LLM09: {
40
+ name: "Vector and Embedding Weaknesses",
41
+ summary: "Retrieval stores are manipulated or leak across tenants and permissions."
42
+ },
43
+ LLM10: {
44
+ name: "Improper Output Handling",
45
+ summary: "Model output is passed to downstream systems without validation."
46
+ }
47
+ }
48
+ },
49
+ "owasp-agentic-top-10-2026": {
50
+ name: "OWASP Top 10 for Agentic Applications — 2026",
51
+ short: "OWASP Agentic 2026",
52
+ controls: {
53
+ ASI01: {
54
+ name: "Agent Goal Hijack",
55
+ summary: "Untrusted input redirects what the agent is trying to do, turning its objectives against its owner."
56
+ },
57
+ ASI02: {
58
+ name: "Tool Misuse and Exploitation",
59
+ summary: "A legitimate tool the agent already holds is turned to an attacker's ends."
60
+ },
61
+ ASI03: {
62
+ name: "Identity and Privilege Abuse",
63
+ summary: "The agent's own authority, credentials or delegated access is inherited or escalated."
64
+ },
65
+ ASI04: {
66
+ name: "Agentic Supply Chain",
67
+ summary: "A poisoned tool, model, plugin, skill or dependency is trusted before the agent runs."
68
+ },
69
+ ASI05: {
70
+ name: "Unexpected Code Execution",
71
+ summary: "The agent's output reaches something that runs it: a shell, an interpreter, a parser."
72
+ },
73
+ ASI06: {
74
+ name: "Memory and Context Poisoning",
75
+ summary: "Corrupted memory or retrieved context persists across sessions and steers future reasoning."
76
+ },
77
+ ASI07: {
78
+ name: "Insecure Inter-Agent Communication",
79
+ summary: "One agent trusts another's messages by default, so a compromised agent can steer its peers."
80
+ },
81
+ ASI08: {
82
+ name: "Cascading Failures",
83
+ summary: "A single fault propagates across agents, tools and workflows into system-wide impact."
84
+ },
85
+ ASI09: {
86
+ name: "Human-Agent Trust Exploitation",
87
+ summary: "Persuasive or misleading agent output moves a person to an unsafe action or approval."
88
+ },
89
+ ASI10: {
90
+ name: "Rogue Agents",
91
+ summary: "A compromised, misaligned or drifting agent keeps operating in unintended ways."
92
+ }
45
93
  }
46
94
  }
47
- } };
95
+ };
48
96
  /**
49
97
  * Every framework control a rule cites, resolved to names.
50
98
  *
@@ -802,6 +850,7 @@ const OBLIGATIONS = [
802
850
  }
803
851
  ];
804
852
  const OWASP = "owasp-llm-top-10-2026";
853
+ const AGENTIC = "owasp-agentic-top-10-2026";
805
854
  /** Rules in the pack that cite one control of one framework. */
806
855
  function citing(pack, framework, control) {
807
856
  return (pack?.rules ?? []).filter((rule) => (rule.frameworks?.[framework] ?? []).includes(control));
@@ -819,32 +868,91 @@ const NOT_THIS_BOUNDARY = {
819
868
  LLM07: "Whether an answer is true is not a property of a tool call.",
820
869
  LLM08: "The assembled system prompt is sealed into the ledger as evidence of what the model was told; nothing here stops the model repeating it.",
821
870
  LLM09: "Retrieval stores are upstream of the call the gate judges.",
822
- LLM10: "What downstream code does with model output is that code's boundary, not this one's."
871
+ LLM10: "What downstream code does with model output is that code's boundary, not this one's.",
872
+ ASI04: "Where a tool, skill or plugin came from is settled before the agent runs. A rule on the skill tool (integrity, source) is how a pack refuses to trust one at load time; none in this pack does.",
873
+ ASI06: "Memory and retrieval stores are upstream of the call the gate judges. What the gate can do is seal what the agent was told (PRAE-ASM, PRAE-CTX) so a poisoned context is evidenced, never silent; this record holds no such seal.",
874
+ ASI07: "A message between agents is not a tool call; when it becomes one, it is judged like any other agent's call. The channel itself is outside this boundary.",
875
+ ASI09: "Whether a person was misled is not a property of a tool call. An ask verdict puts a human in the path and seals the outcome; nothing here judges the persuasion."
876
+ };
877
+ /**
878
+ * A risk this gate answers by *not* answering it: nothing here detects an
879
+ * injected instruction or a hijacked goal, and saying otherwise would be the
880
+ * claim a red team disproves first. What the gate does is bound what the
881
+ * subverted agent can execute — the cited controls of another risk doing
882
+ * their job. Said in those words, every time.
883
+ */
884
+ const BOUNDED_BY = {
885
+ LLM01: {
886
+ framework: OWASP,
887
+ control: "LLM03"
888
+ },
889
+ ASI01: {
890
+ framework: AGENTIC,
891
+ control: "ASI02"
892
+ }
893
+ };
894
+ function bounded(data, risk, by) {
895
+ const bounding = citing(data.pack, by.framework, by.control);
896
+ const what = risk === "ASI01" ? "a hijacked goal" : "injected instructions";
897
+ const who = risk === "ASI01" ? "a hijacked agent" : "an injected instruction";
898
+ return {
899
+ state: "partial",
900
+ note: bounding.length === 0 ? `Not mitigated: this gate does not detect ${what}, and no ${by.control} control in this pack bounds what ${who} can execute.` : `Not mitigated: this gate does not detect ${what}. Bounded: ${bounding.length} ${by.control} control${bounding.length === 1 ? "" : "s"} (${bounding.map((r) => r.id).join(", ")}) decide what ${who} can execute.`
901
+ };
902
+ }
903
+ /**
904
+ * Risks whose evidence is in the record rather than in a citing rule.
905
+ *
906
+ * ASI06: a poisoned context cannot be prevented here, but every change to what
907
+ * the agent was told is sealed, so it is evidenced. ASI10: a drifting agent's
908
+ * actions are judged like any other's; what the record shows is whether the
909
+ * gate refused any of them.
910
+ */
911
+ const FROM_THE_RECORD = {
912
+ ASI06: (data) => {
913
+ const seals = data.entries.filter((e) => e.rule === "PRAE-ASM" || e.rule === "PRAE-CTX");
914
+ return seals.length === 0 ? void 0 : {
915
+ state: "partial",
916
+ note: `Evidenced, not prevented: ${seals.length} seal${seals.length === 1 ? "" : "s"} of what the agent was told (PRAE-ASM / PRAE-CTX) in this record; a poisoned context changes the hash and is answerable afterwards.`
917
+ };
918
+ },
919
+ ASI10: (data) => {
920
+ const refused = data.entries.filter((e) => e.verdict === "deny").length;
921
+ const armed = [
922
+ "ASI02",
923
+ "ASI03",
924
+ "ASI08"
925
+ ].flatMap((c) => citing(data.pack, AGENTIC, c));
926
+ if (armed.length === 0) return void 0;
927
+ return {
928
+ state: refused > 0 ? "covered" : "partial",
929
+ note: refused > 0 ? `A drifting agent's actions are judged like any other's: ${armed.length} controls under ASI02/03/08 apply to every call, and ${refused} refusal${refused === 1 ? "" : "s"} in this record show them holding.` : `A drifting agent's actions are judged like any other's: ${armed.length} controls under ASI02/03/08 apply to every call; none has refused one in this record yet. Detecting drift itself is derived from the record, not a rule.`
930
+ };
931
+ }
823
932
  };
824
- function owaspRow(control) {
825
- const framework = FRAMEWORKS[OWASP];
933
+ function frameworkRow(frameworkId, control) {
934
+ const framework = FRAMEWORKS[frameworkId];
826
935
  const risk = framework?.controls[control];
827
936
  const name = risk?.name ?? control;
828
937
  return {
829
- id: `${framework?.short ?? OWASP} · ${control}`,
938
+ id: `${framework?.short ?? frameworkId} · ${control}`,
830
939
  asks: `${name}. ${risk?.summary ?? ""}`.trim(),
831
940
  evidence: (data) => {
832
941
  if (data.pack === void 0) return {
833
942
  state: "absent",
834
943
  note: "No pack supplied to this view."
835
944
  };
836
- if (control === "LLM01") {
837
- const bounding = citing(data.pack, OWASP, "LLM03");
945
+ const by = BOUNDED_BY[control];
946
+ if (by !== void 0) return bounded(data, control, by);
947
+ const rules = citing(data.pack, frameworkId, control);
948
+ if (rules.length === 0) {
949
+ const derived = FROM_THE_RECORD[control]?.(data);
950
+ if (derived !== void 0) return derived;
838
951
  return {
839
- state: "partial",
840
- note: bounding.length === 0 ? "Not mitigated: this gate does not detect injected instructions, and no LLM03 control in this pack bounds what one can execute." : `Not mitigated: this gate does not detect injected instructions. Bounded: ${bounding.length} LLM03 control${bounding.length === 1 ? "" : "s"} (${bounding.map((r) => r.id).join(", ")}) decide what an injected instruction can execute.`
952
+ state: "absent",
953
+ note: NOT_THIS_BOUNDARY[control] ?? "No rule in this pack cites this risk."
841
954
  };
842
955
  }
843
- const rules = citing(data.pack, OWASP, control);
844
- if (rules.length === 0) return {
845
- state: "absent",
846
- note: NOT_THIS_BOUNDARY[control] ?? "No rule in this pack cites this risk."
847
- };
848
956
  const ids = new Set(rules.map((rule) => rule.id));
849
957
  const decisions = data.entries.filter((entry) => entry.rule !== void 0 && ids.has(entry.rule));
850
958
  const listed = rules.map((rule) => rule.id).join(", ");
@@ -858,14 +966,18 @@ function owaspRow(control) {
858
966
  }
859
967
  };
860
968
  }
861
- const OWASP_ROWS = Object.keys(FRAMEWORKS[OWASP]?.controls ?? {}).map(owaspRow);
969
+ const rowsOf = (frameworkId) => Object.keys(FRAMEWORKS[frameworkId]?.controls ?? {}).map((control) => frameworkRow(frameworkId, control));
862
970
  /**
863
- * The obligations first, then the OWASP risks. Two kinds of row in one table
864
- * on purpose: an auditor reads down one list and finds the audit obligations
865
- * the ledger evidences and the application risks the pack's rules address,
866
- * each stated in its framework's own words.
971
+ * The obligations first, then the risks framework by framework. Two kinds of
972
+ * row in one table on purpose: an auditor reads down one list and finds the
973
+ * audit obligations the ledger evidences and the application risks the pack's
974
+ * rules address, each stated in its framework's own words.
867
975
  */
868
- const CONTROLS = [...OBLIGATIONS, ...OWASP_ROWS];
976
+ const CONTROLS = [
977
+ ...OBLIGATIONS,
978
+ ...rowsOf(OWASP),
979
+ ...rowsOf(AGENTIC)
980
+ ];
869
981
 
870
982
  //#endregion
871
983
  //#region src/console/views.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prae-cli",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "description": "Operator policy for agent harnesses: validate packs, explain a decision, test a pack against security invariants, verify a decision log, and provision a governed DSH profile.",
5
5
  "keywords": [
6
6
  "dsh-plugin",
@@ -40,9 +40,9 @@
40
40
  "tsdown": "^0.15.6",
41
41
  "typescript": "^5.9.2",
42
42
  "vitest": "^3.2.4",
43
- "@prae/controls": "0.1.0",
44
43
  "@prae/extract": "0.1.0",
45
44
  "@prae/inspect": "0.1.0",
45
+ "@prae/controls": "0.1.0",
46
46
  "@prae/instructions": "0.1.0",
47
47
  "@prae/kernel": "0.1.0",
48
48
  "@prae/ledger": "0.1.0",
File without changes
File without changes
File without changes