Skip to main content

AION

PyPI version CI Coverage Docs AION Auto-Update

Scan Python repos. Open verified security fixes. Nothing you didn't ask for.

AION scans a Python repository for a focused set of high-confidence security issues, generates a deterministic patch for each one, verifies the patch in isolation (syntax + an AST assertion that the fix actually holds + an optional Semgrep re-scan), and opens a pull request only for fixes that pass. If a fix can't be proven safe, AION reports it for human review instead of touching your code.

It is intentionally small. The goal is a tool you can trust to run unattended on your repository, not a platform you have to operate.

What it actually does

  • Context-aware scanning — profiles the repository (ORM, HTTP client, auth decorators, DB patterns) so findings are grounded in how your code is written, with optional LLM explanation.
  • Deterministic, verified auto-fixes for these issue types:
    Issue Fix
    hardcoded_secret move the literal to os.getenv(...)
    raw_sqlite_query parameterize the cursor.execute call
    insecure_yaml_load yaml.load → yaml.safe_load
    command_injection wrap os.system f-string vars in shlex.quote
    subprocess_shell_injection wrap subprocess(... shell=True) vars in shlex.quote
    eval_injection eval(...) → ast.literal_eval(...)
    weak_cryptography hashlib.md5 → hashlib.sha256
  • Verification gate — every patch must parse, satisfy an AST assertion proving the specific fix is present, and (when Semgrep is installed) survive a re-scan. Anything short of a verified_fix is not turned into a PR.
  • missing_auth_decorator is report-only — a missing auth gate is surfaced for a human, but never auto-injected (auto-injecting an auth decorator cannot know which decorator is correct or whether a route is intentionally public).
  • Drift detection — snapshot a repo's security state and detect regressions over time.

Installation

pip install aion-evolve
# or
uv tool install aion-evolve

For local development:

git clone https://github.com/shenxianpeng/aion.git
cd aion
uv sync --group dev --group docs
uv run aion --help

Quick start

Scan and explain (LLM)

scan uses an LLM provider for explanations. Set at least one key:

export OPENAI_API_KEY=your_key      # or ANTHROPIC_API_KEY / DEEPSEEK_API_KEY /
                                    #    QWEN_API_KEY / GEMINI_API_KEY
aion scan ./path/to/repo --output json

Plan and verify a single deterministic repair (no LLM needed)

aion repair ./path/to/file.py \
  --context-file ./context.json \
  --artifact-path ./artifact.json

aion verify --artifact-path ./artifact.json

Auto-update: scan → verify → open PRs

aion auto-update --target ./ --dry-run   # preview, no PRs
aion auto-update --target ./             # live: opens PRs for verified fixes

GitHub Action

AION ships as a reusable GitHub Action:

# .github/workflows/aion.yml
name: AION Auto-Update
on:
  schedule:
    - cron: '0 9 * * 1'  # Weekly on Monday at 09:00 UTC
  workflow_dispatch:

permissions:
  contents: write
  pull-requests: write

jobs:
  auto-update:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
        with:
          fetch-depth: 0
      - uses: shenxianpeng/aion@main
        with:
          openai_api_key: ${{ secrets.OPENAI_API_KEY }}
          # or: deepseek_api_key / qwen_api_key / anthropic_api_key / gemini_api_key

Configuration

AION reads a flat .aion.yaml (CLI flags override it):

provider: openai
model: gpt-4.1
ignore_paths:
  - tests/*
  - scripts/generated_*.py
auto_repair_issue_types:
  - raw_sqlite_query
  - hardcoded_secret
  - insecure_yaml_load
  - command_injection
auto_repair_min_confidence: 0.90
open_pull_requests_limit: 5
labels:
  - "aion"
  - "security"
reviewers:
  - "team:security"
assignees:
  - "username"
target_branch: "main"
commit_message_prefix: "[AION]"

Supported LLM providers

Provider Env Variable Default Model
Anthropic ANTHROPIC_API_KEY claude-3-5-sonnet-latest
OpenAI OPENAI_API_KEY gpt-4.1
DeepSeek DEEPSEEK_API_KEY deepseek-chat
Qwen (Tongyi) QWEN_API_KEY qwen-plus
Gemini GEMINI_API_KEY gemini-2.0-flash
Azure OpenAI AZURE_OPENAI_API_KEY gpt-4

Command surface

Command Purpose
aion scan Scan a repo and explain findings (LLM)
aion repair Plan a deterministic patch for one file
aion verify Verify a patch artifact (syntax + assertions + Semgrep)
aion auto-update Scan → verify → open PRs for verified fixes
aion snapshot Save a point-in-time security snapshot
aion drift Compare current state against a snapshot
aion watch Continuously watch for drift and auto-repair regressions
aion status Show snapshot and repair-knowledge-base health

Scope (what AION does not do)

  • It produces patch artifacts and pull requests. It does not hot-patch live production code, and it is not a runtime control plane.
  • It is Python-only by design.
  • It fixes a deliberately small set of high-confidence issue types. Breadth is a non-goal; trustworthiness is the goal.

Documentation

Published at shenxianpeng.github.io/aion (中文).

Release files for aion-evolve 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aion-evolve 2.0.0
File Size Uploaded
aion_evolve-2.0.0.tar.gz 263.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for aion-evolve 2.0.0
File Interpreter ABI Platform
aion_evolve-2.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 309.3 kB

Release files / aion_evolve-2.0.0.tar.gz

Download URL aion_evolve-2.0.0.tar.gz
Size 263.2 kB
Tags Source
SHA-256 checksum
How to use checksums
8cce1839d94e28ccec5735f439fffb0a341fb12cf95818f5df7cb39ae515638e
BLAKE2b-256 checksum
How to use checksums
d75fddb9604edf0434cb5ea9c2bb08f123f28a48b1940653cd2bf56241988e94
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 22, 2026.

Transparency log

Release files / aion_evolve-2.0.0-py3-none-any.whl

Download URL aion_evolve-2.0.0-py3-none-any.whl
Size 46.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
711c88f6fb70c83b9cdcc7bebdc3e71938bdeba88c2d892fda2f9bba5c318542
BLAKE2b-256 checksum
How to use checksums
f58cbe2ae8124636beb7b3bdee214cd252ebb9df26e76c3678509900278771d9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 22, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 release files

1.4.0

2 release files

1.3.0

2 release files

1.2.0

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.0

2 release files

0.2.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page