Skip to content

tanviet12/vbsec / skills/codex/vbs-scan-security

vbs-scan-security

Flagged

Use when scanning code for security vulnerabilities. Use when user says "scan security", "kiểm tra bảo mật", "security audit", "review security", or invokes `/vbs-scan-security`. For large scans (>20 main-language files OR >30 total OR >14 days) processes chunks sequentially. Outputs bilingual reports (vi/en). Optional `--auto-fix` (agentic patch + verify loop) and `--sca` (live CVE lookup via OSV.dev).

FileKindSize
SKILL.mdskill md28.8 KB
VERSIONother6 B
agents/openai.yamlconfig313 B
references/chunking-strategy.mdmarkdown7.2 KB
references/data-flow-classification.mdmarkdown9.5 KB
references/dependency-scan.mdmarkdown9.7 KB
references/i18n/en.mdmarkdown8.7 KB
references/i18n/vi.mdmarkdown9.4 KB
references/language-detection.mdmarkdown7.5 KB
references/load-rules.shexecutablescript5.2 KB
references/output-format.mdmarkdown26.1 KB
references/project-context.mdmarkdown2.7 KB
references/sub-agent-prompts.mdmarkdown16.5 KB
references/validate-report.pyexecutablescript8.7 KB
rules/generic/01-hardcoded-secret.mdmarkdown5.4 KB
rules/generic/02-sql-injection.mdmarkdown5.2 KB
rules/generic/03-xss.mdmarkdown4.9 KB
rules/generic/04-idor.mdmarkdown5.7 KB
rules/generic/05-slopsquatting.mdmarkdown6.1 KB
rules/generic/06-brute-force.mdmarkdown6.9 KB
rules/generic/07-mass-assignment.mdmarkdown6.3 KB
rules/generic/08-insecure-deserialization.mdmarkdown6.3 KB
rules/generic/09-ssrf.mdmarkdown6.7 KB
rules/generic/10-path-traversal.mdmarkdown6.3 KB
rules/generic/11-csrf.mdmarkdown7.8 KB
rules/generic/12-broken-access-control.mdmarkdown7.9 KB
rules/generic/13-weak-password-hashing.mdmarkdown5.2 KB
rules/generic/14-jwt-none-algorithm.mdmarkdown5.3 KB
rules/generic/15-cors-misconfig.mdmarkdown5.3 KB
rules/generic/16-unrestricted-file-upload.mdmarkdown5.9 KB
rules/generic/17-verbose-error-debug-mode.mdmarkdown5.8 KB
rules/generic/18-missing-rate-limit.mdmarkdown10.7 KB
rules/generic/19-race-condition.mdmarkdown11.5 KB
rules/generic/20-outdated-dependency.mdmarkdown7.2 KB
rules/generic/21-command-injection.mdmarkdown6.6 KB
rules/generic/22-vulnerable-dependency.mdmarkdown5.3 KB
rules/generic/23-llm-prompt-injection.mdmarkdown9.7 KB
rules/generic/24-excessive-agency.mdmarkdown10.1 KB
rules/generic/25-tenant-isolation.mdmarkdown10.1 KB
rules/generic/26-authz-path-parity.mdmarkdown10.9 KB
rules/generic/27-excessive-data-exposure.mdmarkdown10.4 KB
rules/generic/28-business-state-integrity.mdmarkdown9.5 KB
rules/generic/29-sensitive-data-in-logs.mdmarkdown9.1 KB
rules/generic/30-auth-session-lifecycle.mdmarkdown9.4 KB
rules/generic/31-resource-exhaustion.mdmarkdown9.0 KB
rules/languages/README.mdmarkdown8.5 KB
rules/languages/dart/01-hardcoded-secret.mdmarkdown7.9 KB
rules/languages/dart/03-xss.mdmarkdown5.2 KB
rules/languages/dart/05-slopsquatting.mdmarkdown4.6 KB
rules/languages/dart/10-path-traversal.mdmarkdown6.3 KB
rules/languages/dart/12-broken-access-control.mdmarkdown8.3 KB
rules/languages/dart/17-verbose-error-debug-mode.mdmarkdown6.7 KB
rules/languages/dart/20-outdated-dependency.mdmarkdown4.7 KB
rules/languages/dart/README.mdmarkdown3.7 KB
rules/languages/dotnet/02-sql-injection.mdmarkdown5.7 KB
rules/languages/dotnet/07-mass-assignment.mdmarkdown6.0 KB
rules/languages/dotnet/08-insecure-deserialization.mdmarkdown5.7 KB
rules/languages/dotnet/17-verbose-error-debug-mode.mdmarkdown5.0 KB
rules/languages/dotnet/21-command-injection.mdmarkdown5.3 KB
rules/languages/dotnet/README.mdmarkdown1.7 KB
rules/languages/go/02-sql-injection.mdmarkdown5.2 KB
rules/languages/go/08-insecure-deserialization.mdmarkdown5.0 KB
rules/languages/go/09-ssrf.mdmarkdown5.8 KB
rules/languages/go/17-verbose-error-debug-mode.mdmarkdown6.1 KB
rules/languages/go/21-command-injection.mdmarkdown5.2 KB
rules/languages/go/README.mdmarkdown2.7 KB
rules/languages/php/02-sql-injection.mdmarkdown5.8 KB
rules/languages/php/08-insecure-deserialization.mdmarkdown6.2 KB
rules/languages/php/11-csrf.mdmarkdown6.2 KB
rules/languages/php/17-verbose-error-debug-mode.mdmarkdown6.5 KB
rules/languages/php/21-command-injection.mdmarkdown6.7 KB
rules/languages/php/README.mdmarkdown2.9 KB
rules/languages/python/02-sql-injection.mdmarkdown7.2 KB
rules/languages/python/07-mass-assignment.mdmarkdown7.3 KB
rules/languages/python/08-insecure-deserialization.mdmarkdown7.3 KB
rules/languages/python/09-ssrf.mdmarkdown7.5 KB
rules/languages/python/11-csrf.mdmarkdown7.6 KB
rules/languages/python/14-jwt-none-algorithm.mdmarkdown7.5 KB
rules/languages/python/15-cors-misconfig.mdmarkdown8.0 KB
rules/languages/python/17-verbose-error-debug-mode.mdmarkdown8.4 KB
rules/languages/python/21-command-injection.mdmarkdown8.5 KB
rules/languages/python/README.mdmarkdown3.4 KB
rules/languages/typescript/02-sql-injection.mdmarkdown7.5 KB
rules/languages/typescript/03-xss.mdmarkdown6.7 KB
rules/languages/typescript/07-mass-assignment.mdmarkdown7.4 KB
rules/languages/typescript/08-insecure-deserialization.mdmarkdown7.0 KB
rules/languages/typescript/09-ssrf.mdmarkdown7.5 KB
rules/languages/typescript/11-csrf.mdmarkdown7.3 KB
rules/languages/typescript/14-jwt-none-algorithm.mdmarkdown7.0 KB
rules/languages/typescript/15-cors-misconfig.mdmarkdown7.2 KB
rules/languages/typescript/17-verbose-error-debug-mode.mdmarkdown7.2 KB
rules/languages/typescript/21-command-injection.mdmarkdown6.7 KB
rules/languages/typescript/README.mdmarkdown3.3 KB
workflows/auto-fix.mdmarkdown18.9 KB
workflows/large-review-sequential.mdmarkdown14.9 KB
workflows/small-review.mdmarkdown10.1 KB

references/load-rules.sh

View on GitHub
#!/usr/bin/env bash
# load-rules.sh — in phần PHÁT HIỆN của bộ rule hiệu lực cho các ngôn ngữ đã detect.
#
# Usage: bash <skill-dir>/references/load-rules.sh [--root DIR] --part N [lang ...]
#   vd:  bash references/load-rules.sh --root "$SCAN_ROOT" --part 1 typescript
#        bash references/load-rules.sh --part 2 go typescript   # repo đa ngôn ngữ
#        bash references/load-rules.sh --part 1                 # không có overlay → chỉ generic
#
# Output được chia thành nhiều phần, mỗi phần < ~20.000 ký tự, vì Bash tool của agent
# cắt output dài (~30.000 ký tự). Dòng cuối mỗi phần cho biết tổng số phần; chạy đủ
# mọi phần (có thể chạy song song). Không truyền --part = in phần 1.
#
# Rule generic có `opt_in:` trong frontmatter (vd rule 22, chỉ chạy khi có --sca) KHÔNG được nạp ở
# pha quét — workflow tương ứng tự Read rule đó khi user bật cờ.
#
# Rule có `load_when: '<regex>'` trong frontmatter (vd rule AI/MCP, tenant) chỉ được nạp khi truyền
# --root và trong DIR có ít nhất 1 file khớp regex (grep -E -i, bỏ node_modules/vendor/.git...). Không
# truyền --root → nạp mọi rule (an toàn: thà tốn token còn hơn bỏ sót). Rule bị bỏ được liệt kê ở
# dòng cuối để báo cáo ghi vào bảng độ phủ.
#
# Với mỗi rule generic còn lại:
#   - Mọi lang đã detect đều có overlay cùng `id` → chỉ in overlay (generic bị thay thế hoàn toàn).
#   - Ngược lại → in generic, kèm overlay của lang nào có.
# Mỗi file chỉ in tới trước heading chi tiết đầu tiên (## Examples / ## Fix recommendation /
# ## Cross-references). Phần chi tiết đọc sau, chỉ cho rule có finding CRITICAL/HIGH,
# bằng Read tool theo đường dẫn in ở header `=== RULE ... ===`.
# File không có heading chi tiết → in toàn bộ (fallback an toàn).

set -euo pipefail

SKILL_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
PART_BUDGET=20000   # ký tự mỗi phần
PART=1
ROOT=""
LANGS=()
while [ $# -gt 0 ]; do
  case "$1" in
    --part) PART="$2"; shift 2 ;;
    --part=*) PART="${1#--part=}"; shift ;;
    --root) ROOT="$2"; shift 2 ;;
    --root=*) ROOT="${1#--root=}"; shift ;;
    *) LANGS+=("$1"); shift ;;
  esac
done

rule_id() { sed -n 's/^id:[[:space:]]*//p' "$1" | head -1; }
is_opt_in() { sed -n '/^---$/,/^---$/p' "$1" | grep -q '^opt_in:'; }
load_when() { sed -n '/^---$/,/^---$/p' "$1" | sed -n "s/^load_when:[[:space:]]*//p" | head -1 | sed -e "s/^'//" -e "s/'\$//" -e 's/^"//' -e 's/"$//'; }

triggered() {  # triggered <regex> → 0 nếu ROOT có file khớp
  [ -z "$ROOT" ] && return 0
  [ -d "$ROOT" ] || return 0
  grep -rIqiE --exclude-dir=node_modules --exclude-dir=vendor --exclude-dir=.git \
    --exclude-dir=dist --exclude-dir=build --exclude-dir=vbsec-reports --exclude-dir=.vbsec-tmp \
    -e "$1" "$ROOT" 2>/dev/null
}

overlay_for() {  # overlay_for <lang> <id> → path hoặc rỗng
  local dir="$SKILL_DIR/rules/languages/$1" f
  [ -d "$dir" ] || return 0
  for f in "$dir"/[0-9]*.md; do
    [ -f "$f" ] && [ "$(rule_id "$f")" = "$2" ] && { echo "$f"; return 0; }
  done
  return 0
}

detection() {  # detection <path> → phần phát hiện của 1 rule, kèm header
  local rel="${1#"$SKILL_DIR"/}"
  echo "=== RULE $(rule_id "$1") (source: $rel) ==="
  awk '/^## (Examples|Fix recommendation|Cross-references)/ { exit } { print }' "$1"
  echo
}

FILES_SELECTED=()
SKIPPED=()

for generic in "$SKILL_DIR"/rules/generic/[0-9]*.md; do
  is_opt_in "$generic" && continue
  id="$(rule_id "$generic")"
  lw="$(load_when "$generic")"
  if [ -n "$lw" ] && ! triggered "$lw"; then SKIPPED+=("$id"); continue; fi
  overlays=()
  all_covered=1
  for lang in ${LANGS[@]+"${LANGS[@]}"}; do
    o="$(overlay_for "$lang" "$id")"
    if [ -n "$o" ]; then overlays+=("$o"); else all_covered=0; fi
  done
  [ ${#LANGS[@]} -eq 0 ] && all_covered=0
  [ "$all_covered" -eq 1 ] || FILES_SELECTED+=("$generic")
  for o in ${overlays[@]+"${overlays[@]}"}; do FILES_SELECTED+=("$o"); done
done

# Gom rule vào từng phần theo ngân sách ký tự (không cắt ngang 1 rule).
part_of=()
current=1
used=0
for f in "${FILES_SELECTED[@]}"; do
  size=$(detection "$f" | wc -m | tr -d ' ')
  if [ "$used" -gt 0 ] && [ $((used + size)) -gt "$PART_BUDGET" ]; then
    current=$((current + 1))
    used=0
  fi
  part_of+=("$current")
  used=$((used + size))
done
total_parts=$current

if ! [ "$PART" -ge 1 ] 2>/dev/null || [ "$PART" -gt "$total_parts" ]; then
  echo "--part phải từ 1 đến $total_parts" >&2
  exit 1
fi

echo "=== vbsec rules — PART $PART/$total_parts. Đọc toàn bộ output này; không cắt bằng head/tail ==="
for i in "${!FILES_SELECTED[@]}"; do
  [ "${part_of[$i]}" -eq "$PART" ] && detection "${FILES_SELECTED[$i]}"
done
if [ "$PART" -lt "$total_parts" ]; then
  echo "=== PART $PART/$total_parts — CHƯA ĐỦ: chạy tiếp --part $((PART + 1)) đến --part $total_parts ==="
else
  echo "=== PART $PART/$total_parts — đã in đủ ${#FILES_SELECTED[@]} rule ==="
  if [ ${#SKIPPED[@]} -gt 0 ]; then
    echo "=== Rule không nạp vì repo không có dấu hiệu liên quan (ghi vào coverage.rules_skipped): ${SKIPPED[*]} ==="
  fi
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