@aigis-ai/cli 2.0.1 → 2.1.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.
- package/README.md +97 -178
- package/bin/aigis.js +139 -8
- package/content/resolvers/triggers.json +363 -41
- package/content/skills/areas/audit-logging.md +33 -0
- package/content/skills/areas/bias-monitoring.md +34 -0
- package/content/skills/areas/confidence-scoring.md +23 -0
- package/content/skills/areas/data-integrity.md +25 -0
- package/content/skills/areas/eu-ai-act-art-13-deployer-transparency.md +133 -0
- package/content/skills/areas/eu-ai-act-art-50-transparency-disclosure.md +134 -0
- package/content/skills/areas/eu-ai-act-art-73-incident-reporting.md +149 -0
- package/content/skills/areas/eu-ai-act-art-9-risk-management.md +141 -0
- package/content/skills/areas/fallback-patterns.md +28 -0
- package/content/skills/areas/human-oversight.md +38 -0
- package/content/skills/areas/input-validation.md +27 -0
- package/content/skills/areas/monitoring.md +29 -0
- package/content/skills/areas/prompt-security.md +29 -0
- package/content/templates/eu-ai-act-annex-iv.md +193 -0
- package/docs/frontmatter-schema.md +75 -0
- package/docs/screenshots/README.md +17 -0
- package/docs/screenshots/agent-flow.png +0 -0
- package/docs/screenshots/setup.png +0 -0
- package/docs/screenshots/verify.png +0 -0
- package/lib/auto-verify.js +70 -1
- package/lib/build.js +101 -12
- package/lib/classify.js +8 -2
- package/lib/init.js +269 -5
- package/lib/jurisdiction.js +137 -0
- package/lib/report.js +331 -0
- package/package.json +1 -1
- package/scripts/area-controls-baseline.json +188 -0
- package/scripts/area-frontmatter.schema.json +61 -0
- package/scripts/validate-area-frontmatter.js +228 -0
- package/cli-python/LICENSE +0 -21
- package/cli-python/README.md +0 -32
- package/cli-python/aigis_cli/SKILL.md +0 -70
- package/cli-python/aigis_cli/__init__.py +0 -3
- package/cli-python/aigis_cli/__pycache__/__init__.cpython-313.pyc +0 -0
- package/cli-python/aigis_cli/__pycache__/annotate.cpython-313.pyc +0 -0
- package/cli-python/aigis_cli/__pycache__/build.cpython-313.pyc +0 -0
- package/cli-python/aigis_cli/__pycache__/checksum.cpython-313.pyc +0 -0
- package/cli-python/aigis_cli/__pycache__/classify.cpython-313.pyc +0 -0
- package/cli-python/aigis_cli/__pycache__/cli.cpython-313.pyc +0 -0
- package/cli-python/aigis_cli/__pycache__/fetch.cpython-313.pyc +0 -0
- package/cli-python/aigis_cli/__pycache__/init_ide.cpython-313.pyc +0 -0
- package/cli-python/aigis_cli/__pycache__/keywords.cpython-313.pyc +0 -0
- package/cli-python/aigis_cli/__pycache__/search.cpython-313.pyc +0 -0
- package/cli-python/aigis_cli/annotate.py +0 -45
- package/cli-python/aigis_cli/auto_verify.py +0 -518
- package/cli-python/aigis_cli/build.py +0 -470
- package/cli-python/aigis_cli/checksum.py +0 -22
- package/cli-python/aigis_cli/classify.py +0 -192
- package/cli-python/aigis_cli/cli.py +0 -618
- package/cli-python/aigis_cli/content/index/audit-scan.md +0 -217
- package/cli-python/aigis_cli/content/index/auto-verify-rules.json +0 -439
- package/cli-python/aigis_cli/content/index/context-rules.json +0 -90
- package/cli-python/aigis_cli/content/index/frameworks.md +0 -82
- package/cli-python/aigis_cli/content/index/guardrails.json +0 -23
- package/cli-python/aigis_cli/content/index/taxonomy.md +0 -81
- package/cli-python/aigis_cli/content/resolvers/triggers.json +0 -229
- package/cli-python/aigis_cli/content/skills/areas/audit-logging.md +0 -176
- package/cli-python/aigis_cli/content/skills/areas/bias-monitoring.md +0 -172
- package/cli-python/aigis_cli/content/skills/areas/confidence-scoring.md +0 -180
- package/cli-python/aigis_cli/content/skills/areas/data-integrity.md +0 -257
- package/cli-python/aigis_cli/content/skills/areas/explainability.md +0 -174
- package/cli-python/aigis_cli/content/skills/areas/fallback-patterns.md +0 -200
- package/cli-python/aigis_cli/content/skills/areas/human-oversight.md +0 -220
- package/cli-python/aigis_cli/content/skills/areas/input-validation.md +0 -380
- package/cli-python/aigis_cli/content/skills/areas/monitoring.md +0 -207
- package/cli-python/aigis_cli/content/skills/areas/output-sanitization.md +0 -183
- package/cli-python/aigis_cli/content/skills/areas/pii-handling.md +0 -189
- package/cli-python/aigis_cli/content/skills/areas/prompt-security.md +0 -153
- package/cli-python/aigis_cli/content/skills/areas/rag-security.md +0 -230
- package/cli-python/aigis_cli/content/skills/areas/rate-limiting.md +0 -246
- package/cli-python/aigis_cli/content/skills/areas/supply-chain.md +0 -193
- package/cli-python/aigis_cli/content/skills/core.md +0 -62
- package/cli-python/aigis_cli/content/skills/infrastructure/logging.md +0 -202
- package/cli-python/aigis_cli/content/skills/infrastructure/rate-limiting.md +0 -169
- package/cli-python/aigis_cli/content/skills/infrastructure/secrets.md +0 -167
- package/cli-python/aigis_cli/content/skills/workflows/fastapi-llm.md +0 -86
- package/cli-python/aigis_cli/content/templates/ai-impact-assessment.md +0 -54
- package/cli-python/aigis_cli/content/templates/intended-purpose-doc.md +0 -39
- package/cli-python/aigis_cli/content/templates/risk-characterization.md +0 -34
- package/cli-python/aigis_cli/content/templates/third-party-assessment.md +0 -41
- package/cli-python/aigis_cli/content/verify/checklist-audit-logging.md +0 -13
- package/cli-python/aigis_cli/content/verify/checklist-bias-monitoring.md +0 -13
- package/cli-python/aigis_cli/content/verify/checklist-confidence-scoring.md +0 -13
- package/cli-python/aigis_cli/content/verify/checklist-data-integrity.md +0 -12
- package/cli-python/aigis_cli/content/verify/checklist-explainability.md +0 -13
- package/cli-python/aigis_cli/content/verify/checklist-fallback-patterns.md +0 -13
- package/cli-python/aigis_cli/content/verify/checklist-human-oversight.md +0 -14
- package/cli-python/aigis_cli/content/verify/checklist-input-validation.md +0 -16
- package/cli-python/aigis_cli/content/verify/checklist-monitoring.md +0 -13
- package/cli-python/aigis_cli/content/verify/checklist-output-sanitization.md +0 -14
- package/cli-python/aigis_cli/content/verify/checklist-pii-handling.md +0 -14
- package/cli-python/aigis_cli/content/verify/checklist-prompt-security.md +0 -13
- package/cli-python/aigis_cli/content/verify/checklist-rag-security.md +0 -12
- package/cli-python/aigis_cli/content/verify/checklist-rate-limiting.md +0 -13
- package/cli-python/aigis_cli/content/verify/checklist-supply-chain.md +0 -13
- package/cli-python/aigis_cli/fetch.py +0 -232
- package/cli-python/aigis_cli/init_ide.py +0 -159
- package/cli-python/aigis_cli/keywords.py +0 -73
- package/cli-python/aigis_cli/search.py +0 -69
- package/cli-python/aigis_cli.egg-info/PKG-INFO +0 -59
- package/cli-python/aigis_cli.egg-info/SOURCES.txt +0 -56
- package/cli-python/aigis_cli.egg-info/dependency_links.txt +0 -1
- package/cli-python/aigis_cli.egg-info/entry_points.txt +0 -2
- package/cli-python/aigis_cli.egg-info/requires.txt +0 -6
- package/cli-python/aigis_cli.egg-info/top_level.txt +0 -1
- package/cli-python/dist/aigis_cli-1.0.3-py3-none-any.whl +0 -0
- package/cli-python/dist/aigis_cli-1.0.3.tar.gz +0 -0
- package/cli-python/pyproject.toml +0 -49
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
id: infra-secrets
|
|
3
|
-
title: Secrets management infrastructure (env-var baseline + vault integration patterns)
|
|
4
|
-
controls:
|
|
5
|
-
owasp: [LLM02, LLM05]
|
|
6
|
-
nist: [MAP-2.3, MEASURE-2.7]
|
|
7
|
-
iso42001: [Clause-8.3]
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
Several area procedures (`pii-handling`, `supply-chain`, the `rate-limiting` infra file's Redis URL) require secrets — API keys, database credentials, connection strings — to live outside source code. This file shows the two infrastructure shapes that satisfy that requirement: an environment-variable baseline for new projects, and integration patterns for projects that already have a secrets manager. Pick one. Then return to the procedure that sent you here.
|
|
11
|
-
|
|
12
|
-
This is content, not a scaffold. Aigis does not write files for you. Copy the snippets you need; adapt them to your project.
|
|
13
|
-
|
|
14
|
-
## Starting from scratch (you have no secrets manager yet)
|
|
15
|
-
|
|
16
|
-
If you are building a new project and don't have a vault, the minimum acceptable baseline is environment variables loaded from a `.env` file in development and from your platform's secret store in production. Hard-coded secrets in source files are not acceptable at any stage — the supply-chain procedure will flag them.
|
|
17
|
-
|
|
18
|
-
### Required dependency
|
|
19
|
-
|
|
20
|
-
```
|
|
21
|
-
python-dotenv>=1.0 # loads .env into os.environ; pin per your supply-chain procedure
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
### `.env.example` convention
|
|
25
|
-
|
|
26
|
-
Commit `.env.example` with placeholder values. Add `.env` to `.gitignore`. Every key in `.env.example` must be present in `.env` for the app to start.
|
|
27
|
-
|
|
28
|
-
```
|
|
29
|
-
# .env.example
|
|
30
|
-
ANTHROPIC_API_KEY=sk-ant-REPLACE_ME
|
|
31
|
-
OPENAI_API_KEY=sk-REPLACE_ME
|
|
32
|
-
DATABASE_URL=postgresql://user:REPLACE_ME@localhost:5432/dbname
|
|
33
|
-
REDIS_URL=redis://localhost:6379/0
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
```
|
|
37
|
-
# .gitignore
|
|
38
|
-
.env
|
|
39
|
-
.env.local
|
|
40
|
-
.env.*.local
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
Do not deploy `.env` to production. Production secrets come from your platform's secret store (Vault, AWS Secrets Manager, GCP Secret Manager, or the wrappers below). The `.env` file exists only for local development; a `.env` in a container image or a production deploy is a leak.
|
|
44
|
-
|
|
45
|
-
### Loading code
|
|
46
|
-
|
|
47
|
-
```python
|
|
48
|
-
import os
|
|
49
|
-
from dotenv import load_dotenv
|
|
50
|
-
|
|
51
|
-
load_dotenv() # no-op in production if .env is absent
|
|
52
|
-
|
|
53
|
-
def require(name: str) -> str:
|
|
54
|
-
value = os.getenv(name)
|
|
55
|
-
if not value or value.endswith("REPLACE_ME"):
|
|
56
|
-
raise RuntimeError(f"Missing required secret: {name}")
|
|
57
|
-
return value
|
|
58
|
-
|
|
59
|
-
ANTHROPIC_API_KEY = require("ANTHROPIC_API_KEY")
|
|
60
|
-
DATABASE_URL = require("DATABASE_URL")
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
The `require` helper fails fast at startup rather than at first use. A missing API key should crash the process on boot, not surface as a 500 the first time a user hits the LLM endpoint.
|
|
64
|
-
|
|
65
|
-
### Verifying the setup
|
|
66
|
-
|
|
67
|
-
Before wiring secrets into application code, confirm loading works and that no secret leaks into logs:
|
|
68
|
-
|
|
69
|
-
```python
|
|
70
|
-
print("ANTHROPIC_API_KEY loaded:", bool(os.getenv("ANTHROPIC_API_KEY")))
|
|
71
|
-
# Never print the value itself, even in development scripts.
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
If this prints `False`, fix the `.env` location or `load_dotenv()` call before continuing.
|
|
75
|
-
|
|
76
|
-
## Integrate with existing infrastructure
|
|
77
|
-
|
|
78
|
-
If you already have a secrets manager, adapt rather than introduce a second source of truth. Common cases below; pick the closest match.
|
|
79
|
-
|
|
80
|
-
### HashiCorp Vault
|
|
81
|
-
|
|
82
|
-
Read secrets at process start, populate `os.environ`, and let the rest of the app use the env-var pattern above:
|
|
83
|
-
|
|
84
|
-
```python
|
|
85
|
-
import hvac, os
|
|
86
|
-
|
|
87
|
-
client = hvac.Client(url=os.environ["VAULT_ADDR"], token=os.environ["VAULT_TOKEN"])
|
|
88
|
-
secrets = client.secrets.kv.v2.read_secret_version(path="myapp/prod")["data"]["data"]
|
|
89
|
-
for key, value in secrets.items():
|
|
90
|
-
os.environ.setdefault(key, value)
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
Use AppRole or Kubernetes auth in production; static `VAULT_TOKEN` is for local development only.
|
|
94
|
-
|
|
95
|
-
### AWS Secrets Manager
|
|
96
|
-
|
|
97
|
-
```python
|
|
98
|
-
import boto3, json, os
|
|
99
|
-
|
|
100
|
-
client = boto3.client("secretsmanager", region_name=os.environ["AWS_REGION"])
|
|
101
|
-
secret = json.loads(client.get_secret_value(SecretId="myapp/prod")["SecretString"])
|
|
102
|
-
for key, value in secret.items():
|
|
103
|
-
os.environ.setdefault(key, value)
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
Grant the application's IAM role `secretsmanager:GetSecretValue` on a single secret ARN, not `*`. Rotate via the built-in rotation Lambda, not by hand.
|
|
107
|
-
|
|
108
|
-
### GCP Secret Manager
|
|
109
|
-
|
|
110
|
-
```python
|
|
111
|
-
from google.cloud import secretmanager
|
|
112
|
-
import os
|
|
113
|
-
|
|
114
|
-
client = secretmanager.SecretManagerServiceClient()
|
|
115
|
-
def fetch(name: str) -> str:
|
|
116
|
-
path = f"projects/{os.environ['GCP_PROJECT']}/secrets/{name}/versions/latest"
|
|
117
|
-
return client.access_secret_version(name=path).payload.data.decode()
|
|
118
|
-
|
|
119
|
-
os.environ["ANTHROPIC_API_KEY"] = fetch("anthropic-api-key")
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
Bind the service account to `roles/secretmanager.secretAccessor` on each secret, not at the project level.
|
|
123
|
-
|
|
124
|
-
### Doppler / 1Password / Infisical
|
|
125
|
-
|
|
126
|
-
These tools inject secrets as environment variables at process start via a CLI wrapper:
|
|
127
|
-
|
|
128
|
-
```
|
|
129
|
-
doppler run -- python app.py
|
|
130
|
-
op run --env-file=.env -- python app.py
|
|
131
|
-
infisical run -- python app.py
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
Your application code does not change — it still reads `os.environ`. The wrapper handles fetch, decryption, and injection. Appropriate when you want centralized rotation without code changes.
|
|
135
|
-
|
|
136
|
-
These are developer-experience tools — good for smaller teams and centralized rotation. For regulated environments (SOC 2, HIPAA, FedRAMP), prefer the managed services above.
|
|
137
|
-
|
|
138
|
-
## Production considerations
|
|
139
|
-
|
|
140
|
-
Things to think about before deploying. None of these are blockers for the procedure that sent you here, but all of them affect whether your secret hygiene survives contact with a real environment.
|
|
141
|
-
|
|
142
|
-
### Rotation
|
|
143
|
-
|
|
144
|
-
Every secret should have a known rotation cadence. API keys: at least every 90 days, immediately on suspected compromise. Database credentials: managed by the secrets manager's rotation feature where available. Document the rotation procedure next to the secret definition; an undocumented secret is an unrotated secret.
|
|
145
|
-
|
|
146
|
-
For secrets that cannot rotate without downtime (primary database credentials on a live system), use dual-credential patterns — provision the new credential alongside the old, shift traffic, then revoke the old.
|
|
147
|
-
|
|
148
|
-
### Access control
|
|
149
|
-
|
|
150
|
-
Grant read access to specific secrets, not to the whole vault. Use separate credentials for development, staging, and production — a leaked dev key should not unlock prod. Audit access logs from your secrets manager; unexplained reads are an incident.
|
|
151
|
-
|
|
152
|
-
### Logging hygiene
|
|
153
|
-
|
|
154
|
-
Secrets must never appear in logs, error messages, stack traces, or telemetry. The `audit-logging` area procedure covers redaction patterns. At minimum, scrub `Authorization` headers, `*_KEY`, `*_SECRET`, `*_TOKEN`, `*_PASSWORD`, and connection strings before any log emit.
|
|
155
|
-
|
|
156
|
-
### Build-time vs runtime
|
|
157
|
-
|
|
158
|
-
Do not bake secrets into container images, build artifacts, or CI caches. Inject at runtime via the patterns above. A secret in a Docker layer is permanently exposed even after you "remove" it — image layers are append-only.
|
|
159
|
-
|
|
160
|
-
## After this file
|
|
161
|
-
|
|
162
|
-
Return to the area procedure that sent you here (`pii-handling`, `supply-chain`, or `rate-limiting`). The procedure's secret-handling checkpoint is satisfied once your application reads secrets from environment variables (or a managed source above) and your repository contains no hard-coded credentials.
|
|
163
|
-
|
|
164
|
-
## Related infrastructure
|
|
165
|
-
|
|
166
|
-
- `aigis infra logging` — redaction patterns to keep secrets out of log output.
|
|
167
|
-
- `aigis infra rate-limiting` — where the Redis connection string this file scopes for you actually gets used.
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: workflow-fastapi-llm
|
|
3
|
-
description: Canonical 8-file layout for a FastAPI service that calls an LLM API. Run after `aigis classify` returned a Python/FastAPI system. Maps each governance area to a specific module so wiring is consistent across runs.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Workflow: FastAPI + LLM
|
|
7
|
-
|
|
8
|
-
This workflow is for: a FastAPI HTTP service that calls a hosted LLM (Anthropic, OpenAI) on user input. If your project is something else (Express, Next.js, agentic loop, RAG service), this workflow does not apply — see `aigis workflow --list` for available workflows.
|
|
9
|
-
|
|
10
|
-
## Canonical file layout
|
|
11
|
-
|
|
12
|
-
Build into exactly these 8 files.
|
|
13
|
-
|
|
14
|
-
```
|
|
15
|
-
app/
|
|
16
|
-
├── main.py # FastAPI routes + minimal orchestration only
|
|
17
|
-
├── input_validation.py # length limits, sanitize, 3-category injection detection
|
|
18
|
-
├── pii.py # PII_PATTERNS + redact_pii (5 required classes)
|
|
19
|
-
├── rate_limit.py # Redis-backed limiter + token budget + Retry-After
|
|
20
|
-
├── fallback.py # 3-state circuit breaker + per-request kill switch + safe response
|
|
21
|
-
├── audit.py # trace IDs, structured logs, decision records, fairness fields
|
|
22
|
-
├── monitoring.py # metrics, drift, incident logging, user feedback endpoint
|
|
23
|
-
└── response.py # response shaping: confidence metadata, explanation, output sanitization
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
Plus at the project root: `requirements.txt` with pinned `==` versions, `tests/` with at least one smoke test, `docker-compose.yml` (Redis dependency for `rate_limit.py`).
|
|
27
|
-
|
|
28
|
-
## Area-to-file mapping
|
|
29
|
-
|
|
30
|
-
| Aigis area (run `aigis get <id>` for the procedure) | Lives in |
|
|
31
|
-
|---|---|
|
|
32
|
-
| input-validation | `app/input_validation.py` |
|
|
33
|
-
| pii-handling | `app/pii.py` |
|
|
34
|
-
| rate-limiting | `app/rate_limit.py` |
|
|
35
|
-
| fallback-patterns | `app/fallback.py` |
|
|
36
|
-
| audit-logging | `app/audit.py` |
|
|
37
|
-
| bias-monitoring | `app/audit.py` (fairness fields are part of structured logs) |
|
|
38
|
-
| monitoring | `app/monitoring.py` |
|
|
39
|
-
| confidence-scoring | `app/response.py` |
|
|
40
|
-
| explainability | `app/response.py` |
|
|
41
|
-
| output-sanitization | `app/response.py` |
|
|
42
|
-
| human-oversight | `app/main.py` (decision gate + override surface + action allowlist) |
|
|
43
|
-
| prompt-security | `app/main.py` (`SYSTEM_PROMPT` constant + leakage detection) |
|
|
44
|
-
| supply-chain | `requirements.txt` (pinned versions) + `app/main.py` (`MODEL_VERSION` constant) |
|
|
45
|
-
|
|
46
|
-
If `main.py`'s responsibilities grow past routes + minimal orchestration, pull human-oversight into `app/human_oversight.py` and/or prompt-security into `app/prompt_security.py`. Don't invent other splits — variance hurts maintainability.
|
|
47
|
-
|
|
48
|
-
## Wiring contracts (cross-file invariants)
|
|
49
|
-
|
|
50
|
-
These are the wiring rules the area-skill verification checkpoints check for. Get them right at build time.
|
|
51
|
-
|
|
52
|
-
1. **`redact_pii` from `pii.py` is called in two places:**
|
|
53
|
-
- `main.py`, on user input, before passing to the LLM client
|
|
54
|
-
- `audit.py`, on input/output before structured-log emission
|
|
55
|
-
2. **`call_llm_safely` from `fallback.py` wraps every LLM client call.** Every `client.messages.create` / `client.chat.completions.create` site routes through it. There must be exactly one LLM call site in `main.py` (or in a dedicated `app/llm.py` if you split for clarity); other modules invoke it through the safe wrapper.
|
|
56
|
-
3. **`ai_system_enabled()` from `fallback.py` is called inside the request handler in `main.py`, on every request.** Not at module load. Not via `@lru_cache`. Not stored on a `settings = Settings()` module-level singleton.
|
|
57
|
-
4. **The injection guard from `input_validation.py` blocks before the LLM call.** Raises `HTTPException(400)` on detection; the LLM call must come AFTER the guard, never before, never in parallel.
|
|
58
|
-
5. **`enforce_rate_limit` and `enforce_token_budget` from `rate_limit.py` run in the handler before any sanitize/LLM work.** Cheaper to reject than to sanitize-then-reject.
|
|
59
|
-
6. **`set_trace_id` middleware from `audit.py` runs on every request.** All log emissions and the `X-Trace-Id` response header use the contextvar.
|
|
60
|
-
7. **`response.py` shapes the outgoing payload from a parsed model result.** It receives the validated assessment dict and returns the JSON body the client gets — confidence metadata, explanation, sanitized fields, framing. `main.py` calls it at the end of the request handler; `response.py` does not call the LLM and does not log.
|
|
61
|
-
|
|
62
|
-
## Order of implementation
|
|
63
|
-
|
|
64
|
-
Recommended order (each step ships independently, tests pass at every step):
|
|
65
|
-
|
|
66
|
-
1. `app/main.py` skeleton with `POST /api/assess-claim` (or your route), `GET /healthz`, no LLM call yet.
|
|
67
|
-
2. `app/input_validation.py` — `aigis get input-validation` and follow the procedure.
|
|
68
|
-
3. `app/pii.py` — `aigis get pii-handling` and follow the procedure.
|
|
69
|
-
4. `app/fallback.py` — `aigis get fallback-patterns` and follow the procedure.
|
|
70
|
-
5. `app/rate_limit.py` — `aigis get rate-limiting` and follow the procedure.
|
|
71
|
-
6. Wire the LLM call in `main.py`, routing through `call_llm_safely`.
|
|
72
|
-
7. `app/audit.py` — `aigis get audit-logging` and `aigis get bias-monitoring`.
|
|
73
|
-
8. `app/monitoring.py` — `aigis get monitoring`.
|
|
74
|
-
9. `app/response.py` — `aigis get confidence-scoring`, `aigis get explainability`, `aigis get output-sanitization`. Wire it into `main.py` as the last step before returning.
|
|
75
|
-
10. Human-oversight + prompt-security work in `main.py` — `aigis get human-oversight`, `aigis get prompt-security`.
|
|
76
|
-
11. `requirements.txt` and `tests/` — `aigis get supply-chain`.
|
|
77
|
-
|
|
78
|
-
## Verification per file
|
|
79
|
-
|
|
80
|
-
After building each file, run `aigis verify <area> --auto .`. The scanner returns PASS/FAIL/OVERCLAIM/JUDGMENT for that area's deterministic checks. Fix any FAIL or OVERCLAIM before moving to the next file.
|
|
81
|
-
|
|
82
|
-
## If your existing codebase uses a different layout
|
|
83
|
-
|
|
84
|
-
Map each responsibility above to your existing modules. The wiring contracts (the numbered list) stay the same — the file names don't. For example, if your codebase already has `services/text_processing.py` for text cleanup, the input-validation procedure can live there; the contract that "an injection guard runs before the LLM call" is what matters, not which file holds it.
|
|
85
|
-
|
|
86
|
-
If the mapping is non-trivial, document it in `docs/aigis-mapping.md` so future contributors and `aigis verify --auto` reviewers can find your modules.
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
id: ai-impact-assessment
|
|
3
|
-
title: AI Impact Assessment Template
|
|
4
|
-
framework: ISO 42001 Clause 6.1.4 / Clause 8.4
|
|
5
|
-
required_when: risk_tier=HIGH OR jurisdiction-eu OR influences-decisions
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
# AI Impact Assessment
|
|
9
|
-
|
|
10
|
-
> The agent fills in each section based on the system being built. This document maps to ISO/IEC 42001:2023 Clause 8.4 (AI System Impact Assessment).
|
|
11
|
-
|
|
12
|
-
## 1. System identification
|
|
13
|
-
- **System name:** [Extract the name from the task description or code module name. Example: "Claims Severity Assessment API"]
|
|
14
|
-
- **Version:** [Use semantic versioning: 0.1.0 for first deployment]
|
|
15
|
-
- **Date:** [Use semantic versioning: 0.1.0 for first deployment]
|
|
16
|
-
- **Assessment author:** AI-assisted (review required by [role])
|
|
17
|
-
|
|
18
|
-
## 2. Intended purpose
|
|
19
|
-
- **What does this system do?** [Summarize in 1-2 sentences what the system does, not how it works technically. Example: "Assesses insurance claim severity using NLP to recommend routing to fast-track, standard, or escalated review"]
|
|
20
|
-
- **Who are the intended users?** [List the user roles who interact with the system directly. Example: "Claims processing staff (800 users across 6 offices)"]
|
|
21
|
-
- **What decisions does it support or make?** [Describe the specific decisions this output influences. Example: "Determines initial routing of insurance claims, affecting speed of resolution and adjuster workload"]
|
|
22
|
-
|
|
23
|
-
## 3. Affected populations
|
|
24
|
-
- **Who is directly affected by this system's output?** [Describe the specific decisions this output influences. Example: "Determines initial routing of insurance claims, affecting speed of resolution and adjuster workload"]
|
|
25
|
-
- **Are any vulnerable populations affected?** (minors, elderly, economically disadvantaged) [check traits]
|
|
26
|
-
- **Estimated number of affected individuals:** [inferred from scale]
|
|
27
|
-
|
|
28
|
-
## 4. Potential negative impacts
|
|
29
|
-
| Impact | Likelihood | Severity | Affected group | Mitigation |
|
|
30
|
-
|--------|-----------|----------|----------------|------------|
|
|
31
|
-
| [For each risk, describe: what goes wrong, who is harmed, how severely. Example: "High-severity claim under-assessed → customer experiences delayed payout and potential financial hardship"] | Low/Med/High | Low/Med/High | [group] | [Reference the specific implement file and pattern number. Example: "Input sanitization (input-validation.md P1-P3), PII redaction (pii-handling.md P1)"] |
|
|
32
|
-
|
|
33
|
-
## 5. Controls implemented
|
|
34
|
-
| Control | Implementation | Framework reference |
|
|
35
|
-
|---------|---------------|-------------------|
|
|
36
|
-
| [List each implement file used, the specific patterns applied, and the function/module that implements them] | [Reference the exact function name and file location. Example: "sanitize_input() in app/middleware/validation.py"] | [Copy the control IDs from the implement file frontmatter. Example: "OWASP LLM01, NIST MEASURE-2.7, ISO Cl.8.2"] |
|
|
37
|
-
|
|
38
|
-
## 6. Residual risks
|
|
39
|
-
- [List risks that controls cannot fully eliminate. For each: describe the risk, why it persists, and why the residual level is acceptable. Example: "Novel prompt injection techniques may bypass pattern detection. Residual risk accepted because output schema validation (P4) limits damage, and human oversight catches anomalies."]
|
|
40
|
-
|
|
41
|
-
## 7. Human oversight mechanism
|
|
42
|
-
- **Override available:** Yes/No
|
|
43
|
-
- **Escalation path:** [Describe the specific override mechanism implemented: endpoint URL, who can trigger it, what happens when triggered]
|
|
44
|
-
- **Kill switch:** [Describe the kill switch: where the config lives, who has access, what disabling looks like, recovery process]
|
|
45
|
-
|
|
46
|
-
## 8. Monitoring plan
|
|
47
|
-
- **Metrics tracked:** [List the specific metrics from monitoring.md Pattern 1 that are being tracked for this system]
|
|
48
|
-
- **Review frequency:** [HIGH: weekly metric review, monthly bias audit, quarterly red-team. MEDIUM: monthly metric review, quarterly bias check. LOW: quarterly metric review]
|
|
49
|
-
- **Responsible party:** [role, not auto-filled — requires human input]
|
|
50
|
-
|
|
51
|
-
## 9. Review and approval
|
|
52
|
-
- **Assessment reviewed by:** _________________ (required: human reviewer)
|
|
53
|
-
- **Date:** _________________
|
|
54
|
-
- **Approved for deployment:** Yes / No / Conditional
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
id: intended-purpose-doc
|
|
3
|
-
title: Intended Purpose Documentation
|
|
4
|
-
framework: NIST MAP 1.1
|
|
5
|
-
required_when: risk_tier=HIGH OR risk_tier=MEDIUM
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
# Intended purpose documentation
|
|
9
|
-
|
|
10
|
-
> Maps to NIST AI RMF MAP 1.1. The agent generates this alongside code for medium and high-risk systems.
|
|
11
|
-
|
|
12
|
-
## System purpose
|
|
13
|
-
- **Primary function:** [Summarize in 1-2 sentences. Focus on WHAT the system does and WHY, not HOW. Example: "Routes insurance claims to appropriate handling tracks based on AI-assessed severity to reduce triage time from 4 hours to under 5 minutes"]
|
|
14
|
-
- **Problem it solves:** [Describe the business problem in user terms, not technical terms. Example: "Manual claim triage is slow and inconsistent across adjusters, causing delays for customers and uneven workloads"]
|
|
15
|
-
- **What it does NOT do:** [limitations, inferred from system type]
|
|
16
|
-
|
|
17
|
-
## Intended users
|
|
18
|
-
- **Primary users:** [List specific roles, their expertise level, and how they interact with the system. Example: "Claims processors (non-technical, 2+ years claims experience) view AI recommendations in the claims management UI"]
|
|
19
|
-
- **User expertise level:** [Describe the business problem in user terms, not technical terms. Example: "Manual claim triage is slow and inconsistent across adjusters, causing delays for customers and uneven workloads"]
|
|
20
|
-
- **Training required:** [recommended based on system complexity]
|
|
21
|
-
|
|
22
|
-
## Deployment context
|
|
23
|
-
- **Environment:** [production/staging/internal]
|
|
24
|
-
- **Access scope:** [internal-only / customer-facing / public]
|
|
25
|
-
- **Geographic scope:** [List countries/regions based on jurisdiction traits. If jurisdiction-eu: list EU member states served. If jurisdiction-global: list all regions]
|
|
26
|
-
- **Expected volume:** [If is-high-volume: estimate requests/day and concurrent users. Otherwise: state "Low volume, <1000 requests/day"]
|
|
27
|
-
|
|
28
|
-
## Known limitations
|
|
29
|
-
- [List 3-5 concrete limitations. Reference known limitations from the model provider. Example: "Cannot verify factual claims in claim descriptions", "Performance degrades below 20-word inputs"]
|
|
30
|
-
- The system should NOT be used for: [generated]
|
|
31
|
-
|
|
32
|
-
## Legal and regulatory context
|
|
33
|
-
- **Applicable regulations:** [List countries/regions based on jurisdiction traits. If jurisdiction-eu: list EU member states served. If jurisdiction-global: list all regions]
|
|
34
|
-
- **Compliance requirements:** [list of applicable frameworks]
|
|
35
|
-
|
|
36
|
-
## Stakeholder expectations
|
|
37
|
-
- **Organization:** [alignment with organizational mission — requires human input]
|
|
38
|
-
- **Users:** [what users expect from the system]
|
|
39
|
-
- **Affected individuals:** [what people affected by decisions expect]
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
id: risk-characterization
|
|
3
|
-
title: Risk Characterization Template
|
|
4
|
-
framework: NIST MAP 5.1
|
|
5
|
-
required_when: risk_tier=HIGH
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
# Risk characterization
|
|
9
|
-
|
|
10
|
-
> Maps to NIST AI RMF MAP 5.1. Documents likelihood and magnitude of identified impacts.
|
|
11
|
-
|
|
12
|
-
## Identified risks
|
|
13
|
-
|
|
14
|
-
| # | Risk description | Likelihood | Magnitude | Risk score | Mitigation | Residual risk |
|
|
15
|
-
|---|-----------------|-----------|-----------|------------|------------|---------------|
|
|
16
|
-
| 1 | [Describe one specific failure scenario per row. Be concrete: "LLM assigns severity 2 to a claim that should be 8, causing a legitimate high-severity claim to be fast-tracked instead of escalated"] | 1-5 | 1-5 | L×M | [control reference] | [after mitigation] |
|
|
17
|
-
|
|
18
|
-
## Risk categories assessed
|
|
19
|
-
- **Accuracy/reliability risks:** [Describe specific ways the system could produce wrong outputs. Example: "Severity score miscalibration on multi-incident claims leads to under-assessment"]
|
|
20
|
-
- **Bias/fairness risks:** [Describe how different groups might receive different outcomes. Example: "Claims written in informal language may receive lower severity scores, correlating with demographic patterns"]
|
|
21
|
-
- **Security risks:** [Describe attack vectors specific to this system. Reference relevant OWASP LLM IDs. Example: "Prompt injection via crafted claim descriptions (LLM01) could manipulate severity scores"]
|
|
22
|
-
- **Privacy risks:** [Describe how sensitive data could be exposed. Example: "Claim descriptions containing medical details could be leaked via LLM output or logs"]
|
|
23
|
-
- **Safety risks:** [Describe how system failures could cause harm. Example: "Under-assessed high-severity claims delay critical payouts, causing financial hardship"]
|
|
24
|
-
- **Transparency risks:** [Describe situations where decisions cannot be explained. Example: "LLM scoring rationale is opaque — adjusters cannot explain to customers why a score was assigned"]
|
|
25
|
-
|
|
26
|
-
## Impact assessment
|
|
27
|
-
- **Individual impact:** [Describe the concrete harm to one person if the system fails. Example: "A customer with a legitimate $50K claim experiences a 2-week delay and financial stress because the AI routed it to fast-track instead of escalation"]
|
|
28
|
-
- **Group impact:** [Describe how a class of people could be systematically affected. Example: "Non-native English speakers may consistently receive lower severity scores due to writing style bias in the LLM"]
|
|
29
|
-
- **Organizational impact:** [Describe business consequences. Example: "Systematic under-assessment could trigger regulatory investigation, class-action litigation, and reputational damage estimated at $X"]
|
|
30
|
-
- **Societal impact:** [Describe broader effects if this system's pattern were widespread. Example: "Algorithmic bias in insurance claim assessment could deepen existing inequities in financial services access"]
|
|
31
|
-
|
|
32
|
-
## Risk tolerance
|
|
33
|
-
- **Acceptable risk level:** [This requires human input — state the organization's risk appetite. Example: "False negative rate (under-assessed severe claims) must be below 2%. False positive rate (over-escalated minor claims) acceptable up to 15%."]
|
|
34
|
-
- **Go/no-go recommendation:** [Based on the residual risk analysis above: recommend proceed, proceed with conditions, or do not proceed. State the specific conditions if conditional. Example: "Proceed with conditions: mandatory human review for all claims over $25K, quarterly bias audit, 90-day pilot before full rollout"]
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
id: third-party-assessment
|
|
3
|
-
title: Third-Party AI Assessment
|
|
4
|
-
framework: NIST GOVERN 6 / OWASP LLM03
|
|
5
|
-
required_when: uses-thirdparty-api AND (risk_tier=HIGH OR risk_tier=MEDIUM)
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
# Third-party AI assessment
|
|
9
|
-
|
|
10
|
-
> Maps to NIST GOVERN 6.1/6.2 and OWASP LLM03. Documents risks of third-party AI dependencies.
|
|
11
|
-
|
|
12
|
-
## Provider information
|
|
13
|
-
- **Provider:** [Extract from the import statements or API client initialization in the code. Example: "Anthropic (Claude API)"]
|
|
14
|
-
- **Model:** [Extract from the model parameter in the API call. Example: "claude-sonnet-4-20250514"]
|
|
15
|
-
- **API version:** [auto-fill]
|
|
16
|
-
- **Client library version:** [Read from the dependency file. Example: "anthropic==0.39.0 (from requirements.txt)"]
|
|
17
|
-
|
|
18
|
-
## Dependency risks
|
|
19
|
-
| Risk | Likelihood | Impact | Mitigation |
|
|
20
|
-
|------|-----------|--------|------------|
|
|
21
|
-
| Model behavior changes on update | Medium | High | Version pinning (supply-chain.md P1) |
|
|
22
|
-
| Provider outage | Low | High | Fallback provider (supply-chain.md P4) |
|
|
23
|
-
| Terms of service change | Low | Medium | Contract review, alternative evaluation |
|
|
24
|
-
| Data residency non-compliance | [check] | High | Verify provider data routing |
|
|
25
|
-
| Model deprecation | Medium | Medium | Migration plan, regression test suite |
|
|
26
|
-
|
|
27
|
-
## Data handling
|
|
28
|
-
- **Data sent to provider:** [Enumerate every field included in the messages array. Example: "claim_description (redacted), claim_type, date_filed. No PII sent — redacted by pii-handling.md P1"]
|
|
29
|
-
- **PII sent:** Yes/No [should be No — see pii-handling.md]
|
|
30
|
-
- **Data retention by provider:** [Look up the provider's data retention policy. Example: "Anthropic: zero retention on API by default. OpenAI: 30-day retention unless opted out via API"]
|
|
31
|
-
- **Provider's data used for training:** Yes/No [check provider's terms]
|
|
32
|
-
|
|
33
|
-
## Contingency plan
|
|
34
|
-
- **Fallback provider:** [from supply-chain.md P4]
|
|
35
|
-
- **Fallback behavior:** [from fallback-patterns.md]
|
|
36
|
-
- **Maximum acceptable downtime:** [requires human input]
|
|
37
|
-
- **Migration estimated effort:** [days/weeks]
|
|
38
|
-
|
|
39
|
-
## Review schedule
|
|
40
|
-
- **Next review date:** [quarterly recommended for high-risk]
|
|
41
|
-
- **Trigger for immediate review:** provider update, incident, terms change
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
id: checklist-audit-logging
|
|
3
|
-
implements: audit-logging
|
|
4
|
-
---
|
|
5
|
-
# Verification: Audit logging
|
|
6
|
-
|
|
7
|
-
| # | Check | Control | Status | Evidence |
|
|
8
|
-
|---|-------|---------|--------|----------|
|
|
9
|
-
| V1 | Does every LLM interaction produce a structured log entry with trace ID? | MANAGE-4.1/P1 | [ ] | |
|
|
10
|
-
| V2 | Is the trace ID propagated across all system components? | MANAGE-4.1/P2 | [ ] | |
|
|
11
|
-
| V3 | Are AI-influenced decisions logged with full context? | MANAGE-4.1/P3 | [ ] | |
|
|
12
|
-
| V4 | Confirm: no raw PII in log entries. | Anti-pattern | [ ] | |
|
|
13
|
-
| V5 | Confirm: all interactions logged, not just errors. | Anti-pattern | [ ] | |
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
id: checklist-bias-monitoring
|
|
3
|
-
implements: bias-monitoring
|
|
4
|
-
---
|
|
5
|
-
# Verification: Bias monitoring
|
|
6
|
-
|
|
7
|
-
| # | Check | Control | Status | Evidence |
|
|
8
|
-
|---|-------|---------|--------|----------|
|
|
9
|
-
| V1 | Does the logging schema include fairness-enabling metadata fields? | MEASURE-2.11/P1 | [ ] | |
|
|
10
|
-
| V2 | Is there output distribution monitoring across demographic segments? | MEASURE-2.11/P2 | [ ] | |
|
|
11
|
-
| V3 | Is there a periodic fairness report generation mechanism? | MEASURE-2.11/P3 | [ ] | |
|
|
12
|
-
| V4 | Confirm: protected characteristics are NOT collected directly. | Anti-pattern | [ ] | |
|
|
13
|
-
| V5 | Are human override patterns analyzed for bias signals? | Edge case | [ ] | |
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
id: checklist-confidence-scoring
|
|
3
|
-
implements: confidence-scoring
|
|
4
|
-
---
|
|
5
|
-
# Verification: Confidence scoring
|
|
6
|
-
|
|
7
|
-
| # | Check | Control | Status | Evidence |
|
|
8
|
-
|---|-------|---------|--------|----------|
|
|
9
|
-
| V1 | Does every AI response include structured confidence metadata? | LLM09/P1 | [ ] | |
|
|
10
|
-
| V2 | Is there a grounding verification step for RAG-based responses? | LLM09/P2 | [ ] | |
|
|
11
|
-
| V3 | Is AI output framed as recommendation (not fact) in user-facing displays? | LLM09/P3 | [ ] | |
|
|
12
|
-
| V4 | Confirm: no "The AI determined..." framing. Uses "suggests" or "recommends". | Anti-pattern | [ ] | |
|
|
13
|
-
| V5 | Are low-confidence outputs flagged for human review? | Edge case | [ ] | |
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
id: checklist-data-integrity
|
|
3
|
-
implements: data-integrity
|
|
4
|
-
---
|
|
5
|
-
# Verification: Data integrity
|
|
6
|
-
|
|
7
|
-
| # | Check | Control | Status | Evidence |
|
|
8
|
-
|---|-------|---------|--------|----------|
|
|
9
|
-
| V1 | Is data provenance tracked (source, checksum, ingestion date)? | LLM04/P1 | [ ] | |
|
|
10
|
-
| V2 | Is data validated before entering the vector store / training pipeline? | LLM04/P2 | [ ] | |
|
|
11
|
-
| V3 | Are training/fine-tuning datasets checksummed and versioned? | LLM04/P3 | [ ] | |
|
|
12
|
-
| V4 | Confirm: no unverified external data sources ingested without validation. | Anti-pattern | [ ] | |
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
id: checklist-explainability
|
|
3
|
-
implements: explainability
|
|
4
|
-
---
|
|
5
|
-
# Verification: Explainability
|
|
6
|
-
|
|
7
|
-
| # | Check | Control | Status | Evidence |
|
|
8
|
-
|---|-------|---------|--------|----------|
|
|
9
|
-
| V1 | Does the system generate human-readable explanations for decisions? | MEASURE-2.9/P1 | [ ] | |
|
|
10
|
-
| V2 | Is there a model card documenting purpose, limitations, and performance? | MEASURE-2.9/P2 | [ ] | |
|
|
11
|
-
| V3 | Are decision records stored in an audit-friendly format? | Clause-9.1/P3 | [ ] | |
|
|
12
|
-
| V4 | Confirm: explanations use plain language, not technical jargon. | Anti-pattern | [ ] | |
|
|
13
|
-
| V5 | Is appeal/review information included in decision outputs? | Edge case | [ ] | |
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
id: checklist-fallback-patterns
|
|
3
|
-
implements: fallback-patterns
|
|
4
|
-
---
|
|
5
|
-
# Verification: Fallback patterns
|
|
6
|
-
|
|
7
|
-
| # | Check | Control | Status | Evidence |
|
|
8
|
-
|---|-------|---------|--------|----------|
|
|
9
|
-
| V1 | Is there a defined default safe response for LLM failures? | MEASURE-2.6/P1 | [ ] | |
|
|
10
|
-
| V2 | Is there a circuit breaker that trips on repeated failures? | MANAGE-2.4/P2 | [ ] | |
|
|
11
|
-
| V3 | Is there a kill switch that can be toggled without code deployment? | MANAGE-2.4/P3 | [ ] | |
|
|
12
|
-
| V4 | Confirm: no crashes on LLM errors (all exceptions caught). | Anti-pattern | [ ] | |
|
|
13
|
-
| V5 | Is there a defined recovery process after kill switch activation? | Edge case | [ ] | |
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
id: checklist-human-oversight
|
|
3
|
-
implements: human-oversight
|
|
4
|
-
---
|
|
5
|
-
# Verification: Human oversight
|
|
6
|
-
|
|
7
|
-
| # | Check | Control | Status | Evidence |
|
|
8
|
-
|---|-------|---------|--------|----------|
|
|
9
|
-
| V1 | Are LLM tools defined as an explicit allowlist (not blocklist)? | LLM06/P1 | [ ] | |
|
|
10
|
-
| V2 | Do write/mutating operations require human approval? | LLM06/P2 | [ ] | |
|
|
11
|
-
| V3 | Is there action rate limiting for LLM-initiated actions? | LLM06/P3 | [ ] | |
|
|
12
|
-
| V4 | Does every AI-influenced response include an override mechanism? | LLM06/P4 | [ ] | |
|
|
13
|
-
| V5 | Is there an audit trail for every LLM-initiated action? | Anti-pattern | [ ] | |
|
|
14
|
-
| V6 | For low-confidence outputs, is human review required? | Edge case | [ ] | |
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
id: checklist-input-validation
|
|
3
|
-
implements: input-validation
|
|
4
|
-
---
|
|
5
|
-
# Verification: Input validation
|
|
6
|
-
|
|
7
|
-
| # | Check | Control | Status | Evidence |
|
|
8
|
-
|---|-------|---------|--------|----------|
|
|
9
|
-
| V1 | Is there a maximum input length check (characters and/or tokens) before the LLM call? | LLM01/P1 | [ ] | |
|
|
10
|
-
| V2 | Does the code use API native role separation (system vs user messages), not string concatenation? | LLM01/P2 | [ ] | |
|
|
11
|
-
| V3 | Is there a sanitization function stripping control characters and zero-width Unicode before the LLM call? | LLM01/P3 | [ ] | |
|
|
12
|
-
| V4 | Is LLM output validated against a defined schema before downstream use? | LLM01/P4 | [ ] | |
|
|
13
|
-
| V5 | Is there an injection pattern detection layer (even if advisory/logging-only)? | LLM01/P5 | [ ] | |
|
|
14
|
-
| V6 | Confirm: no string concatenation or f-strings used to build prompts. | Anti-pattern | [ ] | |
|
|
15
|
-
| V7 | Confirm: input exceeding length limits returns an error, not silent truncation. | Anti-pattern | [ ] | |
|
|
16
|
-
| V8 | If system processes documents/files: is extracted text sanitized with same pipeline as direct input? | Edge case | [ ] | |
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
id: checklist-monitoring
|
|
3
|
-
implements: monitoring
|
|
4
|
-
---
|
|
5
|
-
# Verification: Monitoring
|
|
6
|
-
|
|
7
|
-
| # | Check | Control | Status | Evidence |
|
|
8
|
-
|---|-------|---------|--------|----------|
|
|
9
|
-
| V1 | Are key metrics (latency, error rate, override rate, cost) tracked? | MANAGE-4.1/P1 | [ ] | |
|
|
10
|
-
| V2 | Is there output drift detection comparing recent to baseline? | MANAGE-4.1/P2 | [ ] | |
|
|
11
|
-
| V3 | Is there a user feedback mechanism (agree/disagree/escalate)? | MANAGE-4.2/P3 | [ ] | |
|
|
12
|
-
| V4 | Is there structured incident logging? | MANAGE-4.3/P4 | [ ] | |
|
|
13
|
-
| V5 | Confirm: monitoring is active from day one, not added later. | Anti-pattern | [ ] | |
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
id: checklist-output-sanitization
|
|
3
|
-
implements: output-sanitization
|
|
4
|
-
---
|
|
5
|
-
# Verification: Output sanitization
|
|
6
|
-
|
|
7
|
-
| # | Check | Control | Status | Evidence |
|
|
8
|
-
|---|-------|---------|--------|----------|
|
|
9
|
-
| V1 | Is LLM output encoded/escaped before rendering in HTML? | LLM05/P2 | [ ] | |
|
|
10
|
-
| V2 | Are database operations using parameterized queries, not string interpolation with LLM output? | LLM05/P3 | [ ] | |
|
|
11
|
-
| V3 | If LLM generates code for execution, is it sandboxed? | LLM05/P4 | [ ] | |
|
|
12
|
-
| V4 | Is LLM output content type validated before use? | LLM05/P5 | [ ] | |
|
|
13
|
-
| V5 | Confirm: no eval() or exec() on raw LLM output. | Anti-pattern | [ ] | |
|
|
14
|
-
| V6 | If rendering LLM markdown as HTML, is a sanitizing parser used? | Edge case | [ ] | |
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
id: checklist-pii-handling
|
|
3
|
-
implements: pii-handling
|
|
4
|
-
---
|
|
5
|
-
# Verification: PII handling
|
|
6
|
-
|
|
7
|
-
| # | Check | Control | Status | Evidence |
|
|
8
|
-
|---|-------|---------|--------|----------|
|
|
9
|
-
| V1 | Is PII detected and redacted before being sent to the LLM? | LLM02/P1 | [ ] | |
|
|
10
|
-
| V2 | Does the system send only necessary fields to the LLM (data minimization)? | LLM02/P2 | [ ] | |
|
|
11
|
-
| V3 | Is LLM output scanned for PII before returning to the user? | LLM02/P3 | [ ] | |
|
|
12
|
-
| V4 | Are PII-containing records stored separately from LLM-accessible data? | LLM02/P4 | [ ] | |
|
|
13
|
-
| V5 | Are logs written with redacted content, never raw PII? | LLM02/P5 | [ ] | |
|
|
14
|
-
| V6 | Confirm: no full database records sent to the LLM. | Anti-pattern | [ ] | |
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
id: checklist-prompt-security
|
|
3
|
-
implements: prompt-security
|
|
4
|
-
---
|
|
5
|
-
# Verification: Prompt security
|
|
6
|
-
|
|
7
|
-
| # | Check | Control | Status | Evidence |
|
|
8
|
-
|---|-------|---------|--------|----------|
|
|
9
|
-
| V1 | Confirm: no API keys, passwords, or tokens in system prompts. | LLM07/P1 | [ ] | |
|
|
10
|
-
| V2 | Is the system prompt minimal (behavior only, no implementation details)? | LLM07/P2 | [ ] | |
|
|
11
|
-
| V3 | Is there a leakage detection check on LLM output? | LLM07/P3 | [ ] | |
|
|
12
|
-
| V4 | Are business rules enforced in code, not just in prompts? | LLM07/P4 | [ ] | |
|
|
13
|
-
| V5 | Confirm: system prompt does not contain "do not reveal these instructions" as sole protection. | Anti-pattern | [ ] | |
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
id: checklist-rag-security
|
|
3
|
-
implements: rag-security
|
|
4
|
-
---
|
|
5
|
-
# Verification: RAG security
|
|
6
|
-
|
|
7
|
-
| # | Check | Control | Status | Evidence |
|
|
8
|
-
|---|-------|---------|--------|----------|
|
|
9
|
-
| V1 | Are access controls applied to vector database queries? | LLM08/P1 | [ ] | |
|
|
10
|
-
| V2 | Is there tenant isolation in multi-tenant RAG systems? | LLM08/P2 | [ ] | |
|
|
11
|
-
| V3 | Are retrieved results validated (relevance threshold, injection scan)? | LLM08/P3 | [ ] | |
|
|
12
|
-
| V4 | Confirm: no cross-tenant data leakage possible. | Anti-pattern | [ ] | |
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
id: checklist-rate-limiting
|
|
3
|
-
implements: rate-limiting
|
|
4
|
-
---
|
|
5
|
-
# Verification: Rate limiting
|
|
6
|
-
|
|
7
|
-
| # | Check | Control | Status | Evidence |
|
|
8
|
-
|---|-------|---------|--------|----------|
|
|
9
|
-
| V1 | Is there per-user rate limiting on LLM endpoints? | LLM10/P1 | [ ] | |
|
|
10
|
-
| V2 | Is there a token budget with daily and per-request limits? | LLM10/P2 | [ ] | |
|
|
11
|
-
| V3 | Is cost monitoring with alerting implemented? | LLM10/P3 | [ ] | |
|
|
12
|
-
| V4 | Are LLM calls wrapped with a timeout? | LLM10/P4 | [ ] | |
|
|
13
|
-
| V5 | Confirm: rate limits are per API key, not just per IP. | Anti-pattern | [ ] | |
|