An LLM-powered security auditing tool for Arch User Repository (AUR) packages.
aur-sleuth performs in-depth security analysis of an AUR package. It can be run
standalone, and a separate shell wrapper (makepkg-with-sleuthing) integrates it
with makepkg:
# Audit a package from the AUR without building or installing
aur-sleuth package-name
# Audit a package then build and install with yay if it passes the audit
yay --makepkg makepkg-with-sleuthing package-name
# Audit, then build and install a local package (in a directory containing a PKGBUILD)
makepkg-with-sleuthing -siHere it is in action catching the shenanigans from the infamous malicious google-chrome-stable package:
Recently, there have been subtly malicious packages uploaded to the AUR. This tool helps detect such issues by using an LLM to analyze AUR packages for potential security concerns before building.
aur-sleuth performs a security audit of all of the files in the source array in
the PKGBUILD, along with any other files from the actual package sources that the
security auditing LLM deems interesting.
This helps fulfill one of the great promises of open source software: security through the ability to audit the source code of applications you run on your machine. In the past this wasn't really practical since there's just too much code to review. But in a world with readily available LLMs that are fast, cheap, and effective, this promise of enhanced security becomes extremely compelling. As LLMs get even faster and cheaper there will be no reason not to audit every bit of code you run on your machine. This will only be possible in the world of open source!
- This tool is meant to assist in security auditing, not replace good judgment
- Always review code before installing packages from AUR
- The LLM analysis is not foolproof and may produce false positives or negatives
- Keep your API keys secure and monitor usage
(AUR package coming soon...)
-
Install dependencies:
sudo pacman -S uv
-
Clone this repository:
git clone https://github.com/mgalgs/aur-sleuth.git cd aur-sleuth -
Install the script.
System-wide installation (requires sudo):
sudo make install
This will install
aur-sleuthand the shell wrappermakepkg-with-sleuthingto/usr/local/bin.User-local installation (no sudo required):
make install PREFIX=$HOME/.localThis will install the scripts to
$HOME/.local/bin. Make sure this directory is in yourPATH.
Alternatively you can simply download aur-sleuth, and makepkg-with-sleuthing drop them in your PATH.
The tool can be configured with environment variables:
OPENAI_API_KEY: Your API key. This is required.OPENAI_BASE_URL: The API endpoint. Defaults to OpenRouter if not set.OPENAI_MODEL: The model to use. Defaults toqwen/qwen3-235b-a22b-2507.MAX_LLM_JOBS: Max concurrent LLM calls. Defaults to3.NUM_FILES_TO_REVIEW: The number of files to review in addition to those listed in thesourcearray. Defaults to10.LLM_TEMPERATURE: The temperature parameter for the LLM (0.0-2.0). If not set, uses model default.LLM_TOP_P: The top-p parameter for the LLM (0.0-1.0). If not set, uses model default.AUDIT_FAILURE_FATAL: Whether audit failures should be fatal (exit with error). Set tofalseto make audit failures non-fatal. Defaults totrue.
You can either set these environment variables directly in your shell, or add them to
a configuration file. The tool will automatically load configuration from
/etc/aur-sleuth.conf (system-wide) or ~/.config/aur-sleuth.conf (user-specific),
with user-specific configuration taking precedence.
The configuration file should be in INI format:
[default]
OPENAI_API_KEY = your-api-key
OPENAI_BASE_URL = your-base-url
OPENAI_MODEL = your-model
MAX_LLM_JOBS = desired-concurrency
LLM_TEMPERATURE = 0.7 # Omit to use the model default
LLM_TOP_P = 0.9 # ditto
AUDIT_FAILURE_FATAL = false # Set to false to make audit failures non-fatal[default]
OPENAI_API_KEY = sk-or-v1-7f8...194
OPENAI_BASE_URL = https://openrouter.ai/api/v1
OPENAI_MODEL = qwen/qwen3-30b-a3b-instruct-2507
MAX_LLM_JOBS = 10[default]
OPENAI_API_KEY = sk-proj-EW...KA
OPENAI_BASE_URL = https://api.openai.com/v1
OPENAI_MODEL = gpt-5-mini
MAX_LLM_JOBS = 5[default]
OPENAI_API_KEY = ollama
OPENAI_BASE_URL = http://localhost:11434/v1
OPENAI_MODEL = llama3.1:8b
MAX_LLM_JOBS = 1
AUDIT_FAILURE_FATAL = falsePerforms an agentic security audit on the package contents. It does not build the package.
Usage:
usage: aur-sleuth [-h] package_name [--clone-url CLONE_URL] [--output OUTPUT] [--model MODEL] [--base-url BASE_URL] [--max-llm-jobs MAX_LLM_JOBS] [--num-files-to-review NUM_FILES_TO_REVIEW]
Run a security audit on an AUR package.
positional arguments:
package_name Name of the AUR package.
options:
-h, --help show this help message and exit
--clone-url CLONE_URL
Optional custom clone URL for the AUR package. Defaults to https://aur.archlinux.org/{package_name}.git.
--output OUTPUT Output format. Supported formats: rich, plain. Defaults to rich.
--model MODEL LLM to use (overrides environment and config file settings)
--base-url BASE_URL Base API URL (OpenAI API compatible) to use (overrides environment and config file settings)
--max-llm-jobs MAX_LLM_JOBS, -j MAX_LLM_JOBS
Maximum number of concurrent LLM audit jobs (default: 3)
--num-files-to-review NUM_FILES_TO_REVIEW, -n NUM_FILES_TO_REVIEW
Target number of files to audit jobs (default: 10)The audit process is subject to a session token limit (default: 100,000 tokens) to manage API usage.
Examples:
-
Audit a package by name (clone from AUR):
aur-sleuth google-chrome-stable
-
Audit an existing local pkgdir:
aur-sleuth --pkgdir /path/to/pkgdir
-
Audit with custom clone URL:
aur-sleuth --clone-url https://example.com/repo.git package-name
-
Use plain text output:
aur-sleuth --output plain package-name
After the audit completes, if it is deemed safe, the tool will print the
path to the temporary directory when cloning, or it will leave your existing
--pkgdir untouched. You can then inspect the files and, if you choose to
proceed, run makepkg manually from within that directory.
This mode is for integrating the audit into your existing makepkg
workflow, for example with a AUR helper like yay.
With yay:
Audit a package, then install if it passes:
yay --makepkg makepkg-with-sleuthing package-nameYou can persist the --makepkg setting like so:
yay --makepkg makepkg-with-sleuthing --saveThen you no longer have to pass --makepkg to each invocation of yay. Just use it
as you normally would and the audit will be performed automatically:
yay -S package-nameDirect Usage:
You can also invoke the wrapper directly in place of makepkg. Just pass makepkg
arguments to it:
# In a directory with a PKGBUILD
makepkg-with-sleuthing -siThe wrapper will automatically skip the audit for certain makepkg operations like
--verifysource, --nobuild, --geninteg, -o, and -g.
aur-sleuthis a Python script that audits a package either by cloning from AUR by name, or by auditing an existing directory with--pkgdir /path/to/pkgdir.makepkg-with-sleuthingis a small shell script that first runsaur-sleuth --pkgdir .to audit the current PKGBUILD and sources, and then execs/usr/bin/makepkgif the audit passes.
Any OpenAI-compatible API server
Contributions are welcome! Please feel free to submit issues or pull requests.
MIT
