基于 SOC 职业分类
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/Ansteorra/KMP --skill security-audit命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
Perform official KMP POC and production releases. Use when the user says "push to dev", "do a release", "release to POC", "release to production", "promote to production", or asks to ship a KMP version. The release flow always updates the in-app changelog and uses the same user-facing notes for the GitHub Release.
Deploy KMP to the Azure nightly environment. Use when the user asks to deploy to nightly, push updates to nightly, build + deploy the nightly image, reset the nightly database, check nightly health/status, tail nightly logs, or get the nightly URL. Triggers on phrases like "deploy to nightly", "push to nightly", "redeploy nightly", "reset nightly db", "nightly status", "nightly logs", or "nightly health".
Runs KMP quality checks (PHPUnit, Jest, Vite, PHPCS, PHPStan) and guides test writing. Use when verifying changes, before PRs, after implementation, or when the user asks to run tests or verify production readiness.
| name | security-audit |
| description | tools and instructions for performing a security audit and penetration testing on the KMP application. |
Perform comprehensive security testing of the KMP application using both static code analysis and dynamic terminal-based testing.
http://localhost:8080TestPassword (for all dev users)/workspaces/KMP/app/workspaces/KMP/security-reportsAnalyze the codebase for security vulnerabilities without executing code.
Search for raw SQL queries and unsafe database operations:
# Find raw SQL queries that might be vulnerable
grep -rn "query(" app/src/ --include="*.php"
grep -rn "\$this->connection" app/src/ --include="*.php"
grep -rn "execute(" app/src/ --include="*.php"
# Check for string concatenation in queries
grep -rn "WHERE.*\\\$" app/src/ --include="*.php"
grep -rn "SELECT.*\\\$" app/src/ --include="*.php"
Look for:
Search for unescaped output and unsafe JavaScript:
# Find potentially unescaped PHP output
grep -rn "<?=" app/templates/ --include="*.php" | grep -v " h("
grep -rn "echo \$" app/src/ --include="*.php"
# Check for dangerous JavaScript patterns
grep -rn "innerHTML" app/assets/js/ --include="*.js"
grep -rn "document.write" app/assets/js/ --include="*.js"
grep -rn "eval(" app/assets/js/ --include="*.js"
Look for:
h() helper function# Check authentication configuration
cat app/src/Application.php | grep -A 50 "getAuthenticationService"
# Find session handling
grep -rn "Session" app/src/ --include="*.php"
grep -rn "cookie" app/config/ --include="*.php"
# Check password handling
grep -rn "password" app/src/ --include="*.php"
grep -rn "bcrypt\|hash\|PASSWORD_DEFAULT" app/src/ --include="*.php"
Look for:
# Check policy implementations
find app/src/Policy -name "*.php" -exec cat {} \;
# Find authorization checks in controllers
grep -rn "authorize\|canAccess\|isAuthorized" app/src/Controller/ --include="*.php"
# Check for missing authorization
grep -rn "public function" app/src/Controller/ --include="*.php" | head -50
Look for:
# Find file upload handling
grep -rn "upload\|getClientFilename\|moveTo" app/src/ --include="*.php"
grep -rn "file_put_contents\|move_uploaded_file" app/src/ --include="*.php"
# Check allowed file types
grep -rn "mime\|extension\|ALLOWED" app/src/ --include="*.php"
Look for:
# Find hardcoded credentials or secrets
grep -rn "password\s*=\s*['\"]" app/src/ --include="*.php"
grep -rn "api_key\|secret\|token" app/src/ --include="*.php"
grep -rn "API_KEY\|SECRET" app/config/ --include="*.php"
# Check .env file for sensitive data
cat app/config/.env 2>/dev/null || echo ".env not found"
# Find logging of sensitive data
grep -rn "Log::" app/src/ --include="*.php" | grep -i "password\|token\|secret"
# Find shell command execution
grep -rn "exec(\|shell_exec\|system(\|passthru\|popen\|proc_open" app/src/ --include="*.php"
grep -rn "``" app/src/ --include="*.php"
# Check PHP dependencies
cd /workspaces/KMP/app && composer audit
# Check JavaScript dependencies
cd /workspaces/KMP/app && npm audit 2>/dev/null || echo "No package-lock.json"
Execute runtime tests against the running application.
# Verify application is running
curl -s -o /dev/null -w "%{http_code}" http://localhost:8080
# Create reports directory
mkdir -p /workspaces/KMP/security-reports
Test login functionality for common vulnerabilities:
# Test for user enumeration
curl -s -X POST http://localhost:8080/members/login \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "email=nonexistent@test.com&password=wrong" | grep -i "error\|invalid\|incorrect"
curl -s -X POST http://localhost:8080/members/login \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "email=admin@amp.ansteorra.org&password=wrong" | grep -i "error\|invalid\|incorrect"
# Test for brute force protection (try 5 rapid requests)
for i in {1..5}; do
curl -s -X POST http://localhost:8080/members/login \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "email=admin@amp.ansteorra.org&password=wrong$i" -o /dev/null -w "%{http_code}\n"
done
# Test common SQL injection patterns
curl -s "http://localhost:8080/members/view/1'" | head -20
curl -s "http://localhost:8080/members/view/1%20OR%201=1" | head -20
curl -s "http://localhost:8080/members?search=test'%20OR%20'1'='1" | head -20
# Test reflected XSS
curl -s "http://localhost:8080/members?search=<script>alert(1)</script>" | grep -o "<script>alert(1)</script>"
# Test for proper encoding
curl -s "http://localhost:8080/members?search=%3Cscript%3Ealert(1)%3C/script%3E" | grep -o "<script>"
# Check for CSRF tokens in forms
curl -s http://localhost:8080/members/login | grep -i "csrf\|_token\|_csrfToken"
# Attempt POST without CSRF token (should fail)
curl -s -X POST http://localhost:8080/members/add \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "name=test" -w "%{http_code}"
# Test path traversal
curl -s "http://localhost:8080/../../../etc/passwd" -o /dev/null -w "%{http_code}"
curl -s "http://localhost:8080/..%2F..%2F..%2Fetc%2Fpasswd" -o /dev/null -w "%{http_code}"
# Check for exposed sensitive files
curl -s "http://localhost:8080/.env" -o /dev/null -w "%{http_code}"
curl -s "http://localhost:8080/config/app.php" -o /dev/null -w "%{http_code}"
curl -s "http://localhost:8080/.git/config" -o /dev/null -w "%{http_code}"
# Check response headers
curl -s -I http://localhost:8080 | grep -iE "x-frame-options|x-content-type|x-xss-protection|strict-transport|content-security-policy"
# Login as basic user and try to access admin resources
# First get a session cookie (manual step or use browser automation)
curl -c cookies.txt -X POST http://localhost:8080/members/login \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "email=iris@ampdemo.com&password=TestPassword" -L
# Try to access another user's data
curl -b cookies.txt "http://localhost:8080/members/view/1" -o /dev/null -w "%{http_code}"
curl -b cookies.txt "http://localhost:8080/members/edit/1" -o /dev/null -w "%{http_code}"
# Cleanup
rm -f cookies.txt
Use available security tools for comprehensive scanning.
cd /workspaces/KMP/app
local-php-security-checker 2>/dev/null || echo "local-php-security-checker not installed"
dependency-check --project "KMP" \
--scan "/workspaces/KMP/app" \
--out "/workspaces/KMP/security-reports/dependency-check" \
--format HTML 2>/dev/null || echo "dependency-check not installed"
nikto -h http://localhost:8080 \
-o /workspaces/KMP/security-reports/nikto-report.html \
-Format html 2>/dev/null || echo "nikto not installed"
nuclei -u http://localhost:8080 \
-o /workspaces/KMP/security-reports/nuclei-report.txt \
-silent 2>/dev/null || echo "nuclei not installed"
# Ensure debug mode is off in production config
grep -r "debug" app/config/app.php app/config/app_local.php 2>/dev/null
# Check Security component usage
grep -rn "Security" app/src/Controller/ --include="*.php"
grep -rn "FormProtection" app/src/Controller/ --include="*.php"
# Verify ORM usage (safe) vs raw queries (potentially unsafe)
echo "=== ORM Usage (Safe) ==="
grep -c "->find\|->get\|->save\|->delete" app/src/Model/Table/*.php 2>/dev/null || echo "No Table files found"
echo "=== Raw Queries (Review Needed) ==="
grep -rn "getConnection\|query(" app/src/ --include="*.php"
When reporting findings, use this format:
| Severity | Category | Location | Description | Remediation |
|---|---|---|---|---|
| CRITICAL | SQL Injection | src/Controller/X.php:42 | Raw query with user input | Use parameter binding |
| HIGH | XSS | templates/Members/view.php:15 | Unescaped output | Use h() helper |
| MEDIUM | Auth | src/Application.php | Weak session timeout | Increase session security |
| LOW | Headers | N/A | Missing X-Frame-Options | Add security headers |
http://localhost:8080 responds