Security Best Practices

The provided text is empty. Cannot determine tagline from nothing.

Updated Jan 26, 2026
One-click install
npx skills add https://github.com/theofernandezz/ai-library --skill security-best-practices-theofernandezz
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Security Best Practices
Source: https://github.com/theofernandezz/ai-library/tree/main/.opencode/skills/generic/security
Command: npx skills add https://github.com/theofernandezz/ai-library --skill security-best-practices-theofernandezz

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Security patterns for SaaS applications: input validation, XSS/CSRF prevention, auth, and secure headers.

Core Features & Use Cases

  • Enforces input validation, secure authentication checks, and robust security headers across services.
  • Provides ready-to-use templates and guidance for common SaaS security scenarios, including multi-tenant data access and session management.
  • Use Case: A SaaS product processes user input securely and defends against XSS/CSRF while maintaining user sessions.

Quick Start

Review the security modules in lib/security (csrf.ts, rate-limit.ts, sanitize.ts) and wire them into your app's middleware and server actions to start enforcing best practices.

Frequently Asked Questions about Security Best Practices

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

FAQPage Schema
How do I prevent XSS and CSRF vulnerabilities in a SaaS application?

To prevent XSS and CSRF in a SaaS app, enforce input validation, apply sanitization, and wire CSRF protection modules into your middleware and server actions to secure user data and sessions.

What are the best practices for securing authentication and session cookies?

Secure authentication and session cookies by enforcing role-based access controls and applying secure cookie configurations across your application routes, APIs, and middleware to maintain defense-in-depth.

How do I implement input validation for multi-tenant SaaS architectures?

Implement input validation for multi-tenant SaaS architectures by applying secure coding patterns to server actions and APIs, ensuring user input is sanitized before processing sensitive data across routes.

Can I use these security patterns with my existing backend middleware?

Yes, you can integrate these security patterns with existing backend middleware by wiring ready-to-use modules for rate limiting, sanitization, and CSRF protection directly into your application's request lifecycle.

What's the best way to configure secure HTTP headers for web apps?

The best way to configure secure HTTP headers is to enforce robust security header patterns across your services and middleware, reducing security risks for sensitive data transmission in SaaS architectures.

How do I enforce role-based access controls across API routes and server actions?

Enforce role-based access controls by applying secure authentication checks across your backend middleware, APIs, and server actions to ensure defense-in-depth for sensitive data and multi-tenant access.