Catalog PyPI
Back to packageRELEASE DETAILS

4.6.0

PyPI

acrqa

AI-powered code review with RAG-grounded explanations, 10 static analysers, and ECDSA-signed provenance

aicode-reviewragsastsecuritystatic-analysis
Published17 May 2026
Direct dependencies21
Transitive dependenciesNot calculated

README

Version 4.6.0 documentation

🛡️ ACR-QA

Automated Code Review & Quality Assurance Platform

10 static analysis tools. One canonical schema. RAG-enhanced AI explanations. $0 recurring cost.

Python 3.11+ Version Live Tests Coverage Precision OWASP Languages FastAPI License: MIT CI Tests WCAG 2.1 AA i18n Helm Terraform OpenTelemetry Signed SLSA Uptime


What It Is

ACR-QA is a provenance-first, AI-augmented code review platform built as a graduation thesis at KSIU. It solves three real problems that frustrate every developer using static analysis tools:

ProblemWhat ACR-QA does
Alert fatigue — 7 tools dump raw JSON in incompatible schemas, full of duplicatesNormalises all output into one canonical schema, deduplicates cross-tool, ranks by severity
LLM hallucination — AI assistants give confident but wrong security adviceRAG: the LLM can only explain rules it can cite from a curated 66-rule knowledge base; semantic entropy (3× runs) detects contradictions
Invisible test gaps — code coverage % doesn't tell you which complex functions have no testAST-based Test Gap Analyzer ranks untested symbols by cyclomatic complexity

Key numbers: 97.1% precision · 9/10 OWASP Top 10 · 2,339 tests (2,274 Python + 65 TypeScript) · 36 async API endpoints · $0 recurring cost


Architecture

C4Container
    title ACR-QA — System Overview

    Person(dev, "Developer")

    Container_Boundary(sys, "ACR-QA") {
        Container(cli, "CLI / GitHub Action", "Python", "Entry point. Detects language, routes to adapter.")
        Container(core, "Analysis Engine", "Python 3.11", "10 tools → normalise → score → dedup → AI explain → quality gate")
        Container(api, "Async REST API", "FastAPI :8000", "36 /v1/ endpoints · JWT + API key auth · Swagger at /docs")
        Container(worker, "Background Worker", "Celery + Redis", "Async scan execution — POST /v1/scans returns 202 + job_id")
        ContainerDb(pg, "PostgreSQL 15", "", "Provenance: runs · findings · LLM calls · feedback · users · api_keys")
        ContainerDb(redis, "Redis 5.2", "", "Rate limiting · explanation cache · Celery broker + result backend")
    }

    Container_Ext(groq, "Groq API", "LLM", "Llama 3.3-70b explanations · Llama 3.1-8b feasibility · free tier")
    Container_Ext(gh, "GitHub / GitLab", "CI", "PR comments · SARIF upload · merge blocking")

    Rel(dev, cli, "runs analysis")
    Rel(cli, core, "invokes pipeline")
    Rel(core, pg, "stores provenance")
    Rel(core, redis, "rate limit / cache")
    Rel(core, groq, "RAG explanations")
    Rel(core, gh, "PR comments + SARIF")

Full C4 diagrams: C1 Context · C2 Containers · C3 Components · C4 Code


Quick Start

Option A — Docker (one command)

git clone https://github.com/ahmed-145/acr-qa.git && cd acr-qa
cp .env.example .env          # add your GROQ_API_KEY_1..4
make up
ServiceURL
FastAPIhttp://localhost:8000
Grafanahttp://localhost:3005 (admin/admin)
Prometheushttp://localhost:9091

Option B — Local

pip install -r requirements.txt
createdb acrqa && psql -d acrqa -f DATABASE/schema.sql
cp .env.example .env && source .env
uvicorn FRONTEND.api.main:app --port 8000    # → http://localhost:8000/docs

Run your first analysis

# Python project
python3 CORE/main.py --target-dir ./myproject --rich

