php-yii-audit

Audit Yii2 applications for access control, RBAC, CSRF, and XSS weaknesses.

386|38|Updated Mar 24, 2026
One-click install
npx skills add https://github.com/0xShe/PHP-Code-Audit-Skill --skill php-yii-audit
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: php-yii-audit
Source: https://github.com/0xShe/PHP-Code-Audit-Skill/tree/main/php-yii-audit
Command: npx skills add https://github.com/0xShe/PHP-Code-Audit-Skill --skill php-yii-audit

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Yii2 projects are prone to misconfigurations in access control (AccessControl/RBAC), CSRF handling, input filtering, output encoding, and unsafe redirects, which can lead to privilege escalation, data leakage, or XSS.

Core Features & Use Cases

  • Inspect AccessControl and RBAC rules across controllers, actions, and matchCallback usage to ensure proper authorization boundaries.
  • Verify CSRF settings, cookie validation, and token handling in state-changing requests to prevent forgery.
  • Assess input filtering via rules(), safeAttributes(), and scenarios to prevent mass assignment vulnerabilities.
  • Check output encoding and safe output practices in views to prevent XSS, including usage of Html::encode and HtmlPurifier.
  • Map findings to common vulnerability categories (AUTH/CSRF/XSS/CFG/LOGIC) for remediation prioritization.

Quick Start

Run the Yii2 audit against your project root to generate framework_audit/yii_{timestamp}.md containing framework-specific risk findings.

Frequently Asked Questions about php-yii-audit

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I audit Yii2 application security for access control and CSRF vulnerabilities?

To audit Yii2 security, run an automated scan against your project root to inspect access control, RBAC, and CSRF handling. The audit identifies misconfigurations across controllers, models, and views, mapping findings to categories like AUTH, CSRF, and XSS.

What common security misconfigurations can be detected in a Yii2 project?

A Yii2 security audit detects access control and RBAC boundary issues, unsafe CSRF token handling, mass assignment risks from improper input filtering, and XSS from inadequate output encoding in views. It also flags unsafe redirect patterns.

How do I check my Yii2 controllers for proper RBAC and access control rules?

You can check Yii2 RBAC and access control by running an audit that inspects AccessControl configurations, action filters, and matchCallback usage across controllers. This ensures proper authorization boundaries are enforced.

Does the Yii2 security audit require any specific dependencies or tools to run?

No specific dependencies are required to run the Yii2 security audit. The tool automatically detects Yii framework presence by checking for composer.json with yiisoft/yii2, web/index.php entry, and standard application directories.

What is the best way to prevent mass assignment vulnerabilities in Yii2 models?

To prevent mass assignment in Yii2, an audit assesses input filtering by inspecting rules(), safeAttributes(), and scenarios within your models. This ensures only explicitly allowed attributes are assigned during bulk operations.

How do I review Yii2 views for XSS and output encoding issues?

To review Yii2 views for XSS, an audit checks output encoding practices and the usage of safe output helpers like Html::encode and HtmlPurifier. Findings are mapped to the XSS vulnerability category for remediation.