adee5dfc78e919bd2c0cf2c52faad56e4c59ee18
- FastAPI server with scan/build/repo endpoints - LLM scanner (Ollama) with regex pre-scan - makepkg/devtools builder with chroot isolation - Scan cache with TTL + PKGBUILD hash - Client installer + safe-yay wrapper - Docs + config example
AUR-Shield
AI-powered AUR firewall. Scans PKGBUILDs with a local LLM before building, caches approved packages as a local pacman repo.
Problem
The AUR is under active attack (2026 supply-chain incidents, 400+ malicious packages). yay/paru blindly execute PKGBUILDs that can contain curl | bash, reverse shells, typosquatting, obfuscated payloads.
Solution
AUR-Shield sits between your clients and the AUR:
Client (yay/pacman) → AUR-Shield (Server) → AUR
↓
Fetch PKGBUILD + .SRCINFO
↓
LLM scans for malicious patterns
↓
clean → makepkg + repo-add → serve
sketchy → block + warn
Requirements
Server:
- Arch Linux
ollamarunning (any model, even 3B works)base-devel,devtoolsfor building- Python 3.11+ with
uv(or venv) - ~2GB disk for cache
Clients:
- Arch Linux
pacman(repo mode) oryay/paru(wrapper mode)
Quick Start
# On the server:
git clone https://gitea.die-heimatlosen.eu/arch_agent/aur-shield.git
cd aur-shield
./install.sh
# Edit config if needed (model, port, etc.)
cp config.example.yaml config.yaml
nano config.yaml
# Start the service
systemctl --user start aur-shield
# Or directly:
python -m aur_shield
# On the client:
sudo ./install-client.sh
# Then install packages:
safe-yay firefox-nightly
# Or via pacman:
sudo pacman -S aur-shield/firefox-nightly
Configuration
config.yaml:
ollama:
url: http://localhost:11434
model: qwen2.5:latest # smallest model that works well
timeout: 60
server:
host: 0.0.0.0
port: 8443
repo_dir: /var/cache/aur-shield/repo
work_dir: /var/cache/aur-shield/build
security:
block_patterns:
- "curl.*\\|.*bash"
- "wget.*\\/tmp\\/.*\\|.*sh"
- "eval.*base64"
max_pkg_size_mb: 500
allowed_sources:
- "https://"
- "http://"
- "git://"
- "ftp://"
cache:
ttl_hours: 168 # 7 days
How It Works
- Request: Client asks for
aur-shield/<package> - Fetch: Server pulls PKGBUILD + .SRCINFO from AUR API
- Scan: LLM analyzes the PKGBUILD for:
- Suspicious
source=()URLs (npm, tor, raw IPs) - Obfuscated bash (
eval,base64 -d, hex encoding) - Reverse shells,
nc,/dev/tcp post_installhooks creating services/cronjobs- Typosquatting package names
- Unusual
dependsfor the package type
- Suspicious
- Build: If clean,
makepkgbuilds the package - Serve:
repo-addadds it to the local pacman repo - Cache: Approved packages stay cached until upstream update
API
GET /api/scan/<package>— Scan a package without buildingGET /api/build/<package>— Scan + build + add to repoGET /api/status— Server status + cache infoGET /api/report/<package>— Get last scan reportGET /repo/<file>— Pacman repo endpoint (for client pacman.conf)
Models
Tested models (smallest to best):
| Model | Size | VRAM | Quality | Speed |
|---|---|---|---|---|
qwen2.5:latest |
4.7GB | 6GB | ★★★☆☆ | fast |
qwen2.5-coder:3b |
1.9GB | 3GB | ★★☆☆☆ | fastest |
qwen3.5:9b |
6.6GB | 8GB | ★★★★☆ | medium |
Laguna-XS-2.1:Q3_K_M |
16GB | 16GB | ★★★★★ | slow |
Recommended: qwen2.5:latest — good balance of speed and accuracy, fits in 6GB VRAM.
Security Notes
- AUR-Shield is a defense layer, not a guarantee. The LLM can miss things.
- Always review the scan report for high-risk packages.
- The build runs in an isolated
makepkgenvironment (non-root). - For extra isolation, use
devtools(extra-x86_64-build) in a chroot.
License
MIT
Description
Languages
Python
69.1%
Shell
30.9%