actshield 0.9.0__py3-none-any.whl

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.
Files changed (366) hide show
  1. actshield/__init__.py +439 -0
  2. actshield/__main__.py +46 -0
  3. actshield/agents/__init__.py +12 -0
  4. actshield/agents/agent.py +200 -0
  5. actshield/agents/identity.py +114 -0
  6. actshield/api/__init__.py +34 -0
  7. actshield/api/models.py +198 -0
  8. actshield/api/server.py +669 -0
  9. actshield/api/service.py +599 -0
  10. actshield/approval/__init__.py +15 -0
  11. actshield/approval/approval.py +164 -0
  12. actshield/cli/__init__.py +8 -0
  13. actshield/cli/graph.py +49 -0
  14. actshield/cli/main.py +802 -0
  15. actshield/cli/shell.py +406 -0
  16. actshield/cli/theme.py +110 -0
  17. actshield/client.py +757 -0
  18. actshield/config.py +88 -0
  19. actshield/context/__init__.py +14 -0
  20. actshield/context/context.py +161 -0
  21. actshield/context/provenance.py +108 -0
  22. actshield/context/taint.py +48 -0
  23. actshield/decisions/decision.py +74 -0
  24. actshield/delegation/__init__.py +11 -0
  25. actshield/delegation/authority.py +63 -0
  26. actshield/delegation/delegation.py +180 -0
  27. actshield/demo.py +139 -0
  28. actshield/doctor.py +94 -0
  29. actshield/drift/__init__.py +27 -0
  30. actshield/drift/drift_engine.py +149 -0
  31. actshield/drift/drift_models.py +63 -0
  32. actshield/evaluation/__init__.py +1 -0
  33. actshield/evaluation/cases/__init__.py +1 -0
  34. actshield/evaluation/eval_suite.py +254 -0
  35. actshield/forensics/__init__.py +53 -0
  36. actshield/forensics/access_graph.py +216 -0
  37. actshield/forensics/authority_graph.py +186 -0
  38. actshield/forensics/delegation_graph.py +119 -0
  39. actshield/forensics/explanation.py +254 -0
  40. actshield/forensics/models.py +488 -0
  41. actshield/forensics/queries.py +367 -0
  42. actshield/forensics/serializers.py +68 -0
  43. actshield/forensics/service.py +310 -0
  44. actshield/forensics/snapshots.py +174 -0
  45. actshield/gates/__init__.py +13 -0
  46. actshield/gates/gate_models.py +46 -0
  47. actshield/gates/security_gate.py +191 -0
  48. actshield/gateway/__init__.py +13 -0
  49. actshield/gateway/http.py +191 -0
  50. actshield/gateway/mcp.py +292 -0
  51. actshield/incidents/__init__.py +25 -0
  52. actshield/incidents/incident.py +94 -0
  53. actshield/incidents/incident_engine.py +163 -0
  54. actshield/incidents/incident_rules.py +116 -0
  55. actshield/incidents/incident_state.py +58 -0
  56. actshield/integrations/__init__.py +24 -0
  57. actshield/integrations/ai_secura.py +169 -0
  58. actshield/integrations/ai_secura_analysis.py +236 -0
  59. actshield/integrations/apiris.py +122 -0
  60. actshield/integrations/few_shot.py +104 -0
  61. actshield/integrations/ollama_adapter.py +538 -0
  62. actshield/integrations/prompts/__init__.py +1 -0
  63. actshield/integrations/prompts/examples/__init__.py +1 -0
  64. actshield/integrations/security_packet.py +82 -0
  65. actshield/llm_config.py +89 -0
  66. actshield/offensive/__init__.py +95 -0
  67. actshield/offensive/adaptive/__init__.py +22 -0
  68. actshield/offensive/adaptive/adaptive_engine.py +165 -0
  69. actshield/offensive/adaptive/attack_selector.py +51 -0
  70. actshield/offensive/adaptive/boundary_search.py +99 -0
  71. actshield/offensive/adaptive/campaign_memory.py +123 -0
  72. actshield/offensive/adaptive/feedback.py +84 -0
  73. actshield/offensive/adaptive/mutation_planner.py +57 -0
  74. actshield/offensive/attack.py +78 -0
  75. actshield/offensive/campaign.py +219 -0
  76. actshield/offensive/corpus.py +155 -0
  77. actshield/offensive/engine.py +466 -0
  78. actshield/offensive/evaluator.py +116 -0
  79. actshield/offensive/evidence.py +63 -0
  80. actshield/offensive/generator.py +128 -0
  81. actshield/offensive/mutation.py +101 -0
  82. actshield/offensive/results.py +77 -0
  83. actshield/offensive/safety.py +80 -0
  84. actshield/offensive/strategies/__init__.py +22 -0
  85. actshield/offensive/strategies/authority_escalation.py +100 -0
  86. actshield/offensive/strategies/base.py +34 -0
  87. actshield/offensive/strategies/context_manipulation.py +100 -0
  88. actshield/offensive/strategies/data_exfiltration.py +100 -0
  89. actshield/offensive/strategies/delegation_attacks.py +100 -0
  90. actshield/offensive/strategies/mcp_attacks.py +100 -0
  91. actshield/offensive/strategies/prompt_injection.py +100 -0
  92. actshield/offensive/strategies/tool_poisoning.py +100 -0
  93. actshield/offensive/target.py +113 -0
  94. actshield/offensive/vulnerable_target.py +121 -0
  95. actshield/persistence/__init__.py +18 -0
  96. actshield/persistence/siem.py +102 -0
  97. actshield/persistence/storage.py +240 -0
  98. actshield/policy/__init__.py +12 -0
  99. actshield/policy/evaluator.py +294 -0
  100. actshield/policy/intent.py +113 -0
  101. actshield/policy/policy.py +48 -0
  102. actshield/posture/__init__.py +26 -0
  103. actshield/posture/posture_engine.py +186 -0
  104. actshield/posture/posture_models.py +152 -0
  105. actshield/posture/posture_rules.py +137 -0
  106. actshield/providers/__init__.py +32 -0
  107. actshield/providers/anthropic_provider.py +146 -0
  108. actshield/providers/base.py +160 -0
  109. actshield/providers/gemini_provider.py +133 -0
  110. actshield/providers/null_provider.py +40 -0
  111. actshield/providers/ollama_provider.py +135 -0
  112. actshield/providers/openai_provider.py +142 -0
  113. actshield/providers/registry.py +244 -0
  114. actshield/py.typed +0 -0
  115. actshield/response/__init__.py +14 -0
  116. actshield/response/response_actions.py +39 -0
  117. actshield/response/response_audit.py +32 -0
  118. actshield/response/response_engine.py +139 -0
  119. actshield/risk/models.py +104 -0
  120. actshield/serve.py +117 -0
  121. actshield/static/404.html +1 -0
  122. actshield/static/__next.__PAGE__.txt +24 -0
  123. actshield/static/__next._full.txt +20 -0
  124. actshield/static/__next._tree.txt +4 -0
  125. actshield/static/_next/static/Yp_swxN-C9UoCRNOwkYnY/_buildManifest.js +11 -0
  126. actshield/static/_next/static/Yp_swxN-C9UoCRNOwkYnY/_clientMiddlewareManifest.js +1 -0
  127. actshield/static/_next/static/Yp_swxN-C9UoCRNOwkYnY/_ssgManifest.js +1 -0
  128. actshield/static/_next/static/chunks/09kny2eqjc2or.js +1 -0
  129. actshield/static/_next/static/chunks/0c1zba1u9whdp.js +1 -0
  130. actshield/static/_next/static/chunks/0cz1d0mv5g_q7.js +1 -0
  131. actshield/static/_next/static/chunks/0dbjjeg01x25o.js +1 -0
  132. actshield/static/_next/static/chunks/0duobs55ne238.js +1 -0
  133. actshield/static/_next/static/chunks/0iaz41l6068e4.js +1 -0
  134. actshield/static/_next/static/chunks/0mjhyv72x2idp.js +1 -0
  135. actshield/static/_next/static/chunks/0nelpqfu_ciq6.js +1 -0
  136. actshield/static/_next/static/chunks/0p1bci9ch797v.js +1 -0
  137. actshield/static/_next/static/chunks/0tld_ygho5tgm.js +1 -0
  138. actshield/static/_next/static/chunks/0w1-y7oni66j9.js +1 -0
  139. actshield/static/_next/static/chunks/10537zyl427zj.js +1 -0
  140. actshield/static/_next/static/chunks/11pc_jkl3aggn.js +1 -0
  141. actshield/static/_next/static/chunks/16k7nw0b3t8ys.js +1 -0
  142. actshield/static/_next/static/chunks/19mx3mg6lkumu.js +1 -0
  143. actshield/static/_next/static/chunks/1_8p47b-kxg2a.js +1 -0
  144. actshield/static/_next/static/chunks/1dszjozwfqegx.js +1 -0
  145. actshield/static/_next/static/chunks/1h43jcb90-m2r.js +22 -0
  146. actshield/static/_next/static/chunks/1ly04cvt_wh_j.js +1 -0
  147. actshield/static/_next/static/chunks/1odxrypuwuwp_.js +1 -0
  148. actshield/static/_next/static/chunks/1oes4c35qz5ku.js +1 -0
  149. actshield/static/_next/static/chunks/1ow883jl4ln-r.js +16 -0
  150. actshield/static/_next/static/chunks/1po7bna1as8tc.js +1 -0
  151. actshield/static/_next/static/chunks/1rsh0og8ifkzx.js +1 -0
  152. actshield/static/_next/static/chunks/1v0lwzv-859z_.js +1 -0
  153. actshield/static/_next/static/chunks/25iat2epwx25a.js +1 -0
  154. actshield/static/_next/static/chunks/25uvt4s2f39a4.js +1 -0
  155. actshield/static/_next/static/chunks/27t_qfc-3_lzs.js +1 -0
  156. actshield/static/_next/static/chunks/28bkmy8mez7gm.js +1 -0
  157. actshield/static/_next/static/chunks/2b6brmw_drw1p.js +1 -0
  158. actshield/static/_next/static/chunks/2fnhtxi4j6vge.js +1 -0
  159. actshield/static/_next/static/chunks/2p087eftxemg4.js +6 -0
  160. actshield/static/_next/static/chunks/2s8pao_z8pgtq.js +1 -0
  161. actshield/static/_next/static/chunks/2yj7ooc2c-zpg.js +1 -0
  162. actshield/static/_next/static/chunks/3-mrrr8udt5tk.js +1 -0
  163. actshield/static/_next/static/chunks/310vm2bl3xxpt.js +31 -0
  164. actshield/static/_next/static/chunks/35mvsv251jx1r.css +3 -0
  165. actshield/static/_next/static/chunks/370vf0oetlsx9.js +1 -0
  166. actshield/static/_next/static/chunks/3e-2m72tyo556.js +1 -0
  167. actshield/static/_next/static/chunks/3fntmmi971322.js +1 -0
  168. actshield/static/_next/static/chunks/3fzw-g0hycl2c.js +1 -0
  169. actshield/static/_next/static/chunks/3lopq3lhmcjxg.js +129 -0
  170. actshield/static/_next/static/chunks/3mpe2jejel0v2.css +1 -0
  171. actshield/static/_next/static/chunks/3t8o4f2lzr2sf.js +1 -0
  172. actshield/static/_next/static/chunks/3y-v1neyllne5.js +1 -0
  173. actshield/static/_next/static/chunks/43oiwy8mx6cs1.js +1 -0
  174. actshield/static/_next/static/chunks/turbopack-23wzuebcy_lxm.js +1 -0
  175. actshield/static/_next/static/media/1bffadaabf893a1e-s.3-6t-g6q0vh0a.woff2 +0 -0
  176. actshield/static/_next/static/media/2bbe8d2671613f1f-s.0k62hbripvv8p.woff2 +0 -0
  177. actshield/static/_next/static/media/2c55a0e60120577a-s.0-dom-5bn10r2.woff2 +0 -0
  178. actshield/static/_next/static/media/5476f68d60460930-s.2uwcyprjm3xu3.woff2 +0 -0
  179. actshield/static/_next/static/media/83afe278b6a6bb3c-s.p.2bn3s6zvc0dyp.woff2 +0 -0
  180. actshield/static/_next/static/media/9c72aa0f40e4eef8-s.1y4-pdgsjb-pw.woff2 +0 -0
  181. actshield/static/_next/static/media/ad66f9afd8947f86-s.3lvt2whj97whp.woff2 +0 -0
  182. actshield/static/_next/static/media/favicon.2vob68tjqpejf.ico +0 -0
  183. actshield/static/_not-found/__next._full.txt +17 -0
  184. actshield/static/_not-found/__next._not-found/__PAGE__.txt +23 -0
  185. actshield/static/_not-found/__next._tree.txt +3 -0
  186. actshield/static/_not-found.html +1 -0
  187. actshield/static/_not-found.txt +17 -0
  188. actshield/static/access/matrix/__next._full.txt +24 -0
  189. actshield/static/access/matrix/__next._tree.txt +4 -0
  190. actshield/static/access/matrix/__next.access/matrix/__PAGE__.txt +30 -0
  191. actshield/static/access/matrix.html +1 -0
  192. actshield/static/access/matrix.txt +24 -0
  193. actshield/static/activity/__next._full.txt +22 -0
  194. actshield/static/activity/__next._tree.txt +4 -0
  195. actshield/static/activity/__next.activity/__PAGE__.txt +27 -0
  196. actshield/static/activity.html +1 -0
  197. actshield/static/activity.txt +22 -0
  198. actshield/static/agents/__next._full.txt +22 -0
  199. actshield/static/agents/__next._tree.txt +4 -0
  200. actshield/static/agents/__next.agents/__PAGE__.txt +27 -0
  201. actshield/static/agents.html +1 -0
  202. actshield/static/agents.txt +22 -0
  203. actshield/static/ai-secura/__next._full.txt +22 -0
  204. actshield/static/ai-secura/__next._tree.txt +4 -0
  205. actshield/static/ai-secura/__next.ai-secura/__PAGE__.txt +27 -0
  206. actshield/static/ai-secura.html +1 -0
  207. actshield/static/ai-secura.txt +22 -0
  208. actshield/static/api/__next._full.txt +22 -0
  209. actshield/static/api/__next._tree.txt +4 -0
  210. actshield/static/api/__next.api/__PAGE__.txt +27 -0
  211. actshield/static/api.html +15 -0
  212. actshield/static/api.txt +22 -0
  213. actshield/static/apiris/__next._full.txt +22 -0
  214. actshield/static/apiris/__next._tree.txt +4 -0
  215. actshield/static/apiris/__next.apiris/__PAGE__.txt +27 -0
  216. actshield/static/apiris.html +1 -0
  217. actshield/static/apiris.txt +22 -0
  218. actshield/static/attack-graph/__next._full.txt +23 -0
  219. actshield/static/attack-graph/__next._tree.txt +5 -0
  220. actshield/static/attack-graph/__next.attack-graph/__PAGE__.txt +28 -0
  221. actshield/static/attack-graph.html +2 -0
  222. actshield/static/attack-graph.txt +23 -0
  223. actshield/static/campaigns/__next._full.txt +22 -0
  224. actshield/static/campaigns/__next._tree.txt +4 -0
  225. actshield/static/campaigns/__next.campaigns/__PAGE__.txt +27 -0
  226. actshield/static/campaigns.html +1 -0
  227. actshield/static/campaigns.txt +22 -0
  228. actshield/static/context/__next._full.txt +22 -0
  229. actshield/static/context/__next._tree.txt +4 -0
  230. actshield/static/context/__next.context/__PAGE__.txt +27 -0
  231. actshield/static/context.html +1 -0
  232. actshield/static/context.txt +22 -0
  233. actshield/static/dashboard/__next._full.txt +22 -0
  234. actshield/static/dashboard/__next._tree.txt +4 -0
  235. actshield/static/dashboard/__next.dashboard/__PAGE__.txt +27 -0
  236. actshield/static/dashboard.html +1 -0
  237. actshield/static/dashboard.txt +22 -0
  238. actshield/static/delegations/__next._full.txt +22 -0
  239. actshield/static/delegations/__next._tree.txt +4 -0
  240. actshield/static/delegations/__next.delegations/__PAGE__.txt +27 -0
  241. actshield/static/delegations.html +1 -0
  242. actshield/static/delegations.txt +22 -0
  243. actshield/static/demo/__next._full.txt +22 -0
  244. actshield/static/demo/__next._tree.txt +4 -0
  245. actshield/static/demo/__next.demo/__PAGE__.txt +27 -0
  246. actshield/static/demo.html +1 -0
  247. actshield/static/demo.txt +22 -0
  248. actshield/static/drift/__next._full.txt +22 -0
  249. actshield/static/drift/__next._tree.txt +4 -0
  250. actshield/static/drift/__next.drift/__PAGE__.txt +27 -0
  251. actshield/static/drift.html +1 -0
  252. actshield/static/drift.txt +22 -0
  253. actshield/static/favicon.ico +0 -0
  254. actshield/static/file.svg +1 -0
  255. actshield/static/forensics/__next._full.txt +22 -0
  256. actshield/static/forensics/__next._tree.txt +4 -0
  257. actshield/static/forensics/__next.forensics/__PAGE__.txt +27 -0
  258. actshield/static/forensics.html +1 -0
  259. actshield/static/forensics.txt +22 -0
  260. actshield/static/globe.svg +1 -0
  261. actshield/static/incidents/__next._full.txt +22 -0
  262. actshield/static/incidents/__next._tree.txt +4 -0
  263. actshield/static/incidents/__next.incidents/__PAGE__.txt +27 -0
  264. actshield/static/incidents.html +1 -0
  265. actshield/static/incidents.txt +22 -0
  266. actshield/static/index.html +3 -0
  267. actshield/static/index.txt +20 -0
  268. actshield/static/logo.png +0 -0
  269. actshield/static/metrics/__next._full.txt +22 -0
  270. actshield/static/metrics/__next._tree.txt +4 -0
  271. actshield/static/metrics/__next.metrics/__PAGE__.txt +27 -0
  272. actshield/static/metrics.html +1 -0
  273. actshield/static/metrics.txt +22 -0
  274. actshield/static/next.svg +1 -0
  275. actshield/static/offensive/__next._full.txt +22 -0
  276. actshield/static/offensive/__next._tree.txt +4 -0
  277. actshield/static/offensive/__next.offensive/__PAGE__.txt +27 -0
  278. actshield/static/offensive.html +1 -0
  279. actshield/static/offensive.txt +22 -0
  280. actshield/static/policies/__next._full.txt +22 -0
  281. actshield/static/policies/__next._tree.txt +4 -0
  282. actshield/static/policies/__next.policies/__PAGE__.txt +27 -0
  283. actshield/static/policies.html +1 -0
  284. actshield/static/policies.txt +22 -0
  285. actshield/static/posture/__next._full.txt +22 -0
  286. actshield/static/posture/__next._tree.txt +4 -0
  287. actshield/static/posture/__next.posture/__PAGE__.txt +27 -0
  288. actshield/static/posture.html +1 -0
  289. actshield/static/posture.txt +22 -0
  290. actshield/static/regressions/__next._full.txt +22 -0
  291. actshield/static/regressions/__next._tree.txt +4 -0
  292. actshield/static/regressions/__next.regressions/__PAGE__.txt +27 -0
  293. actshield/static/regressions.html +1 -0
  294. actshield/static/regressions.txt +22 -0
  295. actshield/static/reports/__next._full.txt +22 -0
  296. actshield/static/reports/__next._tree.txt +4 -0
  297. actshield/static/reports/__next.reports/__PAGE__.txt +27 -0
  298. actshield/static/reports.html +1 -0
  299. actshield/static/reports.txt +22 -0
  300. actshield/static/resources/__next._full.txt +22 -0
  301. actshield/static/resources/__next._tree.txt +4 -0
  302. actshield/static/resources/__next.resources/__PAGE__.txt +27 -0
  303. actshield/static/resources.html +1 -0
  304. actshield/static/resources.txt +22 -0
  305. actshield/static/security-gates/__next._full.txt +22 -0
  306. actshield/static/security-gates/__next._tree.txt +4 -0
  307. actshield/static/security-gates/__next.security-gates/__PAGE__.txt +27 -0
  308. actshield/static/security-gates.html +1 -0
  309. actshield/static/security-gates.txt +22 -0
  310. actshield/static/settings/__next._full.txt +22 -0
  311. actshield/static/settings/__next._tree.txt +4 -0
  312. actshield/static/settings/__next.settings/__PAGE__.txt +27 -0
  313. actshield/static/settings.html +1 -0
  314. actshield/static/settings.txt +22 -0
  315. actshield/static/tasks/__next._full.txt +22 -0
  316. actshield/static/tasks/__next._tree.txt +4 -0
  317. actshield/static/tasks/__next.tasks/__PAGE__.txt +27 -0
  318. actshield/static/tasks.html +1 -0
  319. actshield/static/tasks.txt +22 -0
  320. actshield/static/threats/__next._full.txt +22 -0
  321. actshield/static/threats/__next._tree.txt +4 -0
  322. actshield/static/threats/__next.threats/__PAGE__.txt +27 -0
  323. actshield/static/threats.html +1 -0
  324. actshield/static/threats.txt +22 -0
  325. actshield/static/tools/__next._full.txt +22 -0
  326. actshield/static/tools/__next._tree.txt +4 -0
  327. actshield/static/tools/__next.tools/__PAGE__.txt +27 -0
  328. actshield/static/tools.html +1 -0
  329. actshield/static/tools.txt +22 -0
  330. actshield/static/traces/__next._full.txt +22 -0
  331. actshield/static/traces/__next._tree.txt +4 -0
  332. actshield/static/traces/__next.traces/__PAGE__.txt +27 -0
  333. actshield/static/traces.html +1 -0
  334. actshield/static/traces.txt +22 -0
  335. actshield/static/vercel.svg +1 -0
  336. actshield/static/window.svg +1 -0
  337. actshield/tasks/__init__.py +6 -0
  338. actshield/tasks/task.py +143 -0
  339. actshield/threatmodel/__init__.py +70 -0
  340. actshield/threatmodel/actors.py +210 -0
  341. actshield/threatmodel/analyzer.py +131 -0
  342. actshield/threatmodel/assets.py +167 -0
  343. actshield/threatmodel/boundaries.py +165 -0
  344. actshield/threatmodel/exporters.py +49 -0
  345. actshield/threatmodel/mitigations.py +209 -0
  346. actshield/threatmodel/models.py +80 -0
  347. actshield/threatmodel/report.py +341 -0
  348. actshield/threatmodel/scenarios.py +212 -0
  349. actshield/threatmodel/scoring.py +66 -0
  350. actshield/threatmodel/threats.py +387 -0
  351. actshield/tools/__init__.py +20 -0
  352. actshield/tools/interceptor.py +256 -0
  353. actshield/tools/tool.py +71 -0
  354. actshield/tracing/__init__.py +38 -0
  355. actshield/tracing/correlation.py +173 -0
  356. actshield/tracing/events.py +75 -0
  357. actshield/tracing/tracer.py +305 -0
  358. actshield/watch.py +129 -0
  359. actshield-0.9.0.dist-info/METADATA +57 -0
  360. actshield-0.9.0.dist-info/RECORD +366 -0
  361. actshield-0.9.0.dist-info/WHEEL +5 -0
  362. actshield-0.9.0.dist-info/entry_points.txt +4 -0
  363. actshield-0.9.0.dist-info/top_level.txt +2 -0
  364. agentguard/__init__.py +39 -0
  365. agentguard/__main__.py +8 -0
  366. agentguard/py.typed +1 -0
