一键导入
aur-audit
Comprehensive guide for auditing and validating Arch Linux packages and PKGBUILDs using automated tools and manual verification.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Comprehensive guide for auditing and validating Arch Linux packages and PKGBUILDs using automated tools and manual verification.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Master skill for AUR (Arch User Repository) package development, serving as a comprehensive guide and dispatcher for creating, auditing, and submitting Arch Linux packages.
Comprehensive guide for using AUR helper tools like yay, paru, pikaur, and aura for automating package management.
Comprehensive guide for building Arch Linux packages using makepkg, covering the build process, configuration, debugging, and optimization.
Comprehensive guide to Arch Linux package guidelines and standards for consistency, quality, and interoperability across the Arch Linux ecosystem.
Comprehensive guide for using pacman, the Arch Linux package manager, covering installation, removal, queries, and troubleshooting.
Comprehensive guide for creating and editing PKGBUILD files - the core build scripts used by makepkg to create Arch Linux packages.
| name | aur-audit |
| description | Comprehensive guide for auditing and validating Arch Linux packages and PKGBUILDs using automated tools and manual verification. |
Comprehensive guide for auditing and validating Arch Linux packages and PKGBUILDs. Covers automated tools (namcap, shellcheck), manual verification, common issues, and security checks to ensure packages meet Arch Linux standards before submission.
This skill should be used when:
pacman -S namcap
# Check PKGBUILD
namcap PKGBUILD
# Check built package
namcap package-1.0.0-1-x86_64.pkg.tar.zst
# Check with info messages
namcap -i PKGBUILD
# Machine-readable output
namcap -m PKGBUILD
| Tag Type | Prefix | Meaning |
|---|---|---|
| Error | E: | Must fix - something is wrong |
| Warning | W: | Should fix - potential issue |
| Info | I: | Optional - helpful hints |
Missing Dependencies
E: Dependency gcc not satisfied
Fix: Add missing package to depends/makedepends
Redundant Dependencies
W: Dependency foo included and not needed
Fix: Remove unnecessary dependency
Permission Issues
E: Package contains world-writable file
E: Unnecessary permission change
Fix: Check file permissions in package()
Missing License
E: Missing custom license file
Fix: Add LICENSE file with license text
Empty Directories
W: Package contains empty directory
Fix: Remove empty dirs or add to options
# 1. Build the package first
makepkg
# 2. Check PKGBUILD
namcap PKGBUILD
# 3. Check built package
namcap *.pkg.tar.zst
# 4. Use info flag for suggestions
namcap -i PKGBUILD *.pkg.tar.zst
pacman -S shellcheck
# Check PKGBUILD
shellcheck --shell=bash PKGBUILD
# Exclude common false positives
shellcheck --shell=bash \
--exclude=SC2034 \
--exclude=SC2154 \
--exclude=SC2164 \
PKGBUILD
| Code | Issue | Example |
|---|---|---|
| SC2034 | Unused variable | epoch= with no use |
| SC2154 | Referenced but not assigned | $srcdir in wrong function |
| SC2164 | cd fails without check | cd "$srcdir" without error check |
# Add to PKGBUILD to ignore specific warnings
# shellcheck disable=SC2034
epoch=
# shellcheck enable=SC2034
# Find library dependencies
ldd /path/to/binary
# Find undefined symbols
readelf -d /path/to/binary | grep NEEDED
# List provided libraries
find "$pkgdir/usr/lib" -name "*.so*"
# Check for script shebangs
grep -r "^#!" "$pkgdir" | head -20
Important: namcap may miss runtime-loaded libraries via dlopen() or obscure links. Always verify manually with ldd and readelf.
# Check for dangerous permissions
find "$pkgdir" -perm -4000 -ls # SUID
find "$pkgdir" -perm -2000 -ls # SGID
find "$pkgdir" -perm -002 -ls # World-writable
# Check for strange ownership
find "$pkgdir" -user root -group root
# Check what's provided
pacman -Q | grep package-name
# Check conflicts
pacman -Si package-name
# NEVER do this - security risk!
source=("http://example.com/file.tar.gz") # HTTP!
# Always use HTTPS
source=("https://example.com/file.tar.gz")
# Verify checksums exist
sha256sums=('abc123...') # Not SKIP or empty
# Use signatures when available
source=('file.tar.gz.asc')
validpgpkeys=('KEYFINGERPRINT')
Watch for:
namcap is powerful but not perfect. Remember:
dlopen()ldd and readelfFor VCS sources (git, svn, hg), checksums must be handled specially:
# VCS sources use SKIP - source changes with each commit
source=("git+https://github.com/user/repo.git?branch=main")
sha256sums=('SKIP')
Always use :: syntax for source URLs with generic filenames:
# Prevents conflicts in shared SRCDEST directory
source=("${pkgname}-${pkgver}.tar.gz::https://example.com/download")
# Clean build
makepkg -cf
# Check build logs for warnings
makepkg 2>&1 | tee build.log
# CRITICAL: Never build as root
# PKGBUILD scripts can contain arbitrary commands
# If only root is available, use:
# runuser -u nobody -- makepkg -s
# List all files
tar -tf package.pkg.tar.zst
# List only binaries
tar -tf package.pkg.tar.zst | grep usr/bin
# List libraries
tar -tf package.pkg.tar.zst | grep usr/lib
# Check for forbidden paths
tar -tf package.pkg.tar.zst | grep -E "^(etc/bin|etc/sbin|var/tmp|tmp)"
Error: E: Dependency not found
Fix: Add to depends/makedepends
Error: W: Redundant dependency
Fix: Remove from depends if in makedepends or base-devel
Error: E: Unnecessary permission change
Fix: Check install commands, use -Dm644 not -m644
Error: E: Missing license
Fix: Add LICENSE file and install in package()
Error: W: Empty directory
Fix: Add '!emptydirs' to options or remove directories
Before submitting to AUR, run these checks:
# 1. Build package
makepkg -s
# 2. Check PKGBUILD with namcap
namcap PKGBUILD
# 3. Check package with namcap
namcap *.pkg.tar.zst
# 4. Run shellcheck
shellcheck --shell=bash PKGBUILD
# 5. Verify file list
tar -tf *.pkg.tar.zst | head -30
# 6. Check for forbidden paths
tar -tf *.pkg.tar.zst | grep -E "^(etc/bin|var/tmp)"
# 7. Verify LICENSE exists
ls LICENSE
# 8. Check .SRCINFO is generated
cat .SRCINFO
| Command | Purpose |
|---|---|
namcap PKGBUILD | Check PKGBUILD issues |
namcap *.pkg.tar.zst | Check package issues |
namcap -i PKGBUILD | Info-level checks |
shellcheck --shell=bash PKGBUILD | Bash syntax check |
makepkg -g >> PKGBUILD | Generate checksums |
updpkgsums PKGBUILD | Update checksums |
makepkg --printsrcinfo > .SRCINFO | Generate .SRCINFO |
- name: Validate PKGBUILD
run: |
namcap PKGBUILD || true
shellcheck --shell=bash --exclude=SC2034,SC2154,SC2164 PKGBUILD || true
#!/bin/bash
set -e
echo "Validating PKGBUILD..."
namcap PKGBUILD
shellcheck --shell=bash --exclude=SC2034,SC2154,SC2164 PKGBUILD
echo "Building package..."
makepkg -s
echo "Checking package..."
namcap *.pkg.tar.zst
echo "All checks passed!"
Before submitting to the AUR, verify these rules:
pacman -Ss package-name| Suffix | Use Case |
|---|---|
-git, -svn, -hg | Development versions (trunk/latest) not tied to specific release |
-bin | Prebuilt binaries when source is available (except Java) |
| None | Stable releases with specific version |
conflicts and provides for alternate versions instead