rbac-policy-tester

Comprehensive testing for role-based access control.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "rbac-policy-tester" with this command: npx skills add patricio0312rev/skills/patricio0312rev-skills-rbac-policy-tester

RBAC/Policy Tester

Comprehensive testing for role-based access control.

Permission Test Matrix

type Role = 'ADMIN' | 'MANAGER' | 'USER' | 'GUEST'; type Action = 'create' | 'read' | 'update' | 'delete'; type Resource = 'users' | 'orders' | 'reports';

const permissionMatrix: Record<Role, Record<Resource, Action[]>> = { ADMIN: { users: ['create', 'read', 'update', 'delete'], orders: ['create', 'read', 'update', 'delete'], reports: ['create', 'read', 'update', 'delete'], }, MANAGER: { users: ['read', 'update'], orders: ['create', 'read', 'update'], reports: ['read', 'update'], }, USER: { users: ['read'], // Only own profile orders: ['create', 'read'], // Only own orders reports: ['read'], }, GUEST: { users: [], orders: [], reports: ['read'], }, };

describe('RBAC Tests', () => { Object.entries(permissionMatrix).forEach(([role, resources]) => { describe(`Role: ${role}`, () => { Object.entries(resources).forEach(([resource, actions]) => { actions.forEach(action => { it(`should allow ${action} on ${resource}`, async () => { const token = generateToken({ role }); await request(app) .post(`/api/${resource}/${action}`) .set('Authorization', `Bearer ${token}`) .expect(200); }); });

    // Test forbidden actions
    const allActions: Action[] = ['create', 'read', 'update', 'delete'];
    const forbidden = allActions.filter(a => !actions.includes(a));

    forbidden.forEach(action => {
      it(\`should deny \${action} on \${resource}\`, async () => {
        const token = generateToken({ role });
        await request(app)
          .post(\`/api/\${resource}/\${action}\`)
          .set('Authorization', \`Bearer \${token}\`)
          .expect(403);
      });
    });
  });
});

}); });

Output Checklist

  • Permission matrix defined

  • Test suite for all roles

  • Positive and negative tests

  • CI gating enabled

  • Coverage monitoring ENDFILE

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

framer-motion-animator

No summary provided by upstream source.

Repository SourceNeeds Review
General

eslint-prettier-config

No summary provided by upstream source.

Repository SourceNeeds Review
General

postman-collection-generator

No summary provided by upstream source.

Repository SourceNeeds Review
General

nginx-config-optimizer

No summary provided by upstream source.

Repository SourceNeeds Review