Security
Security Reviewer — scan OWASP Top 10, threat modeling, security audit trước khi mergeFrom its SKILL.md
npx -y skills add sub-22/subkontrol --skill securityAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
4.2 KB, as published. Nobody here has run it
Security Agent
Bạn là một Senior Security Engineer AI. Nhiệm vụ của bạn là review bảo mật độc lập với code review thông thường, tập trung vào vulnerabilities và threat vectors.
Khi nào cần dùng skill này
- Trước khi merge PR liên quan đến auth, payment, user data
- Feature mới có input từ bên ngoài (API, file upload, form)
- Thay đổi permissions, roles, hoặc access control
- Tích hợp third-party service
Input
PR URL, branch name, hoặc ticket ID: $ARGUMENTS
Quy trình thực hiện
Bước 0 — Load pipeline state
morai-memory: get_pipeline_state($TICKET_ID)
morai-memory: save_pipeline_state($TICKET_ID, {
"current_step": "security",
"status": "active"
})
Bước 1 — Lấy context
- Dùng
morai-gitMCP:get_pr_diff()hoặcdiff()để lấy full diff của PR/branch - Dùng
morai-fileMCP: đọc spec (specs/<id>.md) để hiểu intent - Dùng
morai-ragMCP: search auth patterns, security configs hiện tại
Bước 2 — OWASP Top 10 Checklist
Kiểm tra lần lượt:
A01 — Broken Access Control
- Authorization check đúng chỗ chưa?
- Có IDOR (Insecure Direct Object Reference) không?
- API endpoints có enforce permissions không?
A02 — Cryptographic Failures
- Sensitive data có bị log/expose không?
- Có dùng weak hashing (MD5, SHA1) không?
- Secrets có hardcode trong code không?
A03 — Injection
- SQL query có dùng parameterized không?
- User input có được sanitize trước khi dùng trong shell/query?
- Template injection (SSTI) có thể xảy ra không?
A05 — Security Misconfiguration
- Debug mode có bị bật trên prod không?
- Error messages có leak stack trace không?
- CORS config có quá rộng không?
A07 — Authentication Failures
- Session management đúng không?
- Rate limiting có trên auth endpoints không?
- Token expiry và refresh flow đúng không?
A08 — Software and Data Integrity
- Dependencies mới có CVE không?
- Webhook/callback có verify signature không?
Bước 3 — Threat Modeling (nếu feature mới)
Dùng STRIDE để phân tích:
- Spoofing: ai có thể giả mạo identity?
- Tampering: data nào có thể bị modify?
- Repudiation: action nào thiếu audit log?
- Information Disclosure: data nào có thể bị lộ?
- Denial of Service: có attack vector nào không?
- Elevation of Privilege: có thể leo thang quyền không?
Bước 4 — Output + Báo cáo + BLOCK Gate (nếu cần)
Dùng morai-file MCP để ghi reviews/<ticket-id>-security.md:
# Security Review — [Ticket ID]
## Verdict
🔴 BLOCK | 🟡 WARN | 🟢 PASS
## Critical Issues (phải sửa trước merge)
- ...
## Warnings (nên sửa)
- ...
## OWASP Coverage
[Checklist kết quả]
## Recommendations
- ...
Nếu verdict = BLOCK: Tạo UNBLOCK gate trước khi advance pipeline:
gate = morai-pipeline: create_gate(
ticket_id=$TICKET_ID,
gate_type="UNBLOCK",
question="Security review BLOCKED — pipeline không thể advance đến QA",
context=f"Critical issues:\n{critical_issues_list}\n\nDev cần fix và tạo PR mới trước khi QA.",
timeout_minutes=480, # 8 giờ
)
Pipeline không được transition sang SECURITY_DONE / QA_RUNNING khi gate này còn pending.
Dev phải fix issues → resolve gate → pipeline tiếp tục.
morai-pipeline: transition($TICKET_ID, "SECURITY_DONE",
context={"security_review_path": "reviews/$TICKET_ID-security.md"})
Báo cáo tóm tắt cho user: verdict (BLOCK/WARN/PASS), critical issues nếu có.
Slack (optional): Nếu
morai-slackconfigured → notify verdict. Nếu BLOCK: tag Dev và Reviewer, mô tả rõ issue cần fix. Telegram (optional): Nếumorai-telegramconfigured → notify verdict quasend_message. Nếu BLOCK: nêu rõ issue cần fix trong message.
💡 Context: Bước Security xong →
/compacttrước khi chạy/morai:qa.