Skip to content

LeoYeAI/agent-master-skills / skills/agentaudit-skill

agentaudit-skill

Flagged

Automatic security gate that checks packages against a vulnerability database before installation. Use before any npm install, pip install, yarn add, or package manager operation.

FileKindSize
README.mdmarkdown33.7 KB
SKILL.mdskill md18.0 KB
_meta.jsonconfig297 B
install.shscript5.7 KB
prompts/audit-prompt.mdmarkdown36.6 KB
prompts/review-prompt.mdmarkdown2.8 KB
references/API-REFERENCE.mdmarkdown4.1 KB
references/AUDIT-METHODOLOGY.mdmarkdown6.8 KB
references/DETECTION-PATTERNS.mdmarkdown5.9 KB
references/REPORT-FORMAT.mdmarkdown5.0 KB
references/TROUBLESHOOTING.mdmarkdown4.4 KB
references/TRUST-SCORING.mdmarkdown2.2 KB
scripts/_curl-retry.shscript850 B
scripts/_load-key.shscript1.6 KB
scripts/check.mjsscript6.3 KB
scripts/check.shscript5.7 KB
scripts/gate.mjsscript5.2 KB
scripts/gate.shscript4.9 KB
scripts/register.mjsscript4.7 KB
scripts/register.shscript3.4 KB
scripts/rotate-key.shscript2.3 KB
scripts/upload.mjsscript7.3 KB
scripts/upload.shscript8.4 KB
scripts/verify.shscript3.6 KB

scripts/verify.sh

View on GitHub
#!/usr/bin/env bash
# verify.sh β€” Verify local skill files against the AgentAudit
# Usage: ./scripts/verify.sh <package-name>
# Dependencies: curl, jq, sha256sum (or shasum on macOS)
set -euo pipefail

PACKAGE="${1:?Usage: verify.sh <package-name>}"
API_URL="https://www.agentaudit.dev/api/integrity"
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
ROOT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"

# Load retry helper
source "$SCRIPT_DIR/_curl-retry.sh"

# Detect sha256 command
if command -v sha256sum &>/dev/null; then
  SHA_CMD="sha256sum"
elif command -v shasum &>/dev/null; then
  SHA_CMD="shasum -a 256"
else
  echo "❌ No sha256sum or shasum found"; exit 1
fi

# URL-encode the package name to prevent injection
ENCODED_PACKAGE=$(printf '%s' "$PACKAGE" | jq -sRr @uri)

echo "πŸ” Fetching official hashes from registry..."
HTTP_RESPONSE=$(curl_retry -sL --max-time 15 -w "\n%{http_code}" "${API_URL}?package=${ENCODED_PACKAGE}")
HTTP_CODE=$(echo "$HTTP_RESPONSE" | tail -1)
RESPONSE=$(echo "$HTTP_RESPONSE" | sed '$d')

if [ "$HTTP_CODE" -lt 200 ] || [ "$HTTP_CODE" -ge 300 ]; then
  echo "❌ API request failed (HTTP ${HTTP_CODE})" >&2
  [ -n "$RESPONSE" ] && echo "   Response: $RESPONSE" >&2
  exit 1
fi

# Parse file list dynamically from API response (POSIX-compatible, no mapfile)
FILES=()
while IFS= read -r f; do
  FILES+=("$f")
done < <(echo "$RESPONSE" | jq -r '.files | keys[]')

if [ ${#FILES[@]} -eq 0 ]; then
  echo "❌ No files returned from registry for package '${PACKAGE}'" >&2
  exit 1
fi

MISMATCH=0
CHECKED=0

echo ""
echo "Package: ${PACKAGE}"
echo "Repo:    $(echo "$RESPONSE" | jq -r '.repo')"
echo "Commit:  $(echo "$RESPONSE" | jq -r '.commit' | head -c 12)"
echo "Verified: $(echo "$RESPONSE" | jq -r '.verified_at')"
echo ""

for file in "${FILES[@]}"; do
  # Sanitize: reject path traversal and absolute paths from API
  if [[ "$file" == /* ]] || [[ "$file" == *..* ]] || [[ "$file" == *$'\n'* ]] || [[ "$file" == *$'\0'* ]]; then
    echo "⚠️  ${file} β€” REJECTED (path traversal or absolute path)" >&2
    continue
  fi
  LOCAL_PATH="${ROOT_DIR}/${file}"
  # Resolve symlinks and verify path stays within ROOT_DIR
  REAL_PATH=$(realpath -m "$LOCAL_PATH" 2>/dev/null || echo "$LOCAL_PATH")
  if [[ "$REAL_PATH" != "${ROOT_DIR}"/* ]]; then
    echo "⚠️  ${file} β€” REJECTED (resolves outside project root)" >&2
    continue
  fi
  REMOTE_HASH=$(echo "$RESPONSE" | jq -r --arg f "$file" '.files[$f].sha256 // empty')

  if [ -z "$REMOTE_HASH" ] || [ "$REMOTE_HASH" = "null" ]; then
    echo "⚠️  ${file} β€” not tracked by registry"
    continue
  fi

  if [ ! -f "$LOCAL_PATH" ]; then
    echo "❌ ${file} β€” missing locally"
    MISMATCH=1
    continue
  fi

  LOCAL_HASH=$($SHA_CMD "$LOCAL_PATH" | awk '{print $1}')
  CHECKED=$((CHECKED + 1))

  if [ "$LOCAL_HASH" = "$REMOTE_HASH" ]; then
    echo "βœ… ${file}"
  else
    echo "❌ ${file} β€” HASH MISMATCH"
    echo "   local:  ${LOCAL_HASH}"
    echo "   remote: ${REMOTE_HASH}"
    MISMATCH=1
  fi
done

echo ""
echo "Checked: ${CHECKED} files"

# Check credentials.json permissions (both locations)
for cred_path in "${ROOT_DIR}/config/credentials.json" "${XDG_CONFIG_HOME:-$HOME/.config}/agentaudit/credentials.json"; do
  if [ -f "$cred_path" ]; then
    PERMS=$(stat -c '%a' "$cred_path" 2>/dev/null || stat -f '%Lp' "$cred_path" 2>/dev/null)
    if [ "$PERMS" != "600" ]; then
      echo "⚠️  $cred_path has permissions ${PERMS}, fixing to 600"
      chmod 600 "$cred_path"
    fi
  fi
done

if [ "$MISMATCH" -eq 0 ]; then
  echo "βœ… All files verified β€” integrity OK"
  exit 0
else
  echo "❌ Integrity check FAILED β€” files differ from official repo"
  exit 1
fi
rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first.Stars: 194kUpdated Claude CodeCodexVerifiedInstall