actshield/__init__.py ADDED
@@ -0,0 +1,439 @@
1
+ """ActShield: Security Control Plane SDK for Autonomous and Multi-Agent AI Systems.
2
+
3
+ Quick start::
4
+
5
+ from actshield import ActShield
6
+
7
+ guard = ActShield(mode="strict")
8
+
9
+ @guard.protect(tool="customer_db.read", sensitivity="critical")
10
+ async def read_customer_data():
11
+ ...
12
+
13
+ # Threat modeling
14
+ from actshield.threatmodel import ThreatAnalyzer
15
+ analyzer = ThreatAnalyzer()
16
+ result = analyzer.analyze()
17
+ """
18
+
19
+ from actshield.agents.agent import Agent
20
+ from actshield.agents.identity import AgentCapability, AgentIdentity, AgentStatus, AgentTrustLevel
21
+ from actshield.client import ActShield
22
+ from actshield.config import ActShieldConfig
23
+ from actshield.context.context import Context
24
+ from actshield.context.provenance import ContextSource, ContextTrustLevel, Provenance, ProvenanceHop, SanitizationRecord
25
+ from actshield.context.taint import TaintState
26
+ from actshield.decisions.decision import DecisionAction, SecurityDecision
27
+ from actshield.delegation.authority import AuthorityGrant
28
+ from actshield.delegation.delegation import Delegation, DelegationScope
29
+ from actshield.approval.approval import (
30
+ ApprovalManager,
31
+ ApprovalRequest,
32
+ ApprovalStatus,
33
+ )
34
+ from actshield.gateway.http import HTTPGateway, HTTPInterceptedResponse
35
+ from actshield.gateway.mcp import MCPGateway, MCPMessage
36
+
37
+ from actshield.integrations.ai_secura import (
38
+ AISecuraClient,
39
+ LocalAISecuraAdapter,
40
+ SecurityAnalysis,
41
+ SecurityContext,
42
+ SecurityReasoner,
43
+ )
44
+ from actshield.providers.base import (
45
+ AnalysisResult,
46
+ HealthReport,
47
+ SecurityAIProvider,
48
+ )
49
+ from actshield.providers.registry import (
50
+ ProviderRegistry,
51
+ get_provider_registry,
52
+ )
53
+ from actshield.integrations.ai_secura_analysis import (
54
+ AISecuraAnalysis,
55
+ ThreatSeverity,
56
+ IntentAlignment,
57
+ AIRecommendation,
58
+ AttackTechnique,
59
+ EvidenceTriad,
60
+ AuthorityAnalysis,
61
+ TaintAnalysis,
62
+ )
63
+ from actshield.integrations.ollama_adapter import OllamaAISecuraAdapter
64
+ from actshield.llm_config import LLMConfig
65
+ from actshield.offensive import (
66
+ AttackCase,
67
+ AttackType,
68
+ ExpectedBehavior,
69
+ SafetyClass,
70
+ AttackTarget,
71
+ TargetEnvironment,
72
+ TargetRegistry,
73
+ target_registry,
74
+ SafetyValidationResult,
75
+ SafetyValidator,
76
+ safety_validator,
77
+ AttackStatus,
78
+ ExecutionEvidence,
79
+ OffensiveAttackResult,
80
+ AttackEvaluator,
81
+ MutationEngine,
82
+ MutationStrategy,
83
+ AttackCampaign,
84
+ CampaignSummary,
85
+ AttackCorpus,
86
+ attack_corpus,
87
+ AIAttackGenerator,
88
+ VulnerableDemoTarget,
89
+ OffensiveEngine,
90
+ SecurityAnalysisEvidence,
91
+ AdaptiveEngine,
92
+ CampaignMemory,
93
+ )
94
+ from actshield.integrations.apiris import (
95
+ APIAnalysis,
96
+ APIIntelligence,
97
+ APIRISClient,
98
+ LocalAPIRISAdapter,
99
+ )
100
+ from actshield.persistence.siem import SIEMExporter, SIEMFormat
101
+ from actshield.persistence.storage import (
102
+ PostgresStorage,
103
+ SQLiteStorage,
104
+ StorageBackend,
105
+ )
106
+ from actshield.policy.evaluator import PolicyEvaluator
107
+ from actshield.policy.intent import (
108
+ DeterministicIntentAnalyzer,
109
+ IntentAlignmentResult,
110
+ IntentAlignmentStatus,
111
+ IntentAnalyzer,
112
+ )
113
+ from actshield.policy.policy import Policy, PolicyRule, RuleCondition
114
+ from actshield.risk.models import RiskAssessment, RiskFactorBreakdown, RiskLevel, RiskSignal
115
+ from actshield.tasks.task import Task, TaskContext, TaskStatus
116
+ from actshield.tools.interceptor import protected_tool
117
+ from actshield.tools.tool import (
118
+ Resource,
119
+ SensitivityLevel,
120
+ ToolDefinition,
121
+ ToolRequest,
122
+ ToolResult,
123
+ )
124
+ from actshield.tracing.correlation import (
125
+ CorrelationContext,
126
+ SpanScope,
127
+ generate_id,
128
+ get_current_agent_id,
129
+ get_current_context,
130
+ get_current_delegation_id,
131
+ get_current_span_id,
132
+ get_current_task_id,
133
+ get_current_trace_id,
134
+ )
135
+ from actshield.tracing.events import EventType, SecurityEvent
136
+ from actshield.tracing.tracer import CausalEdge, CausalGraph, CausalNode, TraceManager
137
+
138
+ __version__ = "0.9.0"
139
+
140
+ # Phase 6.5 — Forensic Intelligence + Product API
141
+ from actshield.forensics.service import ForensicService
142
+ from actshield.forensics.queries import ForensicQueryEngine
143
+ from actshield.forensics.models import (
144
+ AgentAccessProfile,
145
+ ResourceAccessProfile,
146
+ AccessAttempt,
147
+ ActualAccess,
148
+ AccessSnapshot,
149
+ AccessDiff,
150
+ ForensicExplanation,
151
+ AttackForensicReport,
152
+ ForensicIncident,
153
+ IncidentType,
154
+ IncidentSeverity,
155
+ AccessMatrix,
156
+ )
157
+ from actshield.api.service import ApiService, SecurityPrincipal
158
+ from actshield.api.models import (
159
+ AgentAccessResponse,
160
+ ResourceAccessResponse,
161
+ AccessMatrixResponse,
162
+ OverviewResponse,
163
+ AttackForensicsResponse,
164
+ IncidentResponse,
165
+ ErrorResponse,
166
+ HealthResponse,
167
+ )
168
+
169
+ # Phase 9 — Continuous Security Control Plane
170
+ from actshield.posture import (
171
+ SecurityPostureSnapshot,
172
+ PostureRating,
173
+ FindingSeverity,
174
+ PostureFinding,
175
+ PostureDimensionMetrics,
176
+ PostureDiff,
177
+ PostureEngine,
178
+ PostureDiffEngine,
179
+ PostureRuleEvaluator,
180
+ )
181
+ from actshield.incidents import (
182
+ SecurityIncident,
183
+ IncidentState,
184
+ IncidentStateMachine,
185
+ IncidentTimelineEntry,
186
+ IncidentEngine,
187
+ IncidentCreationRule,
188
+ )
189
+ from actshield.response import (
190
+ ResponseActionType,
191
+ ResponseActionRecord,
192
+ AuthorityChangeEvent,
193
+ ResponseEngine,
194
+ )
195
+ from actshield.drift import (
196
+ DriftCategory,
197
+ DriftSeverity,
198
+ DriftEvent,
199
+ AgentBehaviorBaseline,
200
+ BehavioralBaselineTracker,
201
+ AuthorityDriftDetector,
202
+ AccessDriftDetector,
203
+ ContextDriftDetector,
204
+ )
205
+ from actshield.gates import (
206
+ GateStatus,
207
+ GateCheckRule,
208
+ SecurityGateResult,
209
+ SecurityGateEvaluator,
210
+ security_gate,
211
+ )
212
+
213
+ # Threat Modeling
214
+ from actshield.threatmodel import (
215
+ ThreatAnalyzer,
216
+ ThreatReportRenderer,
217
+ ThreatModelExporter,
218
+ ThreatModel,
219
+ AnalysisResult as ThreatAnalysisResult,
220
+ ThreatSeverity,
221
+ ThreatCategory,
222
+ Asset,
223
+ AssetSensitivity,
224
+ ThreatActor,
225
+ ActorType,
226
+ TrustBoundary,
227
+ BoundaryType,
228
+ Threat,
229
+ AttackScenario,
230
+ )
231
+
232
+ __all__ = [
233
+ "ActShield",
234
+ "ActShieldConfig",
235
+ "Agent",
236
+ "AgentIdentity",
237
+ "AgentCapability",
238
+ "AgentTrustLevel",
239
+ "AgentStatus",
240
+ "Task",
241
+ "TaskContext",
242
+ "TaskStatus",
243
+ "Delegation",
244
+ "DelegationScope",
245
+ "AuthorityGrant",
246
+ "Context",
247
+ "ContextSource",
248
+ "ContextTrustLevel",
249
+ "Provenance",
250
+ "ProvenanceHop",
251
+ "SanitizationRecord",
252
+ "TaintState",
253
+ "ToolDefinition",
254
+ "Resource",
255
+ "SensitivityLevel",
256
+ "ToolRequest",
257
+ "ToolResult",
258
+ "protected_tool",
259
+ "Policy",
260
+ "PolicyRule",
261
+ "RuleCondition",
262
+ "PolicyEvaluator",
263
+ "IntentAnalyzer",
264
+ "DeterministicIntentAnalyzer",
265
+ "IntentAlignmentStatus",
266
+ "IntentAlignmentResult",
267
+ "RiskLevel",
268
+ "RiskSignal",
269
+ "RiskAssessment",
270
+ "RiskFactorBreakdown",
271
+ "DecisionAction",
272
+ "SecurityDecision",
273
+ "EventType",
274
+ "SecurityEvent",
275
+ "CorrelationContext",
276
+ "SpanScope",
277
+ "generate_id",
278
+ "get_current_context",
279
+ "get_current_trace_id",
280
+ "get_current_span_id",
281
+ "get_current_agent_id",
282
+ "get_current_task_id",
283
+ "get_current_delegation_id",
284
+ "CausalNode",
285
+ "CausalEdge",
286
+ "CausalGraph",
287
+ "TraceManager",
288
+ "SecurityReasoner",
289
+ "SecurityContext",
290
+ "SecurityAnalysis",
291
+ "SecurityAIProvider",
292
+ "AnalysisResult",
293
+ "HealthReport",
294
+ "ProviderRegistry",
295
+ "get_provider_registry",
296
+ "AISecuraClient",
297
+ "LocalAISecuraAdapter",
298
+ "APIIntelligence",
299
+ "APIAnalysis",
300
+ "APIRISClient",
301
+ "LocalAPIRISAdapter",
302
+ "MCPGateway",
303
+ "MCPMessage",
304
+ "HTTPGateway",
305
+ "HTTPInterceptedResponse",
306
+ "ApprovalManager",
307
+ "ApprovalRequest",
308
+ "ApprovalStatus",
309
+ "StorageBackend",
310
+ "SQLiteStorage",
311
+ "PostgresStorage",
312
+ "SIEMExporter",
313
+ "SIEMFormat",
314
+ "OllamaAISecuraAdapter",
315
+ "AISecuraAnalysis",
316
+ "ThreatSeverity",
317
+ "IntentAlignment",
318
+ "AIRecommendation",
319
+ "AttackTechnique",
320
+ "EvidenceTriad",
321
+ "AuthorityAnalysis",
322
+ "LLMConfig",
323
+ # Phase 4 Offensive Validation Engine
324
+ "AttackCase",
325
+ "AttackType",
326
+ "ExpectedBehavior",
327
+ "SafetyClass",
328
+ "AttackTarget",
329
+ "TargetEnvironment",
330
+ "TargetRegistry",
331
+ "target_registry",
332
+ "SafetyValidator",
333
+ "SafetyValidationResult",
334
+ "safety_validator",
335
+ "AttackStatus",
336
+ "ExecutionEvidence",
337
+ "OffensiveAttackResult",
338
+ "AttackEvaluator",
339
+ "MutationEngine",
340
+ "MutationStrategy",
341
+ "AttackCampaign",
342
+ "CampaignSummary",
343
+ "AttackCorpus",
344
+ "attack_corpus",
345
+ "AIAttackGenerator",
346
+ "VulnerableDemoTarget",
347
+ "OffensiveEngine",
348
+ # Phase 5 Adaptive Offensive Security Validation
349
+ "SecurityAnalysisEvidence",
350
+ "AdaptiveEngine",
351
+ "CampaignMemory",
352
+ # Phase 6.5 — Forensic Intelligence + Product API
353
+ "ForensicService",
354
+ "ForensicQueryEngine",
355
+ "AgentAccessProfile",
356
+ "ResourceAccessProfile",
357
+ "AccessAttempt",
358
+ "ActualAccess",
359
+ "AccessSnapshot",
360
+ "AccessDiff",
361
+ "ForensicExplanation",
362
+ "AttackForensicReport",
363
+ "ForensicIncident",
364
+ "IncidentType",
365
+ "IncidentSeverity",
366
+ "AccessMatrix",
367
+ "ApiService",
368
+ "SecurityPrincipal",
369
+ "AgentAccessResponse",
370
+ "ResourceAccessResponse",
371
+ "AccessMatrixResponse",
372
+ "OverviewResponse",
373
+ "AttackForensicsResponse",
374
+ "IncidentResponse",
375
+ "ErrorResponse",
376
+ "HealthResponse",
377
+ # Phase 9 — Continuous Security Control Plane
378
+ "SecurityPostureSnapshot",
379
+ "PostureRating",
380
+ "FindingSeverity",
381
+ "PostureFinding",
382
+ "PostureDimensionMetrics",
383
+ "PostureDiff",
384
+ "PostureEngine",
385
+ "PostureDiffEngine",
386
+ "PostureRuleEvaluator",
387
+ "SecurityIncident",
388
+ "IncidentState",
389
+ "IncidentStateMachine",
390
+ "IncidentTimelineEntry",
391
+ "IncidentEngine",
392
+ "IncidentCreationRule",
393
+ "ResponseActionType",
394
+ "ResponseActionRecord",
395
+ "AuthorityChangeEvent",
396
+ "ResponseEngine",
397
+ "DriftCategory",
398
+ "DriftSeverity",
399
+ "DriftEvent",
400
+ "AgentBehaviorBaseline",
401
+ "BehavioralBaselineTracker",
402
+ "AuthorityDriftDetector",
403
+ "AccessDriftDetector",
404
+ "ContextDriftDetector",
405
+ "GateStatus",
406
+ "GateCheckRule",
407
+ "SecurityGateResult",
408
+ "SecurityGateEvaluator",
409
+ "security_gate",
410
+ # Threat Modeling
411
+ "ThreatAnalyzer",
412
+ "ThreatReportRenderer",
413
+ "ThreatModelExporter",
414
+ "ThreatModel",
415
+ "ThreatAnalysisResult",
416
+ "ThreatSeverity",
417
+ "ThreatCategory",
418
+ "Asset",
419
+ "AssetSensitivity",
420
+ "ThreatActor",
421
+ "ActorType",
422
+ "TrustBoundary",
423
+ "BoundaryType",
424
+ "Threat",
425
+ "AttackScenario",
426
+ # Backward Compatibility Aliases
427
+ "AgentGuard",
428
+ "AgentGuardConfig",
429
+ ]
430
+
431
+ # Backward compatibility aliases
432
+ AgentGuard = ActShield
433
+ AgentGuardConfig = ActShieldConfig
434
+
435
+
436
+
437
+
438
+
439
+
actshield/__main__.py ADDED
@@ -0,0 +1,46 @@
1
+ """ActShield package __main__ entrypoint."""
2
+ from __future__ import annotations
3
+
4
+ from typing import Any, Optional
5
+ from actshield.cli.main import app, main
6
+ from actshield.offensive import attack_corpus, OffensiveEngine
7
+
8
+
9
+ def cli_attack_list() -> int:
10
+ """Compatibility handler for Phase 4 test suite."""
11
+ attacks = attack_corpus.get_all_attacks()
12
+ return 0 if len(attacks) > 0 else 1
13
+
14
+
15
+ def cli_attack_run(args: Any) -> int:
16
+ """Compatibility handler for running attack cases."""
17
+ engine = OffensiveEngine()
18
+ limit = getattr(args, "limit", 5) or 5
19
+ atype = getattr(args, "type", None)
20
+ attacks = attack_corpus.get_all_attacks()
21
+ if atype:
22
+ attacks = [c for c in attacks if c.attack_type.value == atype or c.attack_type == atype]
23
+ attacks = attacks[:limit]
24
+ for c in attacks:
25
+ engine.execute_attack(c)
26
+ return 0
27
+
28
+
29
+ def cli_attack_replay(attack_id: str) -> int:
30
+ """Compatibility handler for attack replay."""
31
+ engine = OffensiveEngine()
32
+ case = attack_corpus.get_attack(attack_id)
33
+ if case:
34
+ engine.execute_attack(case)
35
+ return 0
36
+
37
+
38
+ def cli_attack_report() -> int:
39
+ """Compatibility handler for attack reporting."""
40
+ return 0
41
+
42
+
43
+ if __name__ == "__main__":
44
+ main()
45
+
46
+
@@ -0,0 +1,12 @@
1
+ """Agents package exposing Agent, AgentIdentity, AgentCapability, and AgentTrustLevel."""
2
+
3
+ from actshield.agents.agent import Agent
4
+ from actshield.agents.identity import AgentCapability, AgentIdentity, AgentTrustLevel
5
+
6
+ __all__ = [
7
+ "Agent",
8
+ "AgentIdentity",
9
+ "AgentCapability",
10
+ "AgentTrustLevel",
11
+ ]
12
+
@@ -0,0 +1,200 @@
1
+ """Agent runtime instance and orchestration interface."""
2
+
3
+ from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Union
4
+ from datetime import datetime, timezone
5
+ import inspect
6
+ from actshield.agents.identity import AgentCapability, AgentIdentity, AgentStatus, AgentTrustLevel
7
+ from actshield.tracing.events import EventType
8
+
9
+ if TYPE_CHECKING:
10
+ from actshield.client import ActShield
11
+ from actshield.delegation.delegation import DelegationScope
12
+ from actshield.tracing.correlation import SpanScope
13
+
14
+
15
+ class Agent:
16
+ """Represents a registered AI Agent within the ActShield platform."""
17
+
18
+ def __init__(self, identity: AgentIdentity, guard: Optional["ActShield"] = None) -> None:
19
+ self.identity = identity
20
+ self.guard = guard
21
+ now_iso = datetime.now(timezone.utc).isoformat()
22
+ if not self.identity.created_at:
23
+ self.identity.created_at = now_iso
24
+ if not self.identity.last_seen:
25
+ self.identity.last_seen = now_iso
26
+
27
+ @property
28
+ def agent_id(self) -> str:
29
+ return self.identity.agent_id
30
+
31
+ @property
32
+ def name(self) -> str:
33
+ return self.identity.name
34
+
35
+ @property
36
+ def framework(self) -> str:
37
+ return self.identity.framework
38
+
39
+ @property
40
+ def version(self) -> str:
41
+ return self.identity.version
42
+
43
+ @property
44
+ def status(self) -> AgentStatus:
45
+ return self.identity.status
46
+
47
+ @property
48
+ def trust_level(self) -> AgentTrustLevel:
49
+ return self.identity.trust_level
50
+
51
+ @property
52
+ def capabilities(self) -> List[AgentCapability]:
53
+ return self.identity.capabilities
54
+
55
+ @property
56
+ def parent_agent_id(self) -> Optional[str]:
57
+ return self.identity.parent_agent_id
58
+
59
+ @property
60
+ def current_task(self) -> Optional[str]:
61
+ return self.identity.current_task
62
+
63
+ @property
64
+ def owner_context(self) -> Optional[str]:
65
+ return self.identity.owner_context
66
+
67
+ @property
68
+ def created_at(self) -> Optional[str]:
69
+ return self.identity.created_at
70
+
71
+ @property
72
+ def last_seen(self) -> Optional[str]:
73
+ return self.identity.last_seen
74
+
75
+ @property
76
+ def metadata(self) -> Dict[str, Any]:
77
+ return self.identity.metadata
78
+
79
+ def set_status(self, status: Union[str, AgentStatus]) -> None:
80
+ """Update agent operational status."""
81
+ if isinstance(status, str):
82
+ status = AgentStatus(status.lower())
83
+ self.identity.status = status
84
+ self.touch()
85
+ if self.guard:
86
+ self.guard.emit_event(
87
+ event_type=EventType.SECURITY_ALERT,
88
+ agent_id=self.agent_id,
89
+ payload={"action": "agent_status_change", "status": status.value},
90
+ )
91
+
92
+ def touch(self) -> None:
93
+ """Update last seen timestamp."""
94
+ self.identity.last_seen = datetime.now(timezone.utc).isoformat()
95
+
96
+ def set_task(self, task_name_or_id: Optional[str]) -> None:
97
+ """Set active task."""
98
+ self.identity.current_task = task_name_or_id
99
+ self.touch()
100
+
101
+ def has_capability(self, capability_name: str) -> bool:
102
+ """Check if this agent holds the specified capability."""
103
+ return self.identity.has_capability(capability_name)
104
+
105
+ def capability_names(self) -> List[str]:
106
+ """Return list of declared capability names."""
107
+ return self.identity.capability_names()
108
+
109
+ def delegate(
110
+ self,
111
+ delegate: Optional["Agent"] = None,
112
+ capabilities: Optional[List[Union[str, AgentCapability]]] = None,
113
+ constraints: Optional[Dict[str, Any]] = None,
114
+ to_agent: Optional["Agent"] = None,
115
+ ) -> "DelegationScope":
116
+ """Delegate a subset of authority/capabilities to a target agent within a scoped context."""
117
+ target = delegate or to_agent
118
+ if target is None:
119
+ raise ValueError("Target delegate agent must be provided to delegate().")
120
+ if self.guard is None:
121
+ raise RuntimeError("Agent is not attached to an ActShield instance.")
122
+
123
+ self.touch()
124
+ return self.guard._create_delegation_scope(
125
+ delegator=self,
126
+ delegate=target,
127
+ capabilities=capabilities,
128
+ constraints=constraints,
129
+ )
130
+
131
+ def invoke(self, fn: Callable[..., Any], *args: Any, **kwargs: Any) -> Any:
132
+ """Invoke a synchronous function within this agent's execution context."""
133
+ self.touch()
134
+ if self.guard is None:
135
+ return fn(*args, **kwargs)
136
+
137
+ with self.guard.span(name=f"agent_invoke:{self.name}", agent_id=self.agent_id):
138
+ self.guard.emit_event(
139
+ event_type=EventType.AGENT_INVOKED,
140
+ agent_id=self.agent_id,
141
+ payload={
142
+ "agent_name": self.name,
143
+ "function": getattr(fn, "__name__", str(fn)),
144
+ }
145
+ )
146
+ return fn(*args, **kwargs)
147
+
148
+ async def ainvoke(self, fn: Callable[..., Any], *args: Any, **kwargs: Any) -> Any:
149
+ """Invoke an asynchronous function within this agent's execution context."""
150
+ self.touch()
151
+ if self.guard is None:
152
+ if inspect.iscoroutinefunction(fn):
153
+ return await fn(*args, **kwargs)
154
+ return fn(*args, **kwargs)
155
+
156
+ with self.guard.span(name=f"agent_ainvoke:{self.name}", agent_id=self.agent_id):
157
+ self.guard.emit_event(
158
+ event_type=EventType.AGENT_INVOKED,
159
+ agent_id=self.agent_id,
160
+ payload={
161
+ "agent_name": self.name,
162
+ "function": getattr(fn, "__name__", str(fn)),
163
+ }
164
+ )
165
+ if inspect.iscoroutinefunction(fn):
166
+ return await fn(*args, **kwargs)
167
+ return fn(*args, **kwargs)
168
+
169
+ def __call__(self, fn: Callable[..., Any]) -> Callable[..., Any]:
170
+ """Allow Agent instance to be used directly as a decorator."""
171
+ import functools
172
+ @functools.wraps(fn)
173
+ def wrapper(*args: Any, **kwargs: Any) -> Any:
174
+ if self.guard:
175
+ with self.guard.agent_context(self.agent_id):
176
+ if inspect.iscoroutinefunction(fn):
177
+ return self.ainvoke(fn, *args, **kwargs)
178
+ return self.invoke(fn, *args, **kwargs)
179
+ else:
180
+ if inspect.iscoroutinefunction(fn):
181
+ return fn(*args, **kwargs)
182
+ return fn(*args, **kwargs)
183
+ wrapper.agent = self # type: ignore
184
+ return wrapper
185
+
186
+ def __enter__(self) -> "Agent":
187
+ if self.guard:
188
+ self._scope = self.guard.span(name=f"agent_scope:{self.name}", agent_id=self.agent_id)
189
+ self._scope.__enter__()
190
+ self.touch()
191
+ return self
192
+
193
+ def __exit__(self, exc_type: Any, exc_val: Any, exc_tb: Any) -> None:
194
+ if hasattr(self, "_scope") and self._scope:
195
+ self._scope.__exit__(exc_type, exc_val, exc_tb)
196
+
197
+ def __repr__(self) -> str:
198
+ return f"<Agent id='{self.agent_id}' name='{self.name}' status='{self.status.value}' trust='{self.trust_level.value}'>"
199
+
200
+