xerj-security-audit
Fungsinya
Meninjau basis kode untuk masalah keamanan dengan mengindeksnya dan memeriksa setiap pemanggilan fungsi berbahaya, dengan catatan yang menunjukkan bahwa pencarian sudah lengkap. Skill ini untuk pengembang dan peninjau keamanan yang menginginkan audit yang dapat dipertanggungjawabkan, bukan pemindaian cepat.
Kapan dipakai
- βSaat Anda ingin meninjau keamanan aplikasi atau plugin PHP dengan catatan cakupan penuh.
- βSaat Anda perlu mendaftar setiap pemanggilan berbahaya dalam sebuah basis kode.
- βSaat Anda ingin temuan dicatat dalam buku besar yang bisa dikueri nanti.
Link skill
https://github.com/xerj-org/xerj/blob/main/docs/case-studies/wordpress-security-audit/skill/SKILL.mdSalin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.
Cara pakai
Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.
Pesan siap tempel
Untuk Claude Code, Codex, atau Cursor: jalankan di folder proyek, lalu skill langsung terpasang.
Unduh SKILL.md lalu taruh di folder skill agen Anda.
Contoh permintaan ke AI
βTinjau keamanan plugin PHP ini dan buktikan bahwa kami tidak melewatkan pemanggilan fungsi berbahaya apa pun.β
5 skill baru setiap minggu. 1 menit baca.
Cara kerjanya
Skill mengindeks kode sekali, memetakan fungsi berbahaya yang dikenal, dan menemukan setiap lokasi pemanggilan dengan pemindaian pohon sintaksis. Hasilnya diperiksa silang dengan pencarian teks sederhana untuk menunjukkan tidak ada yang terlewat, lalu temuannya dicatat di buku besar yang bisa dicari.
Konten teknis (SKILL.md asli)
Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.
XERJ whitebox security audit
Run a security review where XERJ is the agent's second brain: index the code
once, then interrogate it β never load whole files. The deliverable is a
defensible coverage claim, not a vibe. Scripts referenced below live in
docs/case-studies/wordpress-security-audit/sink-census/ (copy them alongside
this skill to reuse in another repo).
When to use
- "Security-review this codebase / WordPress plugin / PHP app with coverage."
- "Find the dangerous calls / sinks and prove we didn't miss any."
- "Run the sink census / audit ledger."
Prerequisites (state them, then set up)
- XERJ running, ES-compatible, on
http://127.0.0.1:9200(xerj --insecure --data-dir ./data). pip install tree-sitter tree-sitter-php(+ the grammar for the target language).- The target source tree on disk.
The loop (do these in order; report honestly at each step)
1. Map the dangerous functions (knowledge)
Use php_dangerous_functions.json β 275 PHP built-ins/constructs across 28
categories (command/code exec, unserialize, include loaders, file r/w/delete,
SSRF, SQL drivers, XXE, callables, variable-injection, reflection, weak crypto/
random, type-juggling, β¦), each with vuln class + the taint-relevant argument.
For another framework/language, extend this map β it is data, not code.
2. Census every call site (AST)
python3 sink_census.py <src> parses every file with tree-sitter and records
2b. Census the dangerous PATTERNS (the class a sink list misses)
python3 pattern_census.py <src> AST-detects the non-function vulns β loose ==
/ magic-hash, non-strict in_array, strcmp-with-array (?login[]=), @
suppression, variable-variables, unsafe setcookie, switch-on-request,
Host-header trust, ORDER-BY injection β into wppatterns. Semantic classes a
census can't decide (SQL truncation, charset SQLi, second-order, phar, TOCTOU,
upload-exec, is_numeric bypass, regex-anchor, session-fixation, wrong-context
XSS) are catalogued in php_dangerous_patterns.json with detection guidance and
swept by reasoning. FULL REFERENCE: PHP-SECURITY-GUIDE.md β every function AND
pattern mapped to attack + detection + safe recipe.
every call site of a catalogued function (calls, methods, constructs like
echo/include/backtick, new ReflectionFunction). tree-sitter captures real
calls regardless of formatting/namespacing β grep cannot.
3. PROVE coverage (the guarantee β do not skip)
The census reconciles every grep occurrence against the AST, using AST string/comment/inline-HTML node ranges as the oracle. A clean run prints:
UNEXPLAINED: 0 => coverage PROVEN (0 gaps)
If UNEXPLAINED > 0, EVERY residual must be resolved (it is either a real call the extractor missed β fix the catalog/node-handling β or a proven non-call). Never report coverage while residuals are unexplained.
4. Index + triage (XERJ wpsinks)
The census bulk-indexes one doc per call site (file,line,fn,class,arg). Query
the risk profile; the rare high-value classes are the must-review set (in WP core:
RCE-command 11, deserialization 13, SQL 200, SSRF 107). You can now guarantee
you've seen every one.
5. AI-enrich into a ledger (enrich_pipeline.py)
For each high-risk site: read the arg + enclosing code, decide reachable
(request/cache/trusted/literal), guarded (which defense), severity, and a
verdict; write it back to wpsinks. This is the embedding-pipeline analogue,
but the enrichment is reasoned security judgement, and it accretes across runs.
Enrich 100% of the rare classes; queue the long tail.
5b. Trace any sink through the API (trace_sink.py <file> <line>)
Joins wpsinks -> wpaudit -> wpauthz -> reverse callers with NO local file
access: the sink + verdict, the enclosing function's sources/sinks/sanitizer, its
authz guards, and who calls it + whether they read a request source. The verdict
flags a SOURCE->SINK candidate when a source and an unsanitized sink coexist in a
function. (Reverse callers scan _source calls arrays because of the
array-term engine bug, and restrict common method names like load/query to
the same file to avoid class collision.)
6. Reason about the real bugs (the parts a census can't see)
Sink coverage β total coverage. Also sweep, using the other detectors in the case
study: object-scoped authorization / IDOR (wp_authz_graph.py,
wp_checkuse_idor.py), validator completeness (wp_ssrf_ranges.py β an
incomplete
Pertanyaan umum
Apa arti klaim cakupan?
Setiap pemanggilan berbahaya yang ditemukan pemindaian sintaksis diperiksa silang dengan pencarian teks sederhana, sehingga tinjauan menunjukkan tidak ada celah.
Bahasa apa saja yang didukung?
PHP adalah contoh utamanya. Bahasa lain memerlukan tata bahasa dan peta fungsinya sendiri.
Apakah perlu layanan yang sedang berjalan?
Ya. Skill memerlukan node pencarian lokal yang berjalan dan paket parsing tree-sitter yang terpasang.
Detail
Deskripsi asli dari pembuat
Coverage-guaranteed whitebox security audit of a codebase using XERJ + tree-sitter AST. Use when the user wants to security-review PHP (or other-language) code with a provable "we enumerated every dangerous call" guarantee, or asks to run the WordPress-style sink census / audit. Drives an index-once, query-read-reason loop; proves zero gaps against grep; enriches findings into a queryable ledger.
repo: xerj-org/xerj
Popularitas
- Bintang GitHub
- 19k
- Peringkat
- #10503
- Lisensi
- Apache-2.0
- Diperbarui
- 2/11/2026
Komentar
- β¦
Skill lain dari repositori ini
xerj
19kMembantu agent Anda menemukan dokumentasi dan kontrak XERJ terbaru sebelum mengindeks folder, mencari data, atau mengatur memori agent.
xerj-knowledge
19kMembantu agent Anda mencari dokumen, catatan, PDF, spreadsheet, dan surat lokal Anda sendiri, lalu mengutip file dan halaman asal setiap jawaban.
xerj-code
19kMembantu agent Anda berhenti menebak API yang tidak dikenal dengan mengkloning kode referensi, mengindeksnya, dan membaca implementasi yang tepat terlebih dahulu.
Skill serupa
reverse-engineer-anything
422kMembantu agent Anda memeriksa aplikasi dan paket yang sudah dirilis untuk menjelaskan fitur, membandingkan versi, atau memandu pembangunan ulang dengan alat REA.
1password
394kMembantu agent Anda mengatur CLI 1Password, masuk, serta membaca atau menyisipkan rahasia tanpa menampilkan nilainya di chat.
healthcheck
394kMembantu agent Anda mengaudit komputer atau server OpenClaw dari risiko keamanan seperti SSH, firewall, pembaruan, dan cadangan, lalu menyarankan perbaikan aman.