@aigis-ai/cli 1.0.3 → 2.0.2
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/CONTRIBUTING.md +53 -0
- package/README.md +58 -188
- package/SKILL.md +20 -55
- package/aigis-ai-cli-2.0.1.tgz +0 -0
- package/bin/aigis.js +446 -59
- package/content/index/audit-scan.md +21 -207
- package/content/index/auto-verify-rules.json +439 -0
- package/content/index/context-rules.json +90 -0
- package/content/resolvers/triggers.json +229 -0
- package/content/{implement → skills/areas}/audit-logging.md +5 -0
- package/content/skills/areas/fallback-patterns.md +200 -0
- package/content/skills/areas/input-validation.md +380 -0
- package/content/skills/areas/pii-handling.md +189 -0
- package/content/skills/areas/rate-limiting.md +246 -0
- package/content/skills/core.md +62 -0
- package/content/skills/infrastructure/logging.md +202 -0
- package/content/skills/infrastructure/rate-limiting.md +169 -0
- package/content/skills/infrastructure/secrets.md +167 -0
- package/content/skills/workflows/fastapi-llm.md +86 -0
- package/docs/resolvers.md +114 -0
- package/lib/auto-verify.js +378 -0
- package/lib/build.js +629 -0
- package/lib/checksum.js +39 -0
- package/lib/fetch.js +164 -9
- package/lib/init.js +141 -93
- package/lib/keywords.js +92 -130
- package/lib/special-recognizers.js +370 -0
- package/package.json +1 -1
- package/scripts/baseline-cursorrules.snapshot.txt +30 -0
- package/scripts/bootstrap-step-6-bench.js +85 -0
- package/scripts/check-content-sync.js +91 -0
- package/scripts/triggers.schema.json +50 -0
- package/scripts/validate-triggers.js +176 -0
- package/content/implement/fallback-patterns.md +0 -190
- package/content/implement/input-validation.md +0 -212
- package/content/implement/pii-handling.md +0 -207
- package/content/implement/rate-limiting.md +0 -217
- /package/content/{implement → skills/areas}/bias-monitoring.md +0 -0
- /package/content/{implement → skills/areas}/confidence-scoring.md +0 -0
- /package/content/{implement → skills/areas}/data-integrity.md +0 -0
- /package/content/{implement → skills/areas}/explainability.md +0 -0
- /package/content/{implement → skills/areas}/human-oversight.md +0 -0
- /package/content/{implement → skills/areas}/monitoring.md +0 -0
- /package/content/{implement → skills/areas}/output-sanitization.md +0 -0
- /package/content/{implement → skills/areas}/prompt-security.md +0 -0
- /package/content/{implement → skills/areas}/rag-security.md +0 -0
- /package/content/{implement → skills/areas}/supply-chain.md +0 -0
|
@@ -0,0 +1,439 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_schema_doc": "Auto-verify rules for aigis verify --auto. Each pattern area (key at top level) maps to an object with 'auto', 'overclaim', and 'judgment' sections. AUTO checks pass if ANY of their patterns match any file in the project under the default glob. OVERCLAIM checks run a named recognizer from lib/special-recognizers. JUDGMENT checks are listed without rules and are returned to the agent for evaluation.",
|
|
3
|
+
"_schema_auto_entry": {
|
|
4
|
+
"desc": "What this check is looking for",
|
|
5
|
+
"patterns": ["regex-string-1", "regex-string-2"],
|
|
6
|
+
"require": "any|all (default: any)",
|
|
7
|
+
"file_glob": "optional override of default project glob"
|
|
8
|
+
},
|
|
9
|
+
"_schema_overclaim_entry": {
|
|
10
|
+
"desc": "What this overclaim pattern looks like",
|
|
11
|
+
"recognizer": "name_of_recognizer_function",
|
|
12
|
+
"also_auto": "V1 (optional: run this auto rule first; overclaim only raised if auto passed)"
|
|
13
|
+
},
|
|
14
|
+
|
|
15
|
+
"audit-logging": {
|
|
16
|
+
"auto": {
|
|
17
|
+
"V1": {
|
|
18
|
+
"desc": "Structured log entry with trace_id for LLM interactions",
|
|
19
|
+
"patterns": ["trace_id", "traceId", "correlation_id"],
|
|
20
|
+
"require": "any"
|
|
21
|
+
},
|
|
22
|
+
"V2": {
|
|
23
|
+
"desc": "Trace ID generated and propagated",
|
|
24
|
+
"patterns": ["ContextVar\\s*\\(.*trace", "trace_id_var", "set_trace_id", "x[-_]trace[-_]id", "trace_id\\s*=\\s*str\\s*\\(\\s*uuid\\.uuid4", "trace_id\\s*=\\s*uuid\\.uuid4", "generate_trace_id"],
|
|
25
|
+
"require": "any"
|
|
26
|
+
},
|
|
27
|
+
"V3": {
|
|
28
|
+
"desc": "AI-influenced decisions logged with context",
|
|
29
|
+
"patterns": ["log_decision", "decision_log", "event_type[\"'\\s:=]+(ai_decision|decision)", "_log_audit_event\\s*\\(\\s*[\"']decision"],
|
|
30
|
+
"require": "any"
|
|
31
|
+
},
|
|
32
|
+
"V4": {
|
|
33
|
+
"desc": "Logging is PII-redacted (redact function referenced near logger)",
|
|
34
|
+
"patterns": ["redact_pii|redactPii|RedactPII", "input_hash|inputHash", "hashlib\\.sha256.*input"],
|
|
35
|
+
"require": "any"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"overclaim": {},
|
|
39
|
+
"judgment": {
|
|
40
|
+
"V5": "Are ALL interactions logged (not just errors)? Requires reading log call sites to confirm coverage."
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
"bias-monitoring": {
|
|
45
|
+
"auto": {
|
|
46
|
+
"V1": {
|
|
47
|
+
"desc": "Fairness-enabling fields in logs",
|
|
48
|
+
"patterns": ["fairness", "claim_type", "input_length_bucket", "submission_channel", "bucket_length"],
|
|
49
|
+
"require": "any"
|
|
50
|
+
},
|
|
51
|
+
"V3": {
|
|
52
|
+
"desc": "Fairness report generator exists",
|
|
53
|
+
"patterns": ["generate_fairness_report", "fairness_report", "BiasMonitor"],
|
|
54
|
+
"require": "any"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"overclaim": {},
|
|
58
|
+
"judgment": {
|
|
59
|
+
"V2": "Is distribution monitoring by demographic segments actually wired to a backend (not a stub that returns [])? Requires agent inspection of the monitor implementation.",
|
|
60
|
+
"V4": "Confirm protected characteristics are not collected. Absence is hard to prove by regex.",
|
|
61
|
+
"V5": "Is override pattern analysis actually implemented (not a placeholder)? Requires agent inspection."
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
"confidence-scoring": {
|
|
66
|
+
"auto": {
|
|
67
|
+
"V1": {
|
|
68
|
+
"desc": "Confidence metadata on AI responses",
|
|
69
|
+
"patterns": ["confidence_score", "confidence\\s*:\\s*float", "confidence\\s*[:=]\\s*Field", "ConfidenceScore"],
|
|
70
|
+
"require": "any"
|
|
71
|
+
},
|
|
72
|
+
"V3": {
|
|
73
|
+
"desc": "Recommendation framing (language of suggestion)",
|
|
74
|
+
"patterns": ["recommendation\\s*[:=]", "recommends?\\(", "suggests?\\(", "AI-assisted", "ai_assisted"],
|
|
75
|
+
"require": "any"
|
|
76
|
+
},
|
|
77
|
+
"V4": {
|
|
78
|
+
"desc": "No 'The AI determined' framing (inverse: absence indicates PASS)",
|
|
79
|
+
"patterns": ["The AI determined", "AI has decided", "the model decided"],
|
|
80
|
+
"require": "any",
|
|
81
|
+
"inverse": true
|
|
82
|
+
},
|
|
83
|
+
"V5": {
|
|
84
|
+
"desc": "Low-confidence flagged for human review",
|
|
85
|
+
"patterns": ["requires_human_review", "human_review_required", "(?:confidence|conf|score)\\s*<\\s*0\\.", "confidence_threshold", "DecisionGate"],
|
|
86
|
+
"require": "any"
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
"overclaim": {},
|
|
90
|
+
"judgment": {
|
|
91
|
+
"V2": "Is grounding verification implemented for RAG? N/A for non-RAG systems."
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
|
|
95
|
+
"data-integrity": {
|
|
96
|
+
"auto": {
|
|
97
|
+
"V1": {
|
|
98
|
+
"desc": "Data provenance tracking (checksum, ingestion date)",
|
|
99
|
+
"patterns": ["checksum", "hashlib\\..*\\.hexdigest", "ingestion_date|ingested_at", "provenance"],
|
|
100
|
+
"require": "any"
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
"overclaim": {},
|
|
104
|
+
"judgment": {
|
|
105
|
+
"V2": "Pre-embedding validation requires agent evaluation of vector pipeline.",
|
|
106
|
+
"V3": "Dataset versioning requires agent evaluation of training pipeline.",
|
|
107
|
+
"V4": "Absence of unverified data sources is hard to prove by regex."
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
|
|
111
|
+
"explainability": {
|
|
112
|
+
"auto": {
|
|
113
|
+
"V1": {
|
|
114
|
+
"desc": "Human-readable explanation field in responses",
|
|
115
|
+
"patterns": ["explanation\\s*[:=]", "reasoning\\s*[:=]", "generate_explanation", "human_readable"],
|
|
116
|
+
"require": "any"
|
|
117
|
+
},
|
|
118
|
+
"V2": {
|
|
119
|
+
"desc": "Model card exists (endpoint, file, or function)",
|
|
120
|
+
"patterns": ["model_card", "model-card", "modelCard", "/model-card"],
|
|
121
|
+
"require": "any"
|
|
122
|
+
},
|
|
123
|
+
"V3": {
|
|
124
|
+
"desc": "Audit-friendly structured logs",
|
|
125
|
+
"patterns": ["audit_logger|audit_log", "json\\.dumps.*decision", "structured.*log", "event_type"],
|
|
126
|
+
"require": "any"
|
|
127
|
+
},
|
|
128
|
+
"V5": {
|
|
129
|
+
"desc": "Appeal / review info in decision outputs",
|
|
130
|
+
"patterns": ["appeal", "override_available", "human_override", "review_endpoint"],
|
|
131
|
+
"require": "any"
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
"overclaim": {},
|
|
135
|
+
"judgment": {
|
|
136
|
+
"V4": "Plain-language vs technical jargon is a stylistic judgment regex can't make reliably."
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
|
|
140
|
+
"fallback-patterns": {
|
|
141
|
+
"auto": {
|
|
142
|
+
"V1": {
|
|
143
|
+
"desc": "Default safe response function for LLM failures",
|
|
144
|
+
"patterns": ["default_safe_response", "default_safe_assessment", "fallback_response", "safe_default", "_?fallback_assessment", "(?:def|function)\\s+\\w*fallback\\w*"],
|
|
145
|
+
"require": "any"
|
|
146
|
+
},
|
|
147
|
+
"V2": {
|
|
148
|
+
"desc": "Circuit breaker with state machine",
|
|
149
|
+
"patterns": ["CircuitBreaker", "circuit_breaker", "(\"|')closed(\"|').*(\"|')open(\"|')", "half[_-]?open"],
|
|
150
|
+
"require": "any"
|
|
151
|
+
},
|
|
152
|
+
"V3": {
|
|
153
|
+
"desc": "Kill switch toggle",
|
|
154
|
+
"patterns": ["ai_system_enabled|AI_SYSTEM_ENABLED|aiSystemEnabled", "kill_switch|killSwitch|KILL_SWITCH", "feature_flag|featureFlag"],
|
|
155
|
+
"require": "any"
|
|
156
|
+
},
|
|
157
|
+
"V4": {
|
|
158
|
+
"desc": "Exception handling around LLM call (try + except + LLM reference all present)",
|
|
159
|
+
"patterns": ["\\btry\\s*[:{]", "\\b(?:except|catch)\\b", "(?:anthropic|openai|messages\\.create|client\\.messages|_assess_with_|call_claude|call_llm|_call_llm|circuit_breaker\\.call|call_with_llm_circuit)"],
|
|
160
|
+
"require": "all"
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
"overclaim": {
|
|
164
|
+
"V3": {
|
|
165
|
+
"desc": "Kill switch is restart-latched (env read only at import, not per request)",
|
|
166
|
+
"recognizer": "kill_switch_restart_latched",
|
|
167
|
+
"also_auto": "V3"
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
"judgment": {
|
|
171
|
+
"V5": "Is there a defined recovery process after kill-switch activation? Requires runbook/docs inspection."
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
|
|
175
|
+
"human-oversight": {
|
|
176
|
+
"auto": {
|
|
177
|
+
"V1": {
|
|
178
|
+
"desc": "Explicit tool allowlist structure",
|
|
179
|
+
"patterns": ["ALLOWED_TOOLS|allowed_tools|allowedTools", "tool_allowlist|tool_policy"],
|
|
180
|
+
"require": "any"
|
|
181
|
+
},
|
|
182
|
+
"V3": {
|
|
183
|
+
"desc": "Action rate limiting on LLM-initiated actions",
|
|
184
|
+
"patterns": ["RateLimiter|rate_limiter|rateLimiter", "rate_limit_check|checkRateLimit"],
|
|
185
|
+
"require": "any"
|
|
186
|
+
},
|
|
187
|
+
"V4": {
|
|
188
|
+
"desc": "Override mechanism surfaced in responses",
|
|
189
|
+
"patterns": ["override(_available|Available|:)|human_override|humanOverride", "appeal"],
|
|
190
|
+
"require": "any"
|
|
191
|
+
},
|
|
192
|
+
"V5": {
|
|
193
|
+
"desc": "Audit trail for LLM-initiated actions",
|
|
194
|
+
"patterns": ["log_decision|audit_logger|audit_log", "controls_applied|controlsApplied"],
|
|
195
|
+
"require": "any"
|
|
196
|
+
},
|
|
197
|
+
"V6": {
|
|
198
|
+
"desc": "Low-confidence routed to human review",
|
|
199
|
+
"patterns": ["requires_human_review|humanReviewRequired", "DecisionGate", "(?:confidence|conf|score)\\s*<\\s*0\\."],
|
|
200
|
+
"require": "any"
|
|
201
|
+
}
|
|
202
|
+
},
|
|
203
|
+
"overclaim": {},
|
|
204
|
+
"judgment": {
|
|
205
|
+
"V2": "Whether mutating operations require human approval is architectural; regex can't tell which ops are mutating without project-specific context."
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
|
|
209
|
+
"input-validation": {
|
|
210
|
+
"auto": {
|
|
211
|
+
"V1": {
|
|
212
|
+
"desc": "Maximum input length check",
|
|
213
|
+
"patterns": ["max_length\\s*[:=]\\s*\\d+", "maxLength\\s*[:=]\\s*\\d+", "MAX_INPUT_LENGTH|MAX_LEN|MAX_TOKENS", "validate_input_length"],
|
|
214
|
+
"require": "any"
|
|
215
|
+
},
|
|
216
|
+
"V2": {
|
|
217
|
+
"desc": "System/user role separation in LLM call",
|
|
218
|
+
"patterns": ["[\"']role[\"']\\s*:\\s*[\"']system[\"']", "[\"']role[\"']\\s*:\\s*[\"']user[\"']", "system\\s*=\\s*[A-Z_]*PROMPT", "system\\s*:\\s*SYSTEM_PROMPT"],
|
|
219
|
+
"require": "any"
|
|
220
|
+
},
|
|
221
|
+
"V3": {
|
|
222
|
+
"desc": "Sanitization of control chars / zero-width Unicode",
|
|
223
|
+
"patterns": ["\\\\x00|\\\\u200[B-F]|\\\\u202[A-E]|\\\\uFEFF", "DANGEROUS_CHARS|SANITIZE|sanitize_input", "unicodedata\\.normalize"],
|
|
224
|
+
"require": "any"
|
|
225
|
+
},
|
|
226
|
+
"V4": {
|
|
227
|
+
"desc": "Output schema validation against Pydantic/Zod/equivalent",
|
|
228
|
+
"patterns": ["model_validate|model_validate_json|parse_obj_as", "BaseModel", "ValidationError", "z\\.object|z\\.string"],
|
|
229
|
+
"require": "any"
|
|
230
|
+
},
|
|
231
|
+
"V5": {
|
|
232
|
+
"desc": "Injection pattern detection layer exists",
|
|
233
|
+
"patterns": ["SUSPICIOUS_PATTERNS|INJECTION_PATTERN", "check_injection|detect_injection|scan_injection", "ignore previous instructions"],
|
|
234
|
+
"require": "any"
|
|
235
|
+
},
|
|
236
|
+
"V6": {
|
|
237
|
+
"desc": "No f-string / concat of user input into prompt (anti-pattern: presence = FAIL)",
|
|
238
|
+
"patterns": ["f[\"'][^\"']*\\{(claim|user|input|prompt)[^}]*\\}[^\"']*[\"'].*(?:messages|system|prompt)", "prompt\\s*\\+\\s*(user|input|claim)"],
|
|
239
|
+
"require": "any",
|
|
240
|
+
"inverse": true
|
|
241
|
+
},
|
|
242
|
+
"V7": {
|
|
243
|
+
"desc": "Oversize input raises error (not silent truncation)",
|
|
244
|
+
"patterns": ["raise\\s+(ValueError|HTTPException|ValidationError).*(?:length|too large|exceed)", "HTTPException\\s*\\(\\s*status_code\\s*=\\s*(400|422|413)"],
|
|
245
|
+
"require": "any"
|
|
246
|
+
}
|
|
247
|
+
},
|
|
248
|
+
"overclaim": {
|
|
249
|
+
"V5": {
|
|
250
|
+
"desc": "Injection detector is log-only (callsite does not block/branch on result)",
|
|
251
|
+
"recognizer": "injection_log_only",
|
|
252
|
+
"also_auto": "V5"
|
|
253
|
+
}
|
|
254
|
+
},
|
|
255
|
+
"judgment": {
|
|
256
|
+
"V8": "File/document extraction path parity is N/A when no file ingestion exists. Needs agent to confirm."
|
|
257
|
+
}
|
|
258
|
+
},
|
|
259
|
+
|
|
260
|
+
"monitoring": {
|
|
261
|
+
"auto": {
|
|
262
|
+
"V1": {
|
|
263
|
+
"desc": "Key metrics tracked (latency/error/cost)",
|
|
264
|
+
"patterns": ["latency_ms|latencyMs", "error_rate|errorRate", "token_count|tokenCount|usage\\.", "MONITORING_METRICS|metrics_logger"],
|
|
265
|
+
"require": "any"
|
|
266
|
+
},
|
|
267
|
+
"V2": {
|
|
268
|
+
"desc": "Drift detection comparing recent to baseline",
|
|
269
|
+
"patterns": ["drift_detected|driftDetected|DriftDetector", "baseline.*compare|compare.*baseline"],
|
|
270
|
+
"require": "any"
|
|
271
|
+
},
|
|
272
|
+
"V3": {
|
|
273
|
+
"desc": "User feedback mechanism (agree/disagree/escalate)",
|
|
274
|
+
"patterns": ["/feedback|post_feedback|submit_feedback|record_feedback", "feedback_type|feedbackType", "agree.*disagree|thumbs_up.*thumbs_down"],
|
|
275
|
+
"require": "any"
|
|
276
|
+
},
|
|
277
|
+
"V4": {
|
|
278
|
+
"desc": "Structured incident logging",
|
|
279
|
+
"patterns": ["log_incident|logIncident", "incident_type|incidentType", "incident_id|incidentId"],
|
|
280
|
+
"require": "any"
|
|
281
|
+
}
|
|
282
|
+
},
|
|
283
|
+
"overclaim": {},
|
|
284
|
+
"judgment": {
|
|
285
|
+
"V5": "Whether monitoring was active from day one is a process question, not a code question."
|
|
286
|
+
}
|
|
287
|
+
},
|
|
288
|
+
|
|
289
|
+
"output-sanitization": {
|
|
290
|
+
"auto": {
|
|
291
|
+
"V4": {
|
|
292
|
+
"desc": "Content type / schema validation of LLM output",
|
|
293
|
+
"patterns": ["model_validate|parse_assessment|AssessmentOutput", "schema\\.validate|schemaValidate", "Enum\\s*\\)|enum\\s*\\)"],
|
|
294
|
+
"require": "any"
|
|
295
|
+
},
|
|
296
|
+
"V5": {
|
|
297
|
+
"desc": "No eval/exec on raw LLM output (anti-pattern: presence = FAIL)",
|
|
298
|
+
"patterns": ["\\beval\\s*\\(", "\\bexec\\s*\\(", "Function\\s*\\(.*new Function"],
|
|
299
|
+
"require": "any",
|
|
300
|
+
"inverse": true
|
|
301
|
+
}
|
|
302
|
+
},
|
|
303
|
+
"overclaim": {},
|
|
304
|
+
"judgment": {
|
|
305
|
+
"V1": "HTML escaping only applies when the system renders HTML. API-only services should mark N/A.",
|
|
306
|
+
"V2": "Parameterized DB queries only apply when the system has a DB layer. Absence of DB = N/A.",
|
|
307
|
+
"V3": "Sandbox for code execution only applies when LLM output is executed. Absence = N/A.",
|
|
308
|
+
"V6": "Markdown-to-HTML sanitization only applies if the system renders markdown."
|
|
309
|
+
}
|
|
310
|
+
},
|
|
311
|
+
|
|
312
|
+
"pii-handling": {
|
|
313
|
+
"auto": {
|
|
314
|
+
"V1": {
|
|
315
|
+
"desc": "PII redaction called before LLM request",
|
|
316
|
+
"patterns": ["redact_pii|redactPII|redactPii", "PII_PATTERNS|piiPatterns"],
|
|
317
|
+
"require": "any"
|
|
318
|
+
},
|
|
319
|
+
"V3": {
|
|
320
|
+
"desc": "LLM output scanned for PII",
|
|
321
|
+
"patterns": ["filter_output_pii|filterOutputPii", "redact_pii.*output|redact.*response"],
|
|
322
|
+
"require": "any"
|
|
323
|
+
},
|
|
324
|
+
"V5": {
|
|
325
|
+
"desc": "Logs written with redacted content",
|
|
326
|
+
"patterns": ["redact_pii.*log|logger.*redact", "input_hash|hashlib.*input", "redacted_out|output_redacted"],
|
|
327
|
+
"require": "any"
|
|
328
|
+
}
|
|
329
|
+
},
|
|
330
|
+
"overclaim": {
|
|
331
|
+
"V1": {
|
|
332
|
+
"desc": "PII pattern coverage is incomplete (fewer than the 5 required classes: ssn, email, phone, credit_card, address)",
|
|
333
|
+
"recognizer": "pii_incomplete_classes",
|
|
334
|
+
"also_auto": "V1"
|
|
335
|
+
}
|
|
336
|
+
},
|
|
337
|
+
"judgment": {
|
|
338
|
+
"V2": "Data minimization (only necessary fields sent to LLM) requires agent review of request schema.",
|
|
339
|
+
"V4": "Separated PII storage is architectural.",
|
|
340
|
+
"V6": "Whether full records are sent to LLM requires request-shape inspection."
|
|
341
|
+
}
|
|
342
|
+
},
|
|
343
|
+
|
|
344
|
+
"prompt-security": {
|
|
345
|
+
"auto": {
|
|
346
|
+
"V3": {
|
|
347
|
+
"desc": "Leakage detection on LLM output",
|
|
348
|
+
"patterns": ["detect_prompt_leakage|detectPromptLeakage", "prompt_leakage|promptLeakage", "leakage_detection|PROMPT_LEAK"],
|
|
349
|
+
"require": "any"
|
|
350
|
+
}
|
|
351
|
+
},
|
|
352
|
+
"overclaim": {},
|
|
353
|
+
"judgment": {
|
|
354
|
+
"V1": "Whether a system prompt contains secrets requires inspecting the prompt string's contents. Regex over the whole file produces false positives; agent should inspect the defined SYSTEM_PROMPT string for keys/credentials directly.",
|
|
355
|
+
"V2": "'Minimal' system prompt is subjective.",
|
|
356
|
+
"V4": "Whether business rules live in code vs prompt requires architectural review.",
|
|
357
|
+
"V5": "Presence of 'do not reveal' as SOLE protection is a qualitative judgment."
|
|
358
|
+
}
|
|
359
|
+
},
|
|
360
|
+
|
|
361
|
+
"rag-security": {
|
|
362
|
+
"auto": {},
|
|
363
|
+
"overclaim": {},
|
|
364
|
+
"judgment": {
|
|
365
|
+
"V1": "Vector DB access controls are architectural.",
|
|
366
|
+
"V2": "Tenant isolation is architectural.",
|
|
367
|
+
"V3": "Retrieval validation requires pipeline review.",
|
|
368
|
+
"V4": "Cross-tenant leakage is architectural."
|
|
369
|
+
}
|
|
370
|
+
},
|
|
371
|
+
|
|
372
|
+
"rate-limiting": {
|
|
373
|
+
"auto": {
|
|
374
|
+
"V1": {
|
|
375
|
+
"desc": "Per-user rate limiter",
|
|
376
|
+
"patterns": ["RateLimiter|rate_limiter|rateLimiter", "@limiter|@rate_limit", "rate_limit_check"],
|
|
377
|
+
"require": "any"
|
|
378
|
+
},
|
|
379
|
+
"V2": {
|
|
380
|
+
"desc": "Token budget (daily / per-request limits)",
|
|
381
|
+
"patterns": ["token_budget|tokenBudget", "daily_token|max_tokens_per_day", "TOKEN_BUDGET"],
|
|
382
|
+
"require": "any"
|
|
383
|
+
},
|
|
384
|
+
"V4": {
|
|
385
|
+
"desc": "Timeout configured on LLM calls",
|
|
386
|
+
"patterns": ["timeout\\s*=\\s*\\d", "timeout\\s*:\\s*\\d", "Anthropic\\s*\\([^)]*timeout", "OpenAI\\s*\\([^)]*timeout"],
|
|
387
|
+
"require": "any"
|
|
388
|
+
},
|
|
389
|
+
"V5": {
|
|
390
|
+
"desc": "Rate limit keyed on API key or user id (not IP only)",
|
|
391
|
+
"patterns": ["x[-_]api[-_]key|x[-_]user[-_]id", "(?:x_)?user_id\\s*[:=].*header", "RateLimiter.*user_id|rate_limit.*user_id", "api_limiter\\.check\\s*\\(\\s*user"],
|
|
392
|
+
"require": "any"
|
|
393
|
+
}
|
|
394
|
+
},
|
|
395
|
+
"overclaim": {
|
|
396
|
+
"V1": {
|
|
397
|
+
"desc": "Rate limiter exists but 429 responses do not include Retry-After header",
|
|
398
|
+
"recognizer": "rate_limit_no_retry_after",
|
|
399
|
+
"also_auto": "V1"
|
|
400
|
+
}
|
|
401
|
+
},
|
|
402
|
+
"judgment": {
|
|
403
|
+
"V3": "Cost monitoring / alerting is typically external infrastructure; regex can't detect 'alerts are configured'."
|
|
404
|
+
}
|
|
405
|
+
},
|
|
406
|
+
|
|
407
|
+
"supply-chain": {
|
|
408
|
+
"auto": {
|
|
409
|
+
"V1": {
|
|
410
|
+
"desc": "Model version pinned to date-stamped identifier (not 'latest')",
|
|
411
|
+
"patterns": ["claude-[a-z0-9-]+-\\d{8}", "gpt-[0-9a-z.-]+-\\d{4}", "[a-z_]+_model\\s*[:=]\\s*[\"'][a-z0-9-]+-\\d{4,8}", "MODEL_VERSION\\s*=.*\\d{4}"],
|
|
412
|
+
"require": "any"
|
|
413
|
+
},
|
|
414
|
+
"V2": {
|
|
415
|
+
"desc": "Model version tracked in responses/logs",
|
|
416
|
+
"patterns": ["model_version|modelVersion", "response.*model|response.*MODEL"],
|
|
417
|
+
"require": "any"
|
|
418
|
+
},
|
|
419
|
+
"V3": {
|
|
420
|
+
"desc": "Regression test suite (test files exist in project tree)",
|
|
421
|
+
"type": "exists_path",
|
|
422
|
+
"path_globs": ["**/tests/**", "**/test_*.py", "**/*_test.py", "**/*.test.*", "**/*.spec.*"]
|
|
423
|
+
},
|
|
424
|
+
"V4": {
|
|
425
|
+
"desc": "Fallback provider / safe fallback behavior defined",
|
|
426
|
+
"patterns": ["default_safe|fallback_response|fallback_provider", "_?fallback_assessment", "(?:def|function)\\s+\\w*fallback\\w*", "fallback\\s*=\\s*True"],
|
|
427
|
+
"require": "any"
|
|
428
|
+
},
|
|
429
|
+
"V5": {
|
|
430
|
+
"desc": "Client library versions pinned in requirements/package file",
|
|
431
|
+
"patterns": ["==\\d+\\.\\d+\\.\\d+", "[\"']\\^?\\d+\\.\\d+\\.\\d+[\"']"],
|
|
432
|
+
"require": "any",
|
|
433
|
+
"file_glob": "**/requirements*.txt,**/package.json,**/pyproject.toml,**/Pipfile.lock,**/poetry.lock"
|
|
434
|
+
}
|
|
435
|
+
},
|
|
436
|
+
"overclaim": {},
|
|
437
|
+
"judgment": {}
|
|
438
|
+
}
|
|
439
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_doc": "Context rules for `aigis get --context <name>`. A rule declares that a specific pattern heading in a file applies only to the listed contexts. Patterns NOT listed here apply to every context. The filter removes a pattern block (header through next pattern-header or section break) when the requested context is not in the pattern's context list. Manifest-driven so we don't have to inline-tag every code block; can be evolved per Step 4's content rewrite.",
|
|
3
|
+
"_schema_rule": {
|
|
4
|
+
"file": "implement file id (without .md)",
|
|
5
|
+
"pattern_heading_prefix": "heading text prefix at level 3 (### ...) to match",
|
|
6
|
+
"contexts": ["list of context names where this pattern applies"]
|
|
7
|
+
},
|
|
8
|
+
"_known_contexts": ["web", "agentic", "rag", "batch"],
|
|
9
|
+
|
|
10
|
+
"rules": [
|
|
11
|
+
{
|
|
12
|
+
"file": "input-validation",
|
|
13
|
+
"pattern_heading_prefix": "Pattern 5",
|
|
14
|
+
"contexts": ["web", "agentic"],
|
|
15
|
+
"reason": "Injection pattern detection is most relevant when input comes from users (web API) or tool calls (agentic). Batch pipelines with vetted inputs often skip this."
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"file": "human-oversight",
|
|
19
|
+
"pattern_heading_prefix": "Pattern 1",
|
|
20
|
+
"contexts": ["agentic"],
|
|
21
|
+
"reason": "Tool allowlist pattern only applies to agentic systems that expose tools/functions."
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"file": "human-oversight",
|
|
25
|
+
"pattern_heading_prefix": "Pattern 2",
|
|
26
|
+
"contexts": ["agentic"],
|
|
27
|
+
"reason": "Approval gates for mutating operations apply only when the system executes actions, not when it only recommends."
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"file": "rag-security",
|
|
31
|
+
"pattern_heading_prefix": "Pattern 1",
|
|
32
|
+
"contexts": ["rag"],
|
|
33
|
+
"reason": "Vector DB access control is RAG-specific."
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"file": "rag-security",
|
|
37
|
+
"pattern_heading_prefix": "Pattern 2",
|
|
38
|
+
"contexts": ["rag"],
|
|
39
|
+
"reason": "Tenant isolation applies to RAG multi-tenant systems."
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"file": "rag-security",
|
|
43
|
+
"pattern_heading_prefix": "Pattern 3",
|
|
44
|
+
"contexts": ["rag"],
|
|
45
|
+
"reason": "Retrieval validation is RAG-specific."
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"file": "rag-security",
|
|
49
|
+
"pattern_heading_prefix": "Pattern 4",
|
|
50
|
+
"contexts": ["rag"],
|
|
51
|
+
"reason": "Embedding endpoint protection is RAG-specific."
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"file": "rag-security",
|
|
55
|
+
"pattern_heading_prefix": "Pattern 5",
|
|
56
|
+
"contexts": ["rag"],
|
|
57
|
+
"reason": "Permission inheritance on embeddings is RAG-specific."
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"file": "data-integrity",
|
|
61
|
+
"pattern_heading_prefix": "Pattern 2",
|
|
62
|
+
"contexts": ["rag", "batch"],
|
|
63
|
+
"reason": "Pre-embedding validation only applies to systems that ingest into a vector store or training pipeline."
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"file": "data-integrity",
|
|
67
|
+
"pattern_heading_prefix": "Pattern 3",
|
|
68
|
+
"contexts": ["batch"],
|
|
69
|
+
"reason": "Dataset versioning is primarily for fine-tuning / batch training pipelines."
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"file": "data-integrity",
|
|
73
|
+
"pattern_heading_prefix": "Pattern 4",
|
|
74
|
+
"contexts": ["rag", "batch"],
|
|
75
|
+
"reason": "Distribution monitoring applies to systems with embeddings or training datasets."
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"file": "data-integrity",
|
|
79
|
+
"pattern_heading_prefix": "Pattern 5",
|
|
80
|
+
"contexts": ["rag", "batch"],
|
|
81
|
+
"reason": "Batch rollback capability applies to ingestion / training pipelines."
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"file": "rate-limiting",
|
|
85
|
+
"pattern_heading_prefix": "Pattern 1",
|
|
86
|
+
"contexts": ["web"],
|
|
87
|
+
"reason": "Per-user rate limits apply primarily to user-facing APIs."
|
|
88
|
+
}
|
|
89
|
+
]
|
|
90
|
+
}
|