What problem does it solve?
Overlooking security best practices can expose your project to vulnerabilities like data breaches, unauthorized access, and system compromise. This Skill provides essential security patterns and guidelines, helping you write secure code, manage secrets, and protect against common attacks.
Core Features & Use Cases
- Secure Secret Management: Enforces the use of environment variables for API keys and secrets, with
.gitignore best practices.
- Comprehensive Input Validation: Guides on preventing path traversal, command injection, and SQL injection.
- File Operations Security: Best practices for secure file permissions and validating file uploads.
- Use Case: When integrating a new external API, this Skill reminds you to load API keys from environment variables, validate the API key format, and ensure no secrets are accidentally logged, significantly reducing security risks.
Quick Start
Load API key from .env (must be gitignored!)
import os
from dotenv import load_dotenv
load_dotenv()
api_key = os.getenv("ANTHROPIC_API_KEY")
Prevent path traversal:
from pathlib import Path
base_dir = Path("/data")
file_path = (base_dir / filename).resolve()
if not file_path.is_relative_to(base_dir):
raise ValueError("Path traversal detected")