Why compliance needs automated review
Compliance frameworks like SOC2, HIPAA, and GDPR require specific coding practices around data handling, access control, and audit logging. Manual reviews catch some violations, but they’re inconsistent — especially when the reviewer isn’t a security specialist. This cookbook sets up rules that enforce compliance requirements on every PR.Step 1 — Define your compliance Memories
Start by teaching Kody the high-level compliance principles:Step 2 — Create audit trail rules
Create each rule in Code review → Kody Rules: on the Review Rules tab, click New rule and fill the fields as shown below.Audit logging rule
Data retention rule
Step 3 — Create data handling rules
PII exposure prevention
Encryption requirement
Step 4 — Create access control rules
Step 5 — Add a PR-level compliance check
Step 6 — Configure for enforcement
- In Code review → General → Review feedback, turn on Request changes on critical issues (not available when every connected provider is GitLab). Kody sets the review to Request Changes when it posts a Critical inline comment, and takes the request back once those findings are resolved
- Set all compliance rules to Critical severity
- Use rule inheritance to apply compliance rules across all repos in the organization — create them with Global selected in the scope picker
Checklist
- Compliance Memories teach the high-level principles
- Audit logging rule covers all data mutation paths
- PII exposure rule covers logs and error responses
- Encryption rule covers entity/model definitions
- Access control rule covers all new endpoints
- Request changes on critical issues is on
- Rules are set at the Global scope (organization-wide) for consistency
- A test PR verified the rules fire correctly