AI DevSecOps is a Python 3.12+ research project: a five-layer "security mesh" that scans Python code for OWASP LLM Top 10 style weaknesses, with an optional LLM-assisted auditor. It is not a hardened product and has not been independently audited.
Only the master branch is supported. There are no tagged releases with security fixes.
- Non-sensitive bugs (false positives, false negatives, crashes): open a GitHub issue.
- Sensitive reports (anything that would let a scanned file compromise the scanner or the machine running it): contact the maintainer directly via https://github.com/mwill20 rather than filing a public issue.
Please include the input that triggers the behavior and the command you ran.
What the five layers are, and how much to trust each one (from README.md and
ARCHITECTURE.md):
| Layer | Mechanism | Deterministic? |
|---|---|---|
| 1 Deterministic | Compiled regex (hardcoded secrets, eval, os.system, shell=True, pickle.load, SQL patterns) |
Yes |
| 2 Semantic | Python ast taint analysis (sources such as input() / os.environ flowing to sinks such as print / logging / subprocess) |
Yes |
| 3 Operational | ShellGuard using shlex and an allow list (src/security_py/policies/allow_list.json) |
Yes |
| 4 AI Auditor | DeepSeek-R1 via Ollama, output constrained by Pydantic schemas | No (LLM) |
| 5 Persistence | SQLite SOC Ledger with hash-linked provenance records | Yes |
Design points relevant to security:
- Layers 1 to 3 and 5 are rule-based and can be reasoned about and tested offline.
Layer 4 is off by default (
ValidatorConfig.enable_ai_auditor = False) and is skipped when Ollama is unreachable. LLM output is treated as advisory and schema-validated; it should not be the sole basis for an allow decision. - The scanner reads untrusted source files. It parses them with
astand regex; it does not execute scanned code. - Scan results and provenance are stored in a local SQLite file. The provenance chain is a hash chain for tamper evidence, not a signature scheme; it does not prove who approved a record.
- Scripts such as
scripts/model_verify.pycheck the local AI model supply chain; they rely on the local Ollama install being trustworthy.
- Pattern and taint detection cover the documented cases in
tests/adversarial_suite.pyandtests/test_logic_bomb_detection.py; anything outside those cases may be missed. - Five advanced patterns (washed secrets, hidden-state triggers, insecure auth decorators, time-delayed exfiltration) are documented as requiring Layer 4 LLM reasoning and are not detected by the deterministic layers alone. CI runs the offline subset only.
tests/test_vulnerability.pyis an intentionally vulnerable sample for the lessons, not a test module. The mock secrets in it are not real credentials.- No detection-rate or accuracy figures are claimed anywhere in this repository.