security-best-practices

Implement RBAC, CSRF protection, CSP, audit logging, and tenant isolation for Next.js 16 apps.

Updated Dec 26, 2025
One-click install
npx skills add https://github.com/DeltaFoundry850/crispy-fishstick --skill security-best-practices-deltafoundry850
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: security-best-practices
Source: https://github.com/DeltaFoundry850/crispy-fishstick/tree/main/.agent/skills/security-best-practices
Command: npx skills add https://github.com/DeltaFoundry850/crispy-fishstick --skill security-best-practices-deltafoundry850

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Enterprise-grade security patterns for Next.js 16 apps, enabling RBAC, CSRF protection, CSP, comprehensive audit logging, and tenant isolation to reduce exposure and ensure multi-tenant safety.

Core Features & Use Cases

  • RBAC with server-side enforcement for admin operations.
  • CSRF protection and token management to prevent cross-site request forgery.
  • Content Security Policy (CSP) with nonce-based scripts to guard against XSS.
  • Audit logging with redaction and context capture for compliance.
  • Tenant isolation with automatic data scoping and cross-tenant prevention.
  • Guidance for secure admin UI and API integration in multi-tenant apps.

Quick Start

Protect an admin API endpoint by enabling RBAC, CSRF, and audit logging.

Frequently Asked Questions about security-best-practices

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement RBAC and tenant isolation in a multi-tenant Next.js app?

Role-based access control and tenant isolation in a multi-tenant Next.js app are implemented via server-side permission enforcement and automatic data scoping to prevent cross-tenant access. This ensures admin operations are restricted to authorized users within their specific tenant context.

What's the best way to add CSRF protection and CSP to Next.js 16 App Router?

Adding CSRF protection and CSP to Next.js 16 App Router is best handled through automated token management and nonce-based script execution. This approach prevents cross-site request forgery and guards against XSS by validating request origins and restricting script sources.

How does audit logging with redaction work for compliance in SaaS applications?

Audit logging with redaction for compliance works by capturing operational context while automatically masking sensitive data fields. This ensures comprehensive activity tracking for enterprise SaaS applications without exposing confidential user or tenant information in the stored logs.

Does this enterprise security approach support both API routes and client-side integration?

Yes, this enterprise security approach supports both API routes and client-side integration within Next.js 16 applications. It covers secure admin UI interactions and server-side endpoint protection to ensure comprehensive security across all multi-tenant SaaS surfaces.

Why do I need nonce-based Content Security Policy for admin panels?

Nonce-based Content Security Policy is needed for admin panels to dynamically validate trusted scripts and effectively guard against XSS attacks. By generating unique tokens per request, it prevents unauthorized inline scripts from executing in secure enterprise environments.