You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(rbac): enforce app:read for app access, use permissions for member invites, gate portal
* fix(rbac): enforce app:read for app access, use permissions for member invites, gate portal
Remove the APP_IMPLYING_RESOURCES fallback that let custom roles bypass
the App Access toggle. Replace hardcoded role string checks in the member
invite flow with RBAC permission checks (member:create/update), and add
privilege escalation prevention for non-admin callers. Add portal:read /
compliance-obligation check to the portal so unapproved roles are
redirected.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix(rbac): resolve caller member permissions instead of hardcoded role checks
Replace role string matching (isAdmin/isAuditor) with actual RBAC
permission resolution — resolves the caller's member actions from both
built-in and custom roles via BUILT_IN_ROLE_PERMISSIONS + DB lookup.
Uses member:delete as the signal for full control (can assign any role)
vs restricted (can only assign employee/contractor/custom roles).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix(rbac): let the permission guard handle member invite authorization
Remove redundant validateAssignableRoles — the @RequirePermission guard
on the controller already checks member:create. If the admin gave a
custom role Members: Write, that role can invite. No second layer of
role-string checks needed.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix(rbac): add server-side role assignment validation based on member permission level
Resolve the caller's member actions from RBAC (built-in + custom roles).
Write-level access (all CRUD) can assign any role. Partial access (e.g.
auditor with create+read only) can only assign restricted roles
(employee/contractor) and custom roles — cannot assign privileged
built-in roles.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix(rbac): use permission checks for allowedBuiltInRoles on people page
Replace hardcoded isAdminOrOwner/isAuditor role string checks with
Write-level member permission check (all CRUD actions). Mirrors the
backend validation logic.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* refactor(auth): add parseRolePermissions/parseRoleObligations helpers
Extract the repeated typeof/JSON.parse pattern for OrganizationRole
fields into typed helpers in the auth package. Replaces verbose
defensive checks with one-liner calls that return typed objects.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* refactor: clean up parse helpers and role checks
Add try/catch to JSON parse helpers, extract generic parseJsonField,
add isRestrictedRole() to eliminate verbose readonly casts, and
make portal-access checks consistent.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* chore: add cleanup skill for mandatory post-implementation code review
Committed to the repo so all Claude agents working in this codebase
will have it available and are required to run it after writing code.
Checks for verbose patterns, inconsistent idioms, missing error
handling, and readability issues.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* chore: update PostToolUse hook to remind about cleanup skill
The hook now fires for all TS files in apps/ and packages/ and reminds
agents to run the cleanup skill before committing.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Mariano Fuentes <marfuen98@gmail.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
description: "MUST run after writing or modifying code — reviews changed files for verbose patterns, inconsistencies, and readability issues before considering work done"
4
+
---
5
+
6
+
# Post-Implementation Cleanup
7
+
8
+
**This skill is mandatory.** After writing or modifying code, you MUST review all changed files before reporting the task as complete. Code must be readable at a glance.
9
+
10
+
## When to Run
11
+
12
+
- After completing any implementation work
13
+
- After fixing bugs
14
+
- After refactoring
15
+
- Before committing
16
+
17
+
## Checklist
18
+
19
+
For every file you changed, verify:
20
+
21
+
### 1. No Verbose Defensive Checks
22
+
23
+
Extract repeated patterns into typed helpers.
24
+
25
+
```tsx
26
+
// ❌ Verbose and repeated
27
+
const perms =typeofrole.permissions==='string'
28
+
?JSON.parse(role.permissions) :role.permissions;
29
+
if (perms&&typeofperms==='object'&&Array.isArray(perms.portal) &&perms.portal.length>0) {
0 commit comments