# JavaScript / TypeScript project
python3 CORE/main.py --target-dir ./my-express-app --lang javascript --no-ai

# Go project
python3 CORE/main.py --target-dir ./my-go-api --lang go

# JSON output for CI pipelines
python3 CORE/main.py --target-dir . --json --no-ai > findings.json

What Makes It Different

FeatureCodeRabbitSonarQubeACR-QA
Multi-tool normalisation✅✅✅ 10 tools
AI explanations✅✅✅ RAG + entropy
Hallucination detection❌❌✅ semantic entropy (3×)
Test gap analysis❌❌✅ AST-based
Confidence per finding❌❌✅ 0–100 score
Feedback-driven tuning❌❌✅ auto suppression
Cost-benefit analysis❌❌✅ ROI per finding
Call-graph reachability❌❌✅ AST-based, 0% FP rate
Path feasibility (FP reduction)❌❌✅ LLM4PFA approach
Cross-language vuln chains❌❌✅ CHARON-inspired
CBoM (quantum-safety)❌❌✅ NIST FIPS 203/204
Quality gates (CI blocking)✅✅✅ configurable
SARIF export✅✅✅ v2.1.0
OWASP compliance report✅✅✅ 9/10 + CWE IDs
Recurring cost$$$$$$$0

Features

Detection Pipeline

10 tools run in parallel, all output normalised into one CanonicalFinding schema:

ToolLanguageWhat It Catches
RuffPythonStyle, imports, unused code, PEP8
BanditPythonSecurity anti-patterns (33 rules)
SemgrepPython / JS / GoOWASP Top 10 patterns, custom rules
VulturePythonDead code, unreachable branches
RadonPythonCyclomatic complexity, maintainability
Secrets DetectorAllAPI keys, passwords, JWTs, tokens
SCA ScannerPythonKnown-vulnerable dependency versions
ESLintJS / TSSecurity plugin — 20 rules
gosecGoGo security vulnerabilities
staticcheckGoGo static analysis and bug detection

AI Explanation (RAG-Enhanced)

  • 66-rule knowledge base (config/rules.yml) — every rule has description, rationale, remediation, and code examples
  • Evidence-grounded prompts — the LLM is given the rule text; it cannot invent advice for rules it can't cite
  • Semantic entropy — 3× LLM runs with varying temperature; contradictions lower the confidence score
  • Self-evaluation — LLM rates its own output 1–5 on relevance/accuracy/clarity
  • Path feasibility (Feature 7) — second AI call validates whether a HIGH finding's code path is actually reachable in production (LLM4PFA approach)

Quality Gate

# .acrqa.yml
quality_gate:
  mode: block         # block = fail CI + prevent merge | warn = comment only
  max_high: 0         # zero tolerance for HIGH severity
  max_medium: 5
  max_security: 0

Fails CI with exit code 1. GitHub Action posts severity table as PR comment.

Per-Repo Policy (.acrqa.yml)

rules:
  disabled_rules: [IMPORT-001, STYLE-007]
  severity_overrides: {COMPLEXITY-001: low}

analysis:
  ignore_paths: [.venv, migrations/, node_modules]

ai:
  max_explanations: 50
  model: llama-3.1-8b-instant

Inline Suppression

result = eval(user_input)      # acr-qa:ignore
password = "secret123"         # acrqa:disable SECURITY-005

FastAPI Dashboard (http://localhost:8000/docs)

  • Severity counters with live counts
  • Finding cards with collapsible AI explanations + 🎯 confidence badge
  • Cost-benefit widget: analysis cost, hours saved, ROI ratio
  • Trend charts across last 30 runs
  • False-positive feedback (👍/👎) — feeds triage memory for future suppression
  • Filters by severity, category, rule ID, full-text search
  • Export: SARIF, provenance trace, Markdown reports

CLI Reference

python3 CORE/main.py [options]

  --target-dir DIR     Directory to analyse (default: samples/realistic-issues)
  --repo-name NAME     Repository name for provenance tracking
  --pr-number N        PR number (enables GitHub PR comment posting)
  --limit N            Max findings to AI-explain (default: 50)
  --diff-only          Analyse only files changed in git diff
  --diff-base BRANCH   Base branch for diff (default: main)
  --auto-fix           Generate auto-fix suggestions for fixable rules
  --rich               Rich terminal output with colour-coded tables
  --lang LANG          auto (default) | python | javascript | typescript | go
  --no-ai              Skip AI explanation step (faster, no API key needed)
  --json               Output findings as JSON to stdout (pipe-friendly)
  --version            Print version and exit

Language Support

Python (v1.0+)

Ruff · Bandit · Semgrep · Vulture · Radon · Secrets · SCA · CBoM

JavaScript / TypeScript (v3.0.1+)

python3 CORE/main.py --target-dir ./my-react-app          # auto-detect
python3 CORE/main.py --target-dir ./my-express-api --lang javascript

ESLint (security plugin) · Semgrep JS rules · npm audit 56 rule mappings · 15 HIGH-severity security rules covered

Go (v3.2.0+)

python3 CORE/main.py --target-dir ./my-go-api --lang go

Prerequisites: go install github.com/securego/gosec/v2/cmd/gosec@latest && go install honnef.co/go/tools/cmd/staticcheck@latest

gosec · staticcheck · Semgrep Go rules · 45+ rule mappings


CI/CD Integration

GitHub Actions

# .github/workflows/acr-qa.yml (already in repo)
# Triggers on every PR:
# 1. Runs all 10 tools on changed files (--diff-only)
# 2. Normalises, scores, generates AI explanations
# 3. Posts severity-sorted PR comment with code suggestions
# 4. Uploads findings.sarif to GitHub Security Tab
# 5. Fails merge if quality gate violated (exit code 1)

Required secrets: GROQ_API_KEY_1..4 · GITHUB_TOKEN (auto-provided)

Manual trigger on PR

Comment on any PR:

acr-qa review

GitLab CI

.gitlab-ci.yml included. Set GROQ_API_KEY_1 and GITLAB_TOKEN in CI/CD Variables.


Monitoring

Prometheus scrapes /metrics every 15 s. Grafana dashboard at http://localhost:3005 (admin/admin):

PanelMetric
Request Raterate(acrqa_http_requests_total[5m])
P95 Latencyhistogram_quantile(0.95, ...)
HTTP Success Rate2xx / total * 100
LLM Latencyavg(explain endpoint duration)
Error Raterate(5xx[1m])

Testing

make test-all          # 2,339 tests (full suite)
make test              # acceptance tests only
make run               # pipeline on sample files
Test FileTestsCoverage
test_acceptance.py4Pipeline E2E with mocked LLM
test_api.py9FastAPI endpoints
test_normalizer.py7Ruff / Bandit / Semgrep normalisation
test_new_engines.py117Secrets, SCA, CBoM, autofix, quality gate, KeyPool
test_deep_coverage.py10012-module deep coverage
test_god_mode.py96All features + regression + edge cases
test_js_adapter.py63JS/TS adapter, E2E pipeline, CLI routing
test_reachability.py74Call-graph engine, fixtures, enrich_findings
test_taint_analyzer.py65+Inter-procedural taint, sanitizer recognition
test_supply_chain.py62Lockfile parsers, OSV CVE, risk scoring, SBOM
test_attestation.py60AttestationEngine, ECDSA-P256, Dilithium3 PQ
test_exploit_verifier.py59Docker sandbox, 3-tier verdict
test_fastapi_app.py32FastAPI TestClient — all v1 endpoints
test_chaos.py13Postgres/Redis failure injection
test_week1_completion.py42Fuzz/snapshot/perf-gate/mutation-killing
(+ 31 more files)1,536Additional coverage
TypeScript (Vitest)65Button, Badge, Card, ScanCard, FindingsTable…

Thesis Evaluation

Research Questions

RQImplementationMetric
RQ1 Can RAG reduce LLM hallucination?66-rule KB + evidence-grounded prompts + entropyconsistency_score (0–1)
RQ2 How to ensure provenance?Full PostgreSQL audit trail per LLM callllm_explanations table
RQ3 What confidence scoring works?score = severity × category × tool × rule × fix_validatedconfidence_score (0–100)
RQ4 Does it match industry tools?10-tool pipeline vs CodeRabbit / SonarQubeFeature parity table above

Benchmark Results (4 repositories)

RepositoryFindingsPrecisionSecurity PrecisionRecall
DVPWA4481.8%100%50%
Pygoat44096.4%100%100%
VulPy293100%100%100%
DSVW59100%100%100%
Overall83697.1%100%—

DVPWA recall 50%: 3 of 6 known vulns detected; CSRF (runtime-only), hardcoded debug mode, and one abstracted cred require DAST — documented limitation, not a bug.


Architecture Decision Records

Key design decisions are documented in docs/adr/:

ADRDecision
0001Scope: self-hosted thesis tool, not SaaS
0002LanguageAdapter pattern for multi-language support
0003RAG + semantic entropy over generic LLM prompts
0004Groq free tier with 4-key rotation pool
0005PostgreSQL for provenance storage

Technology Stack

LayerTechnology
LanguagePython 3.11+
Web FrameworkFastAPI 0.115 (async)
FrontendReact 18 + TypeScript + Vite 5 + shadcn/ui
DatabasePostgreSQL 15
Cache / Rate LimitingRedis 7
AI ModelGroq Llama 3.3-70b (explanations) · Llama 3.1-8b (feasibility)
Static AnalysisRuff, Semgrep, Bandit, Vulture, Radon, gosec, staticcheck, ESLint
Terminal UIRich
Schema ValidationPydantic v2
ContainerisationDocker + Docker Compose
MonitoringPrometheus + Grafana
CI/CDGitHub Actions + GitLab CI
Export FormatsSARIF v2.1.0, Markdown, JSON

Interactive Demo Notebooks

Run these Marimo notebooks locally or view the exported HTML:

NotebookDescriptionHTML Preview
notebooks/walkthrough.py12-cell full pipeline walkthroughwalkthrough.html
notebooks/engine_demos/taint.pyTaint analyzer — source→sink data-flowdemo_taint.html
notebooks/engine_demos/exploit.pyExploit verifier — DAST-in-Dockerdemo_exploit.html
notebooks/engine_demos/attestation.pyAttestation + post-quantum hybrid signaturesdemo_attestation.html
notebooks/engine_demos/offline.pyZero-egress / Ollama mode proofdemo_offline.html
# Run interactively (edit cells live)
pip install marimo
marimo run notebooks/walkthrough.py

# Or open in edit mode for defense demo
marimo edit notebooks/walkthrough.py

Documentation

DocumentDescription
C1–C4 ArchitectureFull C4 model: context, containers, components, code flow
ADRsArchitecture decision records — why each major choice was made
API ReferenceAll 32 REST endpoints
Policy Engine.acrqa.yml full reference
Evaluation ReportPrecision/recall, OWASP coverage, competitive analysis
Per-Tool EvaluationPer-engine accuracy across benchmark repos
User Study Protocol20-minute structured study protocol
Cloud DeploymentAWS / GCP / Railway deployment guide
ChangelogFull version history
ContributingDevelopment setup and contribution guide

Academic Context

StudentAhmed Mahmoud Abbas
SupervisorDr. Samy AbdelNabi
InstitutionKing Salman International University (KSIU)
TimelineOctober 2025 – June 2026
Statusv4.6.0 · Distribution release · Evaluation complete · Cloud-deployed · 39/39 tasks done

Remaining Thesis Work


License

MIT — see LICENSE


Built with ❤️ at King Salman International University · ⭐ Star this repo

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 21

Native requirements
21 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
fastapi
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.11",
  "evaluation": "NOT_EVALUATED"
}
fastapi>=0.115.0runtime
uvicorn
Environment
{
  "extras": "standard",
  "marker": null,
  "requires_python": ">=3.11",
  "evaluation": "NOT_EVALUATED"
}
uvicorn[standard]>=0.30.6runtime
pydantic
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.11",
  "evaluation": "NOT_EVALUATED"
}
pydantic>=2.12.5runtime
pydantic-settings
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.11",
  "evaluation": "NOT_EVALUATED"
}
pydantic-settings>=2.3.4runtime
groq
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.11",
  "evaluation": "NOT_EVALUATED"
}
groq>=1.2.0runtime
httpx
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.11",
  "evaluation": "NOT_EVALUATED"
}
httpx>=0.28.1runtime
PyYAML
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.11",
  "evaluation": "NOT_EVALUATED"
}
PyYAML>=6.0.1runtime
python-dotenv
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.11",
  "evaluation": "NOT_EVALUATED"
}
python-dotenv>=1.0.0runtime
passlib
Environment
{
  "extras": "bcrypt",
  "marker": null,
  "requires_python": ">=3.11",
  "evaluation": "NOT_EVALUATED"
}
passlib[bcrypt]>=1.7.4runtime
python-jose
Environment
{
  "extras": "cryptography",
  "marker": null,
  "requires_python": ">=3.11",
  "evaluation": "NOT_EVALUATED"
}
python-jose[cryptography]>=3.3.0runtime
psycopg2-binary
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.11",
  "evaluation": "NOT_EVALUATED"
}
psycopg2-binary>=2.9.9runtime
redis
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.11",
  "evaluation": "NOT_EVALUATED"
}
redis>=5.2.1runtime
celery
Environment
{
  "extras": "redis",
  "marker": null,
  "requires_python": ">=3.11",
  "evaluation": "NOT_EVALUATED"
}
celery[redis]>=5.4.0runtime
alembic
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.11",
  "evaluation": "NOT_EVALUATED"
}
alembic>=1.13.1runtime
rich
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.11",
  "evaluation": "NOT_EVALUATED"
}
rich>=13.7.0runtime
click
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.11",
  "evaluation": "NOT_EVALUATED"
}
click>=8.1.7runtime
sentence-transformers
Environment
{
  "extras": "",
  "marker": "extra == \"ai\"",
  "requires_python": ">=3.11",
  "evaluation": "NOT_EVALUATED"
}
sentence-transformers>=2.7.0; extra == "ai"runtime
torch
Environment
{
  "extras": "",
  "marker": "extra == \"ai\"",
  "requires_python": ">=3.11",
  "evaluation": "NOT_EVALUATED"
}
torch>=2.2.0; extra == "ai"runtime
pytest
Environment
{
  "extras": "",
  "marker": "extra == \"dev\"",
  "requires_python": ">=3.11",
  "evaluation": "NOT_EVALUATED"
}
pytest>=8.2.0; extra == "dev"runtime
ruff
Environment
{
  "extras": "",
  "marker": "extra == \"dev\"",
  "requires_python": ">=3.11",
  "evaluation": "NOT_EVALUATED"
}
ruff>=0.6.0; extra == "dev"runtime
mypy
Environment
{
  "extras": "",
  "marker": "extra == \"dev\"",
  "requires_python": ">=3.11",
  "evaluation": "NOT_EVALUATED"
}
mypy>=1.10.0; extra == "dev"runtime

Distribution files

2 collected
acrqa-4.6.0-py3-none-any.whl

bdist_wheel · 173.94 KB · Python py3

Source file
acrqa-4.6.0.tar.gz

sdist · 214.05 KB · Python source

Source file

Repository

PENDING
ahmed-145/acr-qa

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 18:26 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:a42dea79e40f89031ba457dedffc9e8544372b44156abdfd95ae7bd7de27a793

Other collected versions

View all collected versions →