security-principles
Security best practices for the Exceptionless codebase. Secrets management, input validation, secure defaults, and avoiding common vulnerabilities. Keywords: security, secrets, encryption, PII, logging, input validation, secure defaults, environment variables, OWASP, cryptography
安装与使用
请根据来源仓库和你的 AI 工具说明安装此技能。先阅读技能文件和依赖要求,再添加到工作流。
查看来源 ↗使用指南技能说明
Security Principles
Secrets Management
Secrets are injected via Kubernetes ConfigMaps and environment variables — never commit secrets to the repository.
-
Configuration files — Use
appsettings.ymlfor non-secret config -
Environment variables — Secrets injected at runtime via
EX_*prefix - Kubernetes — ConfigMaps mount configuration, Secrets mount credentials
// AppOptions binds to configuration (including env vars)
public class AppOptions
{
public string? StripeApiKey { get; set; }
public AuthOptions Auth { get; set; } = new();
}
Validate All Inputs
- Check bounds and formats before processing
- Use
ArgumentNullException.ThrowIfNull()and similar guards - Validate early, fail fast
Sanitize External Data
- Never trust data from queues, caches, user input, or external sources
- Validate against expected schema
- Sanitize HTML/script content before storage or display
No Sensitive Data in Logs
- Never log passwords, tokens, API keys, or PII
- Log identifiers and prefixes, not full values
- Use structured logging with safe placeholders
Use Secure Defaults
- Default to encrypted connections (SSL/TLS enabled)
- Default to restrictive permissions
- Require explicit opt-out for security features
Avoid Deprecated Cryptographic Algorithms
Use modern cryptographic algorithms:
- ❌
MD5,SHA1— Cryptographically broken - ✅
SHA256,SHA512— Current standards
Avoid Insecure Serialization
- ❌
BinaryFormatter— Insecure deserialization vulnerability - ✅
System.Text.Json,Newtonsoft.Json— Safe serialization
Input Bounds Checking
- Enforce minimum/maximum values on pagination parameters
- Limit batch sizes to prevent resource exhaustion
- Validate string lengths before storage
OWASP Reference
Review OWASP Top 10 regularly:
- Broken Access Control
- Cryptographic Failures
- Injection
- Insecure Design
- Security Misconfiguration
- Vulnerable and Outdated Components
- Identification and Authentication Failures
- Software and Data Integrity Failures
- Security Logging and Monitoring Failures
- Server-Side Request Forgery
使用示例
查看来源仓库中的使用示例与配置说明。
查看来源 ↗来源历史
- 收录时间
- 2026-01-20
- 索引更新时间
- 2026-01-26
- Branch
- main
收录与同步日期属于本站记录。源码修改历史请查看来源仓库。
GitHub ↗chat Comments (0)
Sign in to join the discussion and leave a comment.
No comments yet. Be the first to share your thoughts!