aigis-cli 2.1.1__tar.gz → 3.0.1__tar.gz
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.
- {aigis_cli-2.1.1 → aigis_cli-3.0.1}/PKG-INFO +66 -5
- {aigis_cli-2.1.1 → aigis_cli-3.0.1}/README.md +65 -4
- aigis_cli-3.0.1/aigis_cli/SKILL.md +40 -0
- {aigis_cli-2.1.1 → aigis_cli-3.0.1}/aigis_cli/__init__.py +1 -1
- aigis_cli-3.0.1/aigis_cli/atlas.py +285 -0
- {aigis_cli-2.1.1 → aigis_cli-3.0.1}/aigis_cli/auto_verify.py +271 -18
- {aigis_cli-2.1.1 → aigis_cli-3.0.1}/aigis_cli/build.py +75 -8
- {aigis_cli-2.1.1 → aigis_cli-3.0.1}/aigis_cli/classify.py +61 -7
- {aigis_cli-2.1.1 → aigis_cli-3.0.1}/aigis_cli/cli.py +210 -38
- aigis_cli-3.0.1/aigis_cli/content/index/atlas-NOTICE.md +238 -0
- aigis_cli-3.0.1/aigis_cli/content/index/atlas-entry-points.json +15 -0
- aigis_cli-3.0.1/aigis_cli/content/index/atlas.json +2694 -0
- {aigis_cli-2.1.1 → aigis_cli-3.0.1}/aigis_cli/content/index/audit-scan.md +6 -0
- {aigis_cli-2.1.1 → aigis_cli-3.0.1}/aigis_cli/content/index/auto-verify-rules.json +139 -0
- {aigis_cli-2.1.1 → aigis_cli-3.0.1}/aigis_cli/content/index/taxonomy.md +1 -1
- aigis_cli-3.0.1/aigis_cli/content/skills/areas/agent-permissions.md +228 -0
- aigis_cli-3.0.1/aigis_cli/content/skills/areas/agent-tool-safety.md +217 -0
- {aigis_cli-2.1.1 → aigis_cli-3.0.1}/aigis_cli/content/skills/areas/audit-logging.md +1 -0
- {aigis_cli-2.1.1 → aigis_cli-3.0.1}/aigis_cli/content/skills/areas/bias-monitoring.md +1 -0
- {aigis_cli-2.1.1 → aigis_cli-3.0.1}/aigis_cli/content/skills/areas/confidence-scoring.md +1 -0
- {aigis_cli-2.1.1 → aigis_cli-3.0.1}/aigis_cli/content/skills/areas/data-integrity.md +1 -0
- {aigis_cli-2.1.1 → aigis_cli-3.0.1}/aigis_cli/content/skills/areas/explainability.md +1 -0
- {aigis_cli-2.1.1 → aigis_cli-3.0.1}/aigis_cli/content/skills/areas/fallback-patterns.md +1 -0
- {aigis_cli-2.1.1 → aigis_cli-3.0.1}/aigis_cli/content/skills/areas/human-oversight.md +1 -0
- {aigis_cli-2.1.1 → aigis_cli-3.0.1}/aigis_cli/content/skills/areas/input-validation.md +1 -0
- {aigis_cli-2.1.1 → aigis_cli-3.0.1}/aigis_cli/content/skills/areas/monitoring.md +1 -0
- {aigis_cli-2.1.1 → aigis_cli-3.0.1}/aigis_cli/content/skills/areas/output-sanitization.md +1 -0
- {aigis_cli-2.1.1 → aigis_cli-3.0.1}/aigis_cli/content/skills/areas/pii-handling.md +1 -0
- {aigis_cli-2.1.1 → aigis_cli-3.0.1}/aigis_cli/content/skills/areas/prompt-security.md +1 -0
- {aigis_cli-2.1.1 → aigis_cli-3.0.1}/aigis_cli/content/skills/areas/rag-security.md +1 -0
- {aigis_cli-2.1.1 → aigis_cli-3.0.1}/aigis_cli/content/skills/areas/rate-limiting.md +1 -0
- {aigis_cli-2.1.1 → aigis_cli-3.0.1}/aigis_cli/content/skills/areas/supply-chain.md +1 -0
- {aigis_cli-2.1.1 → aigis_cli-3.0.1}/aigis_cli/content/skills/core.md +15 -0
- aigis_cli-3.0.1/aigis_cli/content/templates/threat-model.md +80 -0
- aigis_cli-3.0.1/aigis_cli/content/verify/checklist-agent-permissions.md +16 -0
- aigis_cli-3.0.1/aigis_cli/content/verify/checklist-agent-tool-safety.md +15 -0
- {aigis_cli-2.1.1 → aigis_cli-3.0.1}/aigis_cli/report.py +28 -4
- {aigis_cli-2.1.1 → aigis_cli-3.0.1}/aigis_cli/search.py +5 -2
- aigis_cli-3.0.1/aigis_cli/threats.py +360 -0
- {aigis_cli-2.1.1 → aigis_cli-3.0.1}/aigis_cli.egg-info/PKG-INFO +66 -5
- {aigis_cli-2.1.1 → aigis_cli-3.0.1}/aigis_cli.egg-info/SOURCES.txt +10 -0
- {aigis_cli-2.1.1 → aigis_cli-3.0.1}/pyproject.toml +1 -1
- aigis_cli-2.1.1/aigis_cli/SKILL.md +0 -70
- {aigis_cli-2.1.1 → aigis_cli-3.0.1}/LICENSE +0 -0
- {aigis_cli-2.1.1 → aigis_cli-3.0.1}/aigis_cli/annotate.py +0 -0
- {aigis_cli-2.1.1 → aigis_cli-3.0.1}/aigis_cli/checksum.py +0 -0
- {aigis_cli-2.1.1 → aigis_cli-3.0.1}/aigis_cli/content/index/context-rules.json +0 -0
- {aigis_cli-2.1.1 → aigis_cli-3.0.1}/aigis_cli/content/index/frameworks.md +0 -0
- {aigis_cli-2.1.1 → aigis_cli-3.0.1}/aigis_cli/content/index/guardrails.json +0 -0
- {aigis_cli-2.1.1 → aigis_cli-3.0.1}/aigis_cli/content/resolvers/triggers.json +0 -0
- {aigis_cli-2.1.1 → aigis_cli-3.0.1}/aigis_cli/content/skills/areas/eu-ai-act-art-13-deployer-transparency.md +0 -0
- {aigis_cli-2.1.1 → aigis_cli-3.0.1}/aigis_cli/content/skills/areas/eu-ai-act-art-50-transparency-disclosure.md +0 -0
- {aigis_cli-2.1.1 → aigis_cli-3.0.1}/aigis_cli/content/skills/areas/eu-ai-act-art-73-incident-reporting.md +0 -0
- {aigis_cli-2.1.1 → aigis_cli-3.0.1}/aigis_cli/content/skills/areas/eu-ai-act-art-9-risk-management.md +0 -0
- {aigis_cli-2.1.1 → aigis_cli-3.0.1}/aigis_cli/content/skills/infrastructure/logging.md +0 -0
- {aigis_cli-2.1.1 → aigis_cli-3.0.1}/aigis_cli/content/skills/infrastructure/rate-limiting.md +0 -0
- {aigis_cli-2.1.1 → aigis_cli-3.0.1}/aigis_cli/content/skills/infrastructure/secrets.md +0 -0
- {aigis_cli-2.1.1 → aigis_cli-3.0.1}/aigis_cli/content/skills/workflows/fastapi-llm.md +0 -0
- {aigis_cli-2.1.1 → aigis_cli-3.0.1}/aigis_cli/content/templates/ai-impact-assessment.md +0 -0
- {aigis_cli-2.1.1 → aigis_cli-3.0.1}/aigis_cli/content/templates/eu-ai-act-annex-iv.md +0 -0
- {aigis_cli-2.1.1 → aigis_cli-3.0.1}/aigis_cli/content/templates/intended-purpose-doc.md +0 -0
- {aigis_cli-2.1.1 → aigis_cli-3.0.1}/aigis_cli/content/templates/risk-characterization.md +0 -0
- {aigis_cli-2.1.1 → aigis_cli-3.0.1}/aigis_cli/content/templates/third-party-assessment.md +0 -0
- {aigis_cli-2.1.1 → aigis_cli-3.0.1}/aigis_cli/content/verify/checklist-audit-logging.md +0 -0
- {aigis_cli-2.1.1 → aigis_cli-3.0.1}/aigis_cli/content/verify/checklist-bias-monitoring.md +0 -0
- {aigis_cli-2.1.1 → aigis_cli-3.0.1}/aigis_cli/content/verify/checklist-confidence-scoring.md +0 -0
- {aigis_cli-2.1.1 → aigis_cli-3.0.1}/aigis_cli/content/verify/checklist-data-integrity.md +0 -0
- {aigis_cli-2.1.1 → aigis_cli-3.0.1}/aigis_cli/content/verify/checklist-explainability.md +0 -0
- {aigis_cli-2.1.1 → aigis_cli-3.0.1}/aigis_cli/content/verify/checklist-fallback-patterns.md +0 -0
- {aigis_cli-2.1.1 → aigis_cli-3.0.1}/aigis_cli/content/verify/checklist-human-oversight.md +0 -0
- {aigis_cli-2.1.1 → aigis_cli-3.0.1}/aigis_cli/content/verify/checklist-input-validation.md +0 -0
- {aigis_cli-2.1.1 → aigis_cli-3.0.1}/aigis_cli/content/verify/checklist-monitoring.md +0 -0
- {aigis_cli-2.1.1 → aigis_cli-3.0.1}/aigis_cli/content/verify/checklist-output-sanitization.md +0 -0
- {aigis_cli-2.1.1 → aigis_cli-3.0.1}/aigis_cli/content/verify/checklist-pii-handling.md +0 -0
- {aigis_cli-2.1.1 → aigis_cli-3.0.1}/aigis_cli/content/verify/checklist-prompt-security.md +0 -0
- {aigis_cli-2.1.1 → aigis_cli-3.0.1}/aigis_cli/content/verify/checklist-rag-security.md +0 -0
- {aigis_cli-2.1.1 → aigis_cli-3.0.1}/aigis_cli/content/verify/checklist-rate-limiting.md +0 -0
- {aigis_cli-2.1.1 → aigis_cli-3.0.1}/aigis_cli/content/verify/checklist-supply-chain.md +0 -0
- {aigis_cli-2.1.1 → aigis_cli-3.0.1}/aigis_cli/fetch.py +0 -0
- {aigis_cli-2.1.1 → aigis_cli-3.0.1}/aigis_cli/init_ide.py +0 -0
- {aigis_cli-2.1.1 → aigis_cli-3.0.1}/aigis_cli/jurisdiction.py +0 -0
- {aigis_cli-2.1.1 → aigis_cli-3.0.1}/aigis_cli/keywords.py +0 -0
- {aigis_cli-2.1.1 → aigis_cli-3.0.1}/aigis_cli.egg-info/dependency_links.txt +0 -0
- {aigis_cli-2.1.1 → aigis_cli-3.0.1}/aigis_cli.egg-info/entry_points.txt +0 -0
- {aigis_cli-2.1.1 → aigis_cli-3.0.1}/aigis_cli.egg-info/requires.txt +0 -0
- {aigis_cli-2.1.1 → aigis_cli-3.0.1}/aigis_cli.egg-info/top_level.txt +0 -0
- {aigis_cli-2.1.1 → aigis_cli-3.0.1}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: aigis-cli
|
|
3
|
-
Version:
|
|
3
|
+
Version: 3.0.1
|
|
4
4
|
Summary: AI governance guardrails for coding agents. Framework-aligned security and compliance patterns from NIST AI RMF, OWASP Top 10 for LLMs, and ISO/IEC 42001.
|
|
5
5
|
License-Expression: MIT
|
|
6
6
|
Project-URL: Homepage, https://github.com/NayanKanaparthi/aigis
|
|
@@ -29,10 +29,36 @@ Dynamic: license-file
|
|
|
29
29
|
|
|
30
30
|
**AI governance that ships with your code.**
|
|
31
31
|
|
|
32
|
-
Aigis
|
|
32
|
+
Aigis now understands how attackers attack AI systems and helps your agent build defenses against them.
|
|
33
|
+
|
|
34
|
+
Aigis sits between you and your coding agent (Cursor, Claude Code, GitHub Copilot, Windsurf) and gives the agent curated AI governance patterns mapped to NIST AI RMF, OWASP Top 10 for LLMs, ISO/IEC 42001, and the EU AI Act, with threat modeling from MITRE ATLAS.
|
|
33
35
|
|
|
34
36
|
You don't run Aigis. Your agent does. After one setup command, you describe what you're building and your agent picks the right governance patterns, implements them, and verifies the result, all in the same chat where you write code.
|
|
35
37
|
|
|
38
|
+
## What's new in v3.0
|
|
39
|
+
|
|
40
|
+
- **Two new areas for agentic systems.** `agent-permissions` covers agent identity, tool permissions and authority limits. `agent-tool-safety` covers tool invocation safety, validation of tool inputs and outputs, and scope drift.
|
|
41
|
+
- **`aigis classify` recommends both new areas when a system is agentic** (`is-agentic`). Builds, audits and reports for agentic projects include them too.
|
|
42
|
+
- **3.0 is additive: no command, flag or JSON key was removed or renamed.**
|
|
43
|
+
- Aigis now ships 21 governance areas and 17 verify checklists.
|
|
44
|
+
- **MITRE ATLAS mitigations cited** by `aigis classify`, `aigis verify --auto`, `aigis report` and `aigis build`, next to the existing OWASP, NIST and ISO citations.
|
|
45
|
+
- **`aigis threats`** builds a threat model from your traits: attacker techniques for your entry points, the mitigations MITRE links to each, the Aigis areas that help implement each one (in part), and the gaps.
|
|
46
|
+
- **`aigis template threat-model`**, a fill-in threat model worksheet.
|
|
47
|
+
- **Your agent is instructed to threat-model on its own.** The core skill that `aigis init` writes tells the agent when to run `aigis threats` without being asked, and `aigis audit --scan` has a new threat model phase.
|
|
48
|
+
- **Pinned ATLAS v2026.10 data, offline.** The catalog ships inside the package. No network calls.
|
|
49
|
+
|
|
50
|
+
### Results
|
|
51
|
+
|
|
52
|
+
Tested with a real coding agent building agent features from plain requests, with no Aigis, with Aigis 2.1.1 and with Aigis 3.0 (6 runs each), all graded in one blind pass:
|
|
53
|
+
|
|
54
|
+
| | No Aigis | Aigis 2.1.1 | Aigis 3.0 |
|
|
55
|
+
|---|---|---|---|
|
|
56
|
+
| Agent-safety defenses present in the code | 43% | 75% | **90%** |
|
|
57
|
+
| Agent ran a threat model on its own | n/a | 0 of 6 | **6 of 6** |
|
|
58
|
+
| Agent told the user about uncovered gaps | n/a | 1 of 6 | **6 of 6** |
|
|
59
|
+
|
|
60
|
+
Every MITRE ATLAS reference Aigis prints matched MITRE's own data (9,604 checked). Small sample; method, limits and a correction to the first published numbers in [`BENCHMARKS.md`](BENCHMARKS.md).
|
|
61
|
+
|
|
36
62
|
## Install
|
|
37
63
|
|
|
38
64
|
```bash
|
|
@@ -54,6 +80,8 @@ Open the project in your IDE. In the agent chat, just describe what you're build
|
|
|
54
80
|
|
|
55
81
|
> *Build me an EU AI Act compliant customer support chatbot for an e-commerce site. Use aigis to figure out the governance patterns and apply them.*
|
|
56
82
|
|
|
83
|
+
Building an agent that can take actions, like sending email or querying a database? Ask for the feature in plain words. Your agent is instructed to run `aigis threats` on its own, fetch the defenses that apply, and tell you about any gaps.
|
|
84
|
+
|
|
57
85
|
Your agent will read `.cursorrules`, classify the description against the resolver, fetch the relevant procedures, and implement them, invoking `aigis` itself as it works:
|
|
58
86
|
|
|
59
87
|

|
|
@@ -91,6 +119,27 @@ Both surfaces read a single `.aigisrc.json` config:
|
|
|
91
119
|
|
|
92
120
|
The CI workflow runs `aigis verify` on every PR; the pre-commit hook runs it before each commit. Configure once, both run.
|
|
93
121
|
|
|
122
|
+
## Threat modeling with MITRE ATLAS
|
|
123
|
+
|
|
124
|
+
OWASP says what can go wrong. MITRE ATLAS says how an attacker does it. NIST AI RMF says how you govern it.
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
aigis threats --traits uses-llm,uses-rag,is-agentic
|
|
128
|
+
aigis threats "<description>"
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
`--traits` is the reliable path. The description path only finds traits the resolver recognizes.
|
|
132
|
+
|
|
133
|
+
What you get: the techniques for your entry points, Realized first (seen in real attacks); the mitigations MITRE links to each technique; the Aigis areas that help implement each mitigation (in part); and the gaps, mitigations with no mapped Aigis area. `--redteam` adds test stubs, `--json` is for scripts.
|
|
134
|
+
|
|
135
|
+
When: designing an AI feature; adding a capability (tools, write access, memory, a new data source); before launch; after an incident. Your agent is instructed to do this at those moments without being asked, and you can run it yourself at any time.
|
|
136
|
+
|
|
137
|
+
What ships: a pinned subset of ATLAS v2026.10 (16 tactics, 221 techniques, 44 mitigations, counts from 77 case studies). No network calls. Aigis areas currently map to 21 of the 44 mitigations.
|
|
138
|
+
|
|
139
|
+
The mapping from areas to mitigations is ours. The links from mitigations to techniques are MITRE's. The entry points come from a reviewed map of 9 traits to 29 techniques.
|
|
140
|
+
|
|
141
|
+
Limits: MITRE ATLAS is a threat catalog, not a standard. Nobody is "ATLAS compliant". It does not score risk, and it does not cover bias or fairness. A cited mitigation means the area helps implement it (in part). The technique list is a starting point based on your traits, not proof of coverage.
|
|
142
|
+
|
|
94
143
|
## What's new in v2.1
|
|
95
144
|
|
|
96
145
|
- **EU AI Act mapping** — Articles 9, 10, 12, 13, 14, 15, 50, 72, 73 mapped to runnable governance patterns, plus an Annex IV technical documentation template
|
|
@@ -138,6 +187,11 @@ aigis report --from-classify "<desc>" --jurisdiction eu --output audit.md
|
|
|
138
187
|
aigis audit --scan # discovery prompt for auditing existing code
|
|
139
188
|
aigis audit --traits <list> # scoped audit with deterministic denominator
|
|
140
189
|
|
|
190
|
+
# Threat modeling (MITRE ATLAS)
|
|
191
|
+
aigis threats --traits <list> # techniques, MITRE mitigations, Aigis areas, gaps
|
|
192
|
+
aigis threats "<description>" --redteam # same from a description, plus red-team test stubs
|
|
193
|
+
aigis template threat-model # threat model worksheet
|
|
194
|
+
|
|
141
195
|
# Misc
|
|
142
196
|
aigis search --list # list all available areas
|
|
143
197
|
aigis traits # list classification traits
|
|
@@ -152,15 +206,22 @@ Run `aigis --help` for full options.
|
|
|
152
206
|
- **Not a security audit.** `aigis verify` is heuristic regex over your source. It catches common misimplementations; it doesn't replace SAST, code review, or penetration testing.
|
|
153
207
|
- **Doesn't run your code or call your APIs.** The agent does the work. Aigis provides the brief, the verifier, and the audit doc.
|
|
154
208
|
- **Local. No cloud. No telemetry.** Aigis ships nothing back to a server. Your descriptions, your code, and your verify results stay on your machine.
|
|
209
|
+
- **Not a penetration test.** `aigis threats` lists known techniques for your traits. It does not attack or test your system.
|
|
155
210
|
|
|
156
211
|
## Benchmark results
|
|
157
212
|
|
|
213
|
+
### v3.0
|
|
214
|
+
|
|
215
|
+
See [Results](#results) above. Full method, per-defense tables and limits: [`BENCHMARKS.md`](BENCHMARKS.md).
|
|
216
|
+
|
|
217
|
+
### v2.0
|
|
218
|
+
|
|
158
219
|
v2.0 was benchmarked at every iteration. Final numbers, against the same 10 descriptions:
|
|
159
220
|
|
|
160
|
-
- Baseline (
|
|
221
|
+
- Baseline (Aigis v1.0.3): P=0.737, R=0.905, F1=0.790
|
|
161
222
|
- v2.0 (`aigis build`): P=0.847, R=0.851, F1=0.837
|
|
162
223
|
|
|
163
|
-
F1 beats baseline by +0.047. v2.1 ships `--tight` as a flag-gated experiment; promotion to default
|
|
224
|
+
F1 beats baseline by +0.047. v2.1 ships `--tight` as a flag-gated experiment; promotion to default is pending a confirmation benchmark. Methodology, per-run tables, and the v2.1 manual end-to-end test live in the [`benchmarks/`](https://github.com/NayanKanaparthi/aigis) directory.
|
|
164
225
|
|
|
165
226
|
## Supported agents
|
|
166
227
|
|
|
@@ -179,4 +240,4 @@ See `CONTRIBUTING.md` for the full contributor workflow, including how to add ne
|
|
|
179
240
|
|
|
180
241
|
## License
|
|
181
242
|
|
|
182
|
-
MIT
|
|
243
|
+
Aigis is MIT licensed. The package also includes a copy of MITRE ATLAS data (`content/index/atlas.json`). That data belongs to MITRE and is shared under its own open license, which allows reuse as long as MITRE's notice and license text travel with it. Both are in `content/index/atlas-NOTICE.md` (Apache-2.0).
|
|
@@ -2,10 +2,36 @@
|
|
|
2
2
|
|
|
3
3
|
**AI governance that ships with your code.**
|
|
4
4
|
|
|
5
|
-
Aigis
|
|
5
|
+
Aigis now understands how attackers attack AI systems and helps your agent build defenses against them.
|
|
6
|
+
|
|
7
|
+
Aigis sits between you and your coding agent (Cursor, Claude Code, GitHub Copilot, Windsurf) and gives the agent curated AI governance patterns mapped to NIST AI RMF, OWASP Top 10 for LLMs, ISO/IEC 42001, and the EU AI Act, with threat modeling from MITRE ATLAS.
|
|
6
8
|
|
|
7
9
|
You don't run Aigis. Your agent does. After one setup command, you describe what you're building and your agent picks the right governance patterns, implements them, and verifies the result, all in the same chat where you write code.
|
|
8
10
|
|
|
11
|
+
## What's new in v3.0
|
|
12
|
+
|
|
13
|
+
- **Two new areas for agentic systems.** `agent-permissions` covers agent identity, tool permissions and authority limits. `agent-tool-safety` covers tool invocation safety, validation of tool inputs and outputs, and scope drift.
|
|
14
|
+
- **`aigis classify` recommends both new areas when a system is agentic** (`is-agentic`). Builds, audits and reports for agentic projects include them too.
|
|
15
|
+
- **3.0 is additive: no command, flag or JSON key was removed or renamed.**
|
|
16
|
+
- Aigis now ships 21 governance areas and 17 verify checklists.
|
|
17
|
+
- **MITRE ATLAS mitigations cited** by `aigis classify`, `aigis verify --auto`, `aigis report` and `aigis build`, next to the existing OWASP, NIST and ISO citations.
|
|
18
|
+
- **`aigis threats`** builds a threat model from your traits: attacker techniques for your entry points, the mitigations MITRE links to each, the Aigis areas that help implement each one (in part), and the gaps.
|
|
19
|
+
- **`aigis template threat-model`**, a fill-in threat model worksheet.
|
|
20
|
+
- **Your agent is instructed to threat-model on its own.** The core skill that `aigis init` writes tells the agent when to run `aigis threats` without being asked, and `aigis audit --scan` has a new threat model phase.
|
|
21
|
+
- **Pinned ATLAS v2026.10 data, offline.** The catalog ships inside the package. No network calls.
|
|
22
|
+
|
|
23
|
+
### Results
|
|
24
|
+
|
|
25
|
+
Tested with a real coding agent building agent features from plain requests, with no Aigis, with Aigis 2.1.1 and with Aigis 3.0 (6 runs each), all graded in one blind pass:
|
|
26
|
+
|
|
27
|
+
| | No Aigis | Aigis 2.1.1 | Aigis 3.0 |
|
|
28
|
+
|---|---|---|---|
|
|
29
|
+
| Agent-safety defenses present in the code | 43% | 75% | **90%** |
|
|
30
|
+
| Agent ran a threat model on its own | n/a | 0 of 6 | **6 of 6** |
|
|
31
|
+
| Agent told the user about uncovered gaps | n/a | 1 of 6 | **6 of 6** |
|
|
32
|
+
|
|
33
|
+
Every MITRE ATLAS reference Aigis prints matched MITRE's own data (9,604 checked). Small sample; method, limits and a correction to the first published numbers in [`BENCHMARKS.md`](BENCHMARKS.md).
|
|
34
|
+
|
|
9
35
|
## Install
|
|
10
36
|
|
|
11
37
|
```bash
|
|
@@ -27,6 +53,8 @@ Open the project in your IDE. In the agent chat, just describe what you're build
|
|
|
27
53
|
|
|
28
54
|
> *Build me an EU AI Act compliant customer support chatbot for an e-commerce site. Use aigis to figure out the governance patterns and apply them.*
|
|
29
55
|
|
|
56
|
+
Building an agent that can take actions, like sending email or querying a database? Ask for the feature in plain words. Your agent is instructed to run `aigis threats` on its own, fetch the defenses that apply, and tell you about any gaps.
|
|
57
|
+
|
|
30
58
|
Your agent will read `.cursorrules`, classify the description against the resolver, fetch the relevant procedures, and implement them, invoking `aigis` itself as it works:
|
|
31
59
|
|
|
32
60
|

|
|
@@ -64,6 +92,27 @@ Both surfaces read a single `.aigisrc.json` config:
|
|
|
64
92
|
|
|
65
93
|
The CI workflow runs `aigis verify` on every PR; the pre-commit hook runs it before each commit. Configure once, both run.
|
|
66
94
|
|
|
95
|
+
## Threat modeling with MITRE ATLAS
|
|
96
|
+
|
|
97
|
+
OWASP says what can go wrong. MITRE ATLAS says how an attacker does it. NIST AI RMF says how you govern it.
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
aigis threats --traits uses-llm,uses-rag,is-agentic
|
|
101
|
+
aigis threats "<description>"
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
`--traits` is the reliable path. The description path only finds traits the resolver recognizes.
|
|
105
|
+
|
|
106
|
+
What you get: the techniques for your entry points, Realized first (seen in real attacks); the mitigations MITRE links to each technique; the Aigis areas that help implement each mitigation (in part); and the gaps, mitigations with no mapped Aigis area. `--redteam` adds test stubs, `--json` is for scripts.
|
|
107
|
+
|
|
108
|
+
When: designing an AI feature; adding a capability (tools, write access, memory, a new data source); before launch; after an incident. Your agent is instructed to do this at those moments without being asked, and you can run it yourself at any time.
|
|
109
|
+
|
|
110
|
+
What ships: a pinned subset of ATLAS v2026.10 (16 tactics, 221 techniques, 44 mitigations, counts from 77 case studies). No network calls. Aigis areas currently map to 21 of the 44 mitigations.
|
|
111
|
+
|
|
112
|
+
The mapping from areas to mitigations is ours. The links from mitigations to techniques are MITRE's. The entry points come from a reviewed map of 9 traits to 29 techniques.
|
|
113
|
+
|
|
114
|
+
Limits: MITRE ATLAS is a threat catalog, not a standard. Nobody is "ATLAS compliant". It does not score risk, and it does not cover bias or fairness. A cited mitigation means the area helps implement it (in part). The technique list is a starting point based on your traits, not proof of coverage.
|
|
115
|
+
|
|
67
116
|
## What's new in v2.1
|
|
68
117
|
|
|
69
118
|
- **EU AI Act mapping** — Articles 9, 10, 12, 13, 14, 15, 50, 72, 73 mapped to runnable governance patterns, plus an Annex IV technical documentation template
|
|
@@ -111,6 +160,11 @@ aigis report --from-classify "<desc>" --jurisdiction eu --output audit.md
|
|
|
111
160
|
aigis audit --scan # discovery prompt for auditing existing code
|
|
112
161
|
aigis audit --traits <list> # scoped audit with deterministic denominator
|
|
113
162
|
|
|
163
|
+
# Threat modeling (MITRE ATLAS)
|
|
164
|
+
aigis threats --traits <list> # techniques, MITRE mitigations, Aigis areas, gaps
|
|
165
|
+
aigis threats "<description>" --redteam # same from a description, plus red-team test stubs
|
|
166
|
+
aigis template threat-model # threat model worksheet
|
|
167
|
+
|
|
114
168
|
# Misc
|
|
115
169
|
aigis search --list # list all available areas
|
|
116
170
|
aigis traits # list classification traits
|
|
@@ -125,15 +179,22 @@ Run `aigis --help` for full options.
|
|
|
125
179
|
- **Not a security audit.** `aigis verify` is heuristic regex over your source. It catches common misimplementations; it doesn't replace SAST, code review, or penetration testing.
|
|
126
180
|
- **Doesn't run your code or call your APIs.** The agent does the work. Aigis provides the brief, the verifier, and the audit doc.
|
|
127
181
|
- **Local. No cloud. No telemetry.** Aigis ships nothing back to a server. Your descriptions, your code, and your verify results stay on your machine.
|
|
182
|
+
- **Not a penetration test.** `aigis threats` lists known techniques for your traits. It does not attack or test your system.
|
|
128
183
|
|
|
129
184
|
## Benchmark results
|
|
130
185
|
|
|
186
|
+
### v3.0
|
|
187
|
+
|
|
188
|
+
See [Results](#results) above. Full method, per-defense tables and limits: [`BENCHMARKS.md`](BENCHMARKS.md).
|
|
189
|
+
|
|
190
|
+
### v2.0
|
|
191
|
+
|
|
131
192
|
v2.0 was benchmarked at every iteration. Final numbers, against the same 10 descriptions:
|
|
132
193
|
|
|
133
|
-
- Baseline (
|
|
194
|
+
- Baseline (Aigis v1.0.3): P=0.737, R=0.905, F1=0.790
|
|
134
195
|
- v2.0 (`aigis build`): P=0.847, R=0.851, F1=0.837
|
|
135
196
|
|
|
136
|
-
F1 beats baseline by +0.047. v2.1 ships `--tight` as a flag-gated experiment; promotion to default
|
|
197
|
+
F1 beats baseline by +0.047. v2.1 ships `--tight` as a flag-gated experiment; promotion to default is pending a confirmation benchmark. Methodology, per-run tables, and the v2.1 manual end-to-end test live in the [`benchmarks/`](https://github.com/NayanKanaparthi/aigis) directory.
|
|
137
198
|
|
|
138
199
|
## Supported agents
|
|
139
200
|
|
|
@@ -152,4 +213,4 @@ See `CONTRIBUTING.md` for the full contributor workflow, including how to add ne
|
|
|
152
213
|
|
|
153
214
|
## License
|
|
154
215
|
|
|
155
|
-
MIT
|
|
216
|
+
Aigis is MIT licensed. The package also includes a copy of MITRE ATLAS data (`content/index/atlas.json`). That data belongs to MITRE and is shared under its own open license, which allows reuse as long as MITRE's notice and license text travel with it. Both are in `content/index/atlas-NOTICE.md` (Apache-2.0).
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: aigis
|
|
3
|
+
description: AI governance for coding agents. Three-layer skill system (core, area, workflow) loaded on demand with the aigis CLI. Mapped to NIST AI RMF, OWASP Top 10 for LLMs and ISO/IEC 42001, with MITRE ATLAS threat modeling.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Aigis skill system
|
|
7
|
+
|
|
8
|
+
Aigis ships skills in three layers. Agents load them on demand with the CLI, not by reading this file.
|
|
9
|
+
|
|
10
|
+
## Layers
|
|
11
|
+
|
|
12
|
+
- **Core skill**: `content/skills/core.md`. `aigis init <ide>` writes it into the agent's rules file. It tells the agent when to use Aigis, the build and audit workflows, how to read verify output, and when to threat-model.
|
|
13
|
+
- **Area skills**: `content/skills/areas/<id>.md`, one per governance area (input-validation, pii-handling, agent-permissions and so on). 21 today, 17 of them with a verify checklist. Loaded by `aigis get <id>` when classify points the agent at that area.
|
|
14
|
+
- **Workflow skills**: `content/skills/workflows/<type>.md`. Loaded by `aigis workflow <type>` after classify identifies the project shape. `fastapi-llm` ships today.
|
|
15
|
+
|
|
16
|
+
## How an agent uses Aigis
|
|
17
|
+
|
|
18
|
+
After `aigis init` writes the core skill, the agent runs:
|
|
19
|
+
|
|
20
|
+
1. `aigis classify --traits <traits> --json` to get the risk tier, the recommended areas and a workflow suggestion.
|
|
21
|
+
2. `aigis workflow <type>` to get the file layout and wiring for the stack.
|
|
22
|
+
3. `aigis get <area>` and `aigis verify <area> --auto .` for each area, one at a time.
|
|
23
|
+
4. `aigis threats --traits <traits>` to build a threat model. It lists attacker techniques for the system's entry points (Realized first), the mitigations MITRE links to each, the Aigis areas that help implement each one (in part), and gaps. A gap is a mitigation with no mapped Aigis area. The agent fetches and verifies every area it names and tells the user about every gap.
|
|
24
|
+
|
|
25
|
+
To audit an existing project, the agent starts with `aigis audit --scan` instead.
|
|
26
|
+
|
|
27
|
+
MITRE ATLAS is a threat catalog, not a standard. Nobody is "ATLAS compliant". It does not score risk, and it does not cover bias or fairness.
|
|
28
|
+
|
|
29
|
+
See `content/skills/core.md` for the full text the agent sees.
|
|
30
|
+
|
|
31
|
+
## Setup per IDE
|
|
32
|
+
|
|
33
|
+
Run once in the project root:
|
|
34
|
+
|
|
35
|
+
- `aigis init cursor` writes `.cursorrules`
|
|
36
|
+
- `aigis init claude-code` writes `~/.claude/skills/aigis/SKILL.md`
|
|
37
|
+
- `aigis init windsurf` writes `.windsurfrules`
|
|
38
|
+
- `aigis init copilot` writes `.github/copilot-instructions.md`
|
|
39
|
+
|
|
40
|
+
All four receive the same content: `content/skills/core.md`. Area and workflow skills load on demand; they are not pre-installed into the rules file.
|
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
"""v3.0 MITRE ATLAS lookups over the vendored catalog. Mirror of lib/atlas.js.
|
|
2
|
+
|
|
3
|
+
Aigis owns two small judgments (D1): area -> ATLAS mitigations
|
|
4
|
+
(`controls.atlas` in area frontmatter) and trait -> entry-point techniques
|
|
5
|
+
(`content/index/atlas-entry-points.json`). Everything else (names, maturity,
|
|
6
|
+
tactics, mitigation -> technique links, case-study counts) is read from
|
|
7
|
+
`content/index/atlas.json`.
|
|
8
|
+
|
|
9
|
+
Rules (same as Node):
|
|
10
|
+
- Only MITRE's direct `mitigates` links are used (D6). No parent or child
|
|
11
|
+
inheritance.
|
|
12
|
+
- Ordering is maturity, then MITRE case-study count descending, then id
|
|
13
|
+
(D7). ATLAS does not rank threats and this module adds no ranking.
|
|
14
|
+
- Pure, synchronous, cached per path. No network, no clock, no randomness.
|
|
15
|
+
Every returned list or dict is a fresh copy.
|
|
16
|
+
- Load failures raise AtlasCatalogError; callers that must keep working
|
|
17
|
+
without ATLAS wrap their ATLAS code in with_atlas (D12).
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
from __future__ import annotations
|
|
21
|
+
|
|
22
|
+
import json
|
|
23
|
+
import sys
|
|
24
|
+
from pathlib import Path
|
|
25
|
+
from typing import Any, Callable
|
|
26
|
+
|
|
27
|
+
_CONTENT_DIR = Path(__file__).resolve().parent / "content"
|
|
28
|
+
CATALOG_PATH = _CONTENT_DIR / "index" / "atlas.json"
|
|
29
|
+
ENTRY_POINTS_PATH = _CONTENT_DIR / "index" / "atlas-entry-points.json"
|
|
30
|
+
AREAS_DIR = _CONTENT_DIR / "skills" / "areas"
|
|
31
|
+
|
|
32
|
+
PINNED = {
|
|
33
|
+
"version": "2026.10",
|
|
34
|
+
"sha256": "ac41ee9f99a47084ba5fdfc77ae83a28687e12390240fffeb37df7914ffe142d",
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
# The only place this sentence is typed in Python runtime code (S0, AC14).
|
|
38
|
+
DISCLAIMER = 'MITRE ATLAS is a threat catalog, not a standard. Nobody is "ATLAS compliant". It does not score risk, and it does not cover bias or fairness.'
|
|
39
|
+
|
|
40
|
+
MATURITY_RANK = {"Realized": 0, "Demonstrated": 1, "Feasible": 2}
|
|
41
|
+
_CATALOG_KEYS = ["source", "counts", "tactics", "techniques", "mitigations"]
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
class AtlasCatalogError(Exception):
|
|
45
|
+
def __init__(self, message: str, file: str, code: str):
|
|
46
|
+
super().__init__(message)
|
|
47
|
+
self.file = file
|
|
48
|
+
self.code = code
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
# ── Loading ─────────────────────────────────────────────────────────────
|
|
52
|
+
|
|
53
|
+
_catalog_cache: dict[str, Any] = {}
|
|
54
|
+
_entry_point_cache: dict[str, Any] = {}
|
|
55
|
+
_index_cache: dict[int, dict[str, list[str]]] = {}
|
|
56
|
+
_area_cache: dict[str, dict[str, list[str]]] = {}
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def _is_object(value: Any) -> bool:
|
|
60
|
+
return isinstance(value, dict)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def _read_json(filepath: Path, file: str) -> Any:
|
|
64
|
+
try:
|
|
65
|
+
raw = filepath.read_text(encoding="utf-8")
|
|
66
|
+
except (FileNotFoundError, NotADirectoryError):
|
|
67
|
+
raise AtlasCatalogError(f"Cannot read ATLAS {file} at {filepath}", file, "missing") from None
|
|
68
|
+
except Exception:
|
|
69
|
+
raise AtlasCatalogError(f"Cannot read ATLAS {file} at {filepath}", file, "corrupt") from None
|
|
70
|
+
try:
|
|
71
|
+
return json.loads(raw)
|
|
72
|
+
except Exception:
|
|
73
|
+
raise AtlasCatalogError(f"ATLAS {file} at {filepath} is not valid JSON", file, "corrupt") from None
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def load_catalog(path: str | Path | None = None) -> dict:
|
|
77
|
+
filepath = Path(path or CATALOG_PATH).resolve()
|
|
78
|
+
key = str(filepath)
|
|
79
|
+
if key in _catalog_cache:
|
|
80
|
+
return _catalog_cache[key]
|
|
81
|
+
|
|
82
|
+
data = _read_json(filepath, "catalog")
|
|
83
|
+
shape_ok = (
|
|
84
|
+
_is_object(data)
|
|
85
|
+
and all(k in data for k in _CATALOG_KEYS)
|
|
86
|
+
and _is_object(data["source"]) and _is_object(data["counts"]) and isinstance(data["tactics"], list)
|
|
87
|
+
and _is_object(data["techniques"]) and _is_object(data["mitigations"])
|
|
88
|
+
)
|
|
89
|
+
if not shape_ok:
|
|
90
|
+
raise AtlasCatalogError(f"ATLAS catalog at {filepath} is missing top-level keys", "catalog", "corrupt")
|
|
91
|
+
if data["source"].get("version") != PINNED["version"] or data["source"].get("sha256") != PINNED["sha256"]:
|
|
92
|
+
raise AtlasCatalogError(
|
|
93
|
+
f"ATLAS catalog at {filepath} is not the pinned release {PINNED['version']}", "catalog", "pin-mismatch")
|
|
94
|
+
_catalog_cache[key] = data
|
|
95
|
+
return data
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
def load_entry_points(path: str | Path | None = None) -> dict:
|
|
99
|
+
filepath = Path(path or ENTRY_POINTS_PATH).resolve()
|
|
100
|
+
key = str(filepath)
|
|
101
|
+
if key in _entry_point_cache:
|
|
102
|
+
return _entry_point_cache[key]
|
|
103
|
+
|
|
104
|
+
data = _read_json(filepath, "entry-points")
|
|
105
|
+
|
|
106
|
+
def corrupt(why: str) -> AtlasCatalogError:
|
|
107
|
+
return AtlasCatalogError(f"ATLAS entry points at {filepath}: {why}", "entry-points", "corrupt")
|
|
108
|
+
|
|
109
|
+
if not _is_object(data) or not _is_object(data.get("entry_points")):
|
|
110
|
+
raise corrupt("missing entry_points")
|
|
111
|
+
|
|
112
|
+
from .classify import ALL_TRAITS # lazy: classify imports this module
|
|
113
|
+
catalog = load_catalog()
|
|
114
|
+
for trait, entry in data["entry_points"].items():
|
|
115
|
+
if trait not in ALL_TRAITS:
|
|
116
|
+
raise corrupt(f"unknown trait {trait}")
|
|
117
|
+
if not _is_object(entry) or not isinstance(entry.get("techniques"), list):
|
|
118
|
+
raise corrupt(f"trait {trait} has no techniques list")
|
|
119
|
+
for tid in entry["techniques"]:
|
|
120
|
+
if not isinstance(tid, str) or tid not in catalog["techniques"]:
|
|
121
|
+
raise corrupt(f"trait {trait} names unknown technique {tid}")
|
|
122
|
+
if data.get("atlas_version") != PINNED["version"]:
|
|
123
|
+
raise AtlasCatalogError(
|
|
124
|
+
f"ATLAS entry points at {filepath} target {data.get('atlas_version')}, not {PINNED['version']}",
|
|
125
|
+
"entry-points", "pin-mismatch")
|
|
126
|
+
_entry_point_cache[key] = data
|
|
127
|
+
return data
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
def _mitigation_index(catalog: dict) -> dict[str, list[str]]:
|
|
131
|
+
"""Reverse index technique -> direct mitigation ids, built once per catalog."""
|
|
132
|
+
cid = id(catalog)
|
|
133
|
+
if cid in _index_cache:
|
|
134
|
+
return _index_cache[cid]
|
|
135
|
+
index: dict[str, list[str]] = {}
|
|
136
|
+
for mid in sorted(catalog["mitigations"].keys()):
|
|
137
|
+
for tid in catalog["mitigations"][mid].get("techniques") or []:
|
|
138
|
+
index.setdefault(tid, []).append(mid)
|
|
139
|
+
_index_cache[cid] = index
|
|
140
|
+
return index
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
# ── Catalog lookups ─────────────────────────────────────────────────────
|
|
144
|
+
|
|
145
|
+
def technique(tid: Any) -> dict | None:
|
|
146
|
+
catalog = load_catalog()
|
|
147
|
+
if not isinstance(tid, str) or tid not in catalog["techniques"]:
|
|
148
|
+
return None
|
|
149
|
+
t = catalog["techniques"][tid]
|
|
150
|
+
parent = t.get("parent") or None
|
|
151
|
+
parent_entry = catalog["techniques"].get(parent) if parent else None
|
|
152
|
+
tactic_names = {x["id"]: x["name"] for x in catalog["tactics"]}
|
|
153
|
+
return {
|
|
154
|
+
"id": tid,
|
|
155
|
+
"name": t["name"],
|
|
156
|
+
"display_name": f"{parent_entry['name']}: {t['name']}" if parent_entry else t["name"],
|
|
157
|
+
"maturity": t.get("maturity"),
|
|
158
|
+
"tactics": [{"id": x, "name": tactic_names.get(x, x)} for x in (t.get("tactics") or [])],
|
|
159
|
+
"parent": parent,
|
|
160
|
+
"case_studies": t.get("case_studies") or 0,
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
def mitigation(mid: Any) -> dict | None:
|
|
165
|
+
catalog = load_catalog()
|
|
166
|
+
if not isinstance(mid, str) or mid not in catalog["mitigations"]:
|
|
167
|
+
return None
|
|
168
|
+
m = catalog["mitigations"][mid]
|
|
169
|
+
return {"id": mid, "name": m["name"], "techniques": list(m.get("techniques") or [])}
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
def mitigations_for_technique(tid: str) -> list[dict]:
|
|
173
|
+
catalog = load_catalog()
|
|
174
|
+
mids = _mitigation_index(catalog).get(tid, [])
|
|
175
|
+
return [{"id": mid, "name": catalog["mitigations"][mid]["name"]} for mid in mids]
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
def technique_sort_key(t: dict) -> tuple:
|
|
179
|
+
"""Sort key equal to Node's compareTechniques."""
|
|
180
|
+
return (MATURITY_RANK.get(t.get("maturity"), 3), -(t.get("case_studies") or 0), t["id"])
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
def techniques_for_mitigations(ids: list[str] | None) -> list[str]:
|
|
184
|
+
catalog = load_catalog()
|
|
185
|
+
seen: dict[str, None] = {}
|
|
186
|
+
for mid in ids or []:
|
|
187
|
+
if not isinstance(mid, str) or mid not in catalog["mitigations"]:
|
|
188
|
+
continue
|
|
189
|
+
for tid in catalog["mitigations"][mid].get("techniques") or []:
|
|
190
|
+
if tid in catalog["techniques"]:
|
|
191
|
+
seen[tid] = None
|
|
192
|
+
return [t["id"] for t in sorted((technique(tid) for tid in seen), key=technique_sort_key)]
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
# ── Area labels (frontmatter controls.atlas) ────────────────────────────
|
|
196
|
+
|
|
197
|
+
def _areas_dir_of(areas_dir: str | Path | None) -> str:
|
|
198
|
+
return str(Path(areas_dir or AREAS_DIR).resolve())
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
def _area_labels(d: str) -> dict[str, list[str]]:
|
|
202
|
+
if d in _area_cache:
|
|
203
|
+
return _area_cache[d]
|
|
204
|
+
import frontmatter
|
|
205
|
+
|
|
206
|
+
labels: dict[str, list[str]] = {}
|
|
207
|
+
try:
|
|
208
|
+
files = sorted(p.name for p in Path(d).iterdir() if p.name.endswith(".md"))
|
|
209
|
+
except OSError:
|
|
210
|
+
files = []
|
|
211
|
+
for name in files:
|
|
212
|
+
ids: list[str] = []
|
|
213
|
+
try:
|
|
214
|
+
fm = frontmatter.loads((Path(d) / name).read_text(encoding="utf-8")).metadata
|
|
215
|
+
controls = fm.get("controls") if isinstance(fm, dict) else None
|
|
216
|
+
atlas = controls.get("atlas") if isinstance(controls, dict) else None
|
|
217
|
+
if isinstance(atlas, list):
|
|
218
|
+
ids = sorted({x for x in atlas if isinstance(x, str)})
|
|
219
|
+
except Exception:
|
|
220
|
+
ids = []
|
|
221
|
+
labels[name[: -len(".md")]] = ids
|
|
222
|
+
_area_cache[d] = labels
|
|
223
|
+
return labels
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
def area_mitigations(area_id: str, areas_dir: str | Path | None = None) -> list[str]:
|
|
227
|
+
return list(_area_labels(_areas_dir_of(areas_dir)).get(area_id, []))
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
def mitigation_areas(areas_dir: str | Path | None = None) -> dict[str, list[str]]:
|
|
231
|
+
reverse: dict[str, list[str]] = {}
|
|
232
|
+
for area_id, mids in _area_labels(_areas_dir_of(areas_dir)).items():
|
|
233
|
+
for mid in mids:
|
|
234
|
+
reverse.setdefault(mid, []).append(area_id)
|
|
235
|
+
return {mid: sorted(reverse[mid]) for mid in sorted(reverse)}
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
def summarize_areas(area_ids: list[str] | None, areas_dir: str | Path | None = None) -> dict:
|
|
239
|
+
catalog = load_catalog()
|
|
240
|
+
mids: set[str] = set()
|
|
241
|
+
for area_id in area_ids or []:
|
|
242
|
+
for mid in area_mitigations(area_id, areas_dir):
|
|
243
|
+
if mid in catalog["mitigations"]:
|
|
244
|
+
mids.add(mid)
|
|
245
|
+
sorted_mids = sorted(mids)
|
|
246
|
+
techniques = [technique(tid) for tid in techniques_for_mitigations(sorted_mids)]
|
|
247
|
+
|
|
248
|
+
def count(m: str) -> int:
|
|
249
|
+
return sum(1 for t in techniques if t["maturity"] == m)
|
|
250
|
+
|
|
251
|
+
return {
|
|
252
|
+
"version": PINNED["version"],
|
|
253
|
+
"disclaimer": DISCLAIMER,
|
|
254
|
+
"mitigations": [{"id": mid, "name": catalog["mitigations"][mid]["name"]} for mid in sorted_mids],
|
|
255
|
+
"techniques_addressed": {
|
|
256
|
+
"total": len(techniques),
|
|
257
|
+
"realized": count("Realized"),
|
|
258
|
+
"demonstrated": count("Demonstrated"),
|
|
259
|
+
"feasible": count("Feasible"),
|
|
260
|
+
},
|
|
261
|
+
"top_techniques": [
|
|
262
|
+
{"id": t["id"], "name": t["display_name"], "maturity": t["maturity"]} for t in techniques[:2]
|
|
263
|
+
],
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
# ── Fail-soft wrapper (D12) ─────────────────────────────────────────────
|
|
268
|
+
|
|
269
|
+
_warned_default = False
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
def _default_warn(message: str) -> None:
|
|
273
|
+
global _warned_default
|
|
274
|
+
if _warned_default:
|
|
275
|
+
return
|
|
276
|
+
_warned_default = True
|
|
277
|
+
sys.stderr.write(f"{message}\n")
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
def with_atlas(fn: Callable[[], Any], fallback: Any, warn: Callable[[str], None] | None = None) -> Any:
|
|
281
|
+
try:
|
|
282
|
+
return fn()
|
|
283
|
+
except AtlasCatalogError as err:
|
|
284
|
+
(warn or _default_warn)(f"aigis: ATLAS catalog unavailable ({err.file} {err.code}); ATLAS output omitted")
|
|
285
|
+
return fallback
|