मुख्य सामग्री पर जाएँ
Skillpedia
सिक्योरिटी19k · #10503

xerj-security-audit

यह क्या करती है

यह स्किल कोडबेस को इंडेक्स करके और हर खतरनाक function कॉल जाँचकर उसमें सुरक्षा समस्याएँ खोजती है, साथ में एक रिकॉर्ड के साथ जो दिखाए कि खोज पूरी थी। यह उन डेवलपरों और सुरक्षा समीक्षकों के लिए है जिन्हें त्वरित स्कैन की बजाय बचाव योग्य ऑडिट चाहिए।

कब इस्तेमाल करें

  • ✓जब आप किसी PHP ऐप या plugin की सुरक्षा समीक्षा चाहते हों, पूरी कवरेज के रिकॉर्ड के साथ।
  • ✓जब आपको किसी कोडबेस में हर खतरनाक कॉल की सूची चाहिए।
  • ✓जब आप नतीजे ऐसे ledger में दर्ज करना चाहते हों जिसे बाद में खोजा जा सके।

Skill का लिंक

https://github.com/xerj-org/xerj/blob/main/docs/case-studies/wordpress-security-audit/skill/SKILL.md

इसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।

कैसे इस्तेमाल करें

सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।

पेस्ट करने के लिए तैयार मैसेज

इस skill से मेरी मदद करो: https://github.com/xerj-org/xerj/blob/main/docs/case-studies/wordpress-security-audit/skill/SKILL.md इस लिंक की SKILL.md फ़ाइल पढ़ो और मेरे काम में उसके निर्देशों का पालन करो।
क्या आप चाहते हैं कि आपका AI ऐसी skills खुद ढूँढे?मुफ़्त Skillpedia MCP इंस्टॉल करें: बस एक लाइन, और हर काम से पहले यह 15,000+ skills में खोजता है।1 मिनट में इंस्टॉल करें →

AI से क्या माँगें: उदाहरण

“इस PHP plugin की सुरक्षा समीक्षा कीजिए और साबित कीजिए कि हमने कोई खतरनाक function कॉल नहीं छोड़ी।”

हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।

यह कैसे काम करती है

स्किल कोड को एक बार इंडेक्स करती है, ज्ञात खतरनाक functions मैप करती है, और syntax-tree स्कैन से हर call site खोजती है। वह नतीजे को एक साधारण टेक्स्ट खोज से मिलाकर जाँचती है कि कुछ छूटा नहीं, फिर नतीजे एक खोजने योग्य ledger में दर्ज करती है।

तकनीकी सामग्री (मूल SKILL.md)

लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे 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

अक्सर पूछे जाने वाले सवाल

कवरेज के दावे का क्या मतलब है?

syntax स्कैन से मिली हर खतरनाक कॉल को एक साधारण टेक्स्ट खोज से दोबारा मिलाया जाता है, इसलिए समीक्षा में कोई अंतर नहीं दिखता।

कौन-सी भाषाएँ सपोर्ट होती हैं?

PHP मुख्य उदाहरण है, और दूसरी भाषाओं के लिए अपना grammar और function map चाहिए।

क्या इसके लिए चलती हुई सेवा चाहिए?

हाँ। इसके लिए एक स्थानीय search node चलना चाहिए और tree-sitter parsing पैकेज इंस्टॉल होने चाहिए।

जानकारी

लेखक का मूल विवरण

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

लोकप्रियता

GitHub स्टार
19k
रैंकिंग में स्थान
#10503
लाइसेंस
Apache-2.0
अपडेट की गई
2/11/2026

क्या यह skill काम की है?

0

लॉग इन करें वोट करने के लिए।

कमेंट

  • …

इस repository की और skills

मिलती-जुलती skills