WordPress quality gate — WPCS, phpstan, phpunit, WP security heuristics.
English · 日本語 · Tiếng Việt
Quality gate cho plugin và theme WordPress trên PHP 8.1+. Phân tích tĩnh, không cần WordPress runtime, không tài khoản, không telemetry. Tool quét code, không boot WordPress.
| Dự án | Phạm vi | Repository | Tài liệu |
|---|---|---|---|
| Rampart | Quality gate Laravel (Artisan) | GitHub | Pages |
| Rampart PHP | PHP thuần + đa framework, PHP 7.4+ | GitHub | Pages |
| Rampart WP | Plugin/theme WordPress | GitHub | Pages |
Từ source (dùng được ngay):
git clone https://github.com/thiennhant95/Rampart-Wordpress.git
cd Rampart-Wordpress
composer install --no-interaction
php bin/wp-check /path/to/plugin
Phar: tải wp-check.phar + .sha256 từ GitHub Releases, kiểm tra checksum,
rồi chạy php wp-check.phar --version.
Composer qua GitHub:
composer config repositories.wp-checker vcs https://github.com/thiennhant95/Rampart-Wordpress
composer require --dev rampart/wp-quality-checker:^0.4
php vendor/bin/wp-check /path/to/plugin
Yêu cầu PHP 8.1+ để chạy tool. Plugin được quét có thể dùng bất kỳ PHP version nào WordPress hỗ trợ.
php bin/wp-check /path/to/my-plugin --min-severity=error --fail-on=none --format=html
Báo cáo ghi vào reports/wp-checker/. Exit code: 0 sạch/review · 1 fail gate ·
2 sai tham số · 3 lỗi nội bộ.
Tool wrap: WPCS (phpcs), phpstan, phpunit.
| Rule | Severity | Khi nào báo |
|---|---|---|
WPDB_PREPARE |
error | $wpdb query động mà không prepare() |
WP_UNESCAPED_OUTPUT |
warning | echo/print/<?= thiếu esc_*()/wp_kses()/cast |
WP_NONCE |
warning | admin_post_*/wp_ajax_* không verify nonce |
WP_CAPABILITY |
error | handler đặc quyền thiếu current_user_can() |
WP_CONFIG_SECRET |
warning | secret rỗng/placeholder/ngắn trong wp-config*.php |
WP_ABSPATH |
warning | file entry thiếu defined('ABSPATH') |
WP_TABLE_PREFIX |
info (opt-in) | bảng wp_ literal trong SQL |
WP_TEXTDOMAIN |
info (opt-in) | translation thiếu domain literal |
Các rule generic (SQLi, XSS, command injection, SSRF, secret, eval, JS/CSS…) hoạt động như Rampart cha. Ví dụ đầy đủ: rules.html
console, json, html, md, sarif. HTML có biến thể developer,
findings-only (--no-remediation), client (--client), hoặc cả 3
(--all-variants). Chi tiết: reports.html
- run: composer install --prefer-dist --no-progress
- run: php bin/wp-check . --min-severity=error --fail-on=error --format=json
Thêm --format=sarif và upload file SARIF để dùng GitHub code scanning.
Công thức: ci.html
php bin/wp-check /path/to/plugin --baseline-generate --fail-on=none
php bin/wp-check /path/to/plugin --baseline-file=baseline.json
Suppression inline: // rampart-ignore RULE_ID hoặc
// rampart-ignore-next-line RULE_ID.
call_user_func($dynamic) có guard is_callable vẫn có thể bị báo.FAQ: faq.html · Cài đặt: installation.html
MIT © 2026 Rampart.