Security hardening and best practices for .NET applications. Navigation skill covering OWASP Top 10, authentication, authorization, cryptography, secrets management, and secure coding. For building secure applications. Keywords: security, owasp, authentication, authorization, cryptography, jwt, oauth, secrets, hardening
Security hardening and best practices for .NET applications. This meta-skill provides navigation to ~10 security-focused skills covering OWASP Top 10, authentication, authorization, cryptography, secrets management, and secure coding patterns.
Load this skill when:
| Need | Load Skill | Level |
|---|---|---|
| OWASP Top 10 (2021) | dotnet-security-owasp | Advanced |
| Input validation |
dotnet-input-validation |
| Intermediate |
| Security headers | dotnet-security-owasp | Advanced |
| Rate limiting | dotnet-security-owasp | Advanced |
| Need | Load Skill | Level |
|---|---|---|
| API security (JWT, OAuth) | dotnet-api-security | Advanced |
| Blazor auth | dotnet-blazor-auth | Intermediate |
| Passkeys | dotnet-api-security | Advanced |
| Need | Load Skill | Level |
|---|---|---|
| Algorithm selection | dotnet-cryptography | Advanced |
| Encryption/Hashing | dotnet-cryptography | Advanced |
| Key derivation | dotnet-cryptography | Advanced |
| Need | Load Skill | Level |
|---|---|---|
| User secrets | dotnet-csharp-configuration | Intermediate |
| Secret rotation | dotnet-secrets-management | Intermediate |
| Environment variables | dotnet-secrets-management | Intermediate |
API → JWT Bearer (dotnet-api-security)
↓
Web App → OIDC/Cookies (dotnet-api-security)
↓
SPA → BFF pattern (dotnet-api-security)
↓
Mobile → OAuth 2.1 (dotnet-api-security)
| Threat | Mitigation | Skill |
|---|---|---|
| Injection | Parameterized queries | dotnet-security-owasp |
| Broken Access Control | RBAC/ABAC | dotnet-api-security |
| XSS | Output encoding | dotnet-security-owasp |
| Insecure Deserialization | JSON-only | dotnet-security-owasp |
| Security Misconfig | Hardening | dotnet-security-owasp |
| Purpose | Algorithm | Skill |
|---|---|---|
| Symmetric encryption | AES-GCM | dotnet-cryptography |
| Asymmetric encryption | RSA-OAEP | dotnet-cryptography |
| Hashing | SHA-256/SHA-3 | dotnet-cryptography |
| Signatures | ECDSA/RSA-PSS | dotnet-cryptography |
| Password hashing | Argon2id | dotnet-cryptography |
| Key derivation | HKDF | dotnet-cryptography |
dotnet-security-owasp - OWASP Top 10 mitigationdotnet-input-validation - Request validationdotnet-api-security - Identity, OAuth, JWTdotnet-blazor-auth - Blazor auth flowsdotnet-csharp-configuration - User secretsdotnet-cryptography - Algorithms, hashing, encryptiondotnet-secrets-management - Secret managementdotnet-csharp-configuration - Configuration securitydotnet-security-owasp - Deprecated API warningsdotnet-csharp-coding-standards - Secure coding conventions// Server-side validation
var validator = new CreateUserValidator();
var result = await validator.ValidateAsync(request);
if (!result.IsValid)
return Results.ValidationProblem(result.ToDictionary());
// Never trust client input
public sealed class CreateUserRequest
{
[Required, EmailAddress]
public string Email { get; set; } = null!;
[Required, MinLength(12)]
public string Password { get; set; } = null!;
}
// Use user secrets in development
builder.Configuration.AddUserSecrets<Program>();
// Never commit secrets
if (builder.Environment.IsProduction())
{
builder.Configuration.AddAzureKeyVault(...);
}
// Razor encodes by default
@Model.UserInput // HTML encoded
// Manual encoding when needed
var encoded = HtmlEncoder.Default.Encode(userInput);
dotnet-webdotnet-api-designdotnet-architecturedotnet-fundamentals| Header | Purpose | Config |
|---|---|---|
| Content-Security-Policy | XSS prevention | Strict CSP |
| X-Frame-Options | Clickjacking | DENY |
| X-Content-Type-Options | MIME sniffing | nosniff |
| Referrer-Policy | Privacy | strict-origin |
| Permissions-Policy | Feature policy | Minimal |
| Strict-Transport-Security | HTTPS enforcement | Max-age |
| CWE | Issue | Prevention |
|---|---|---|
| CWE-79 | XSS | Output encoding |
| CWE-89 | SQL Injection | Parameterized queries |
| CWE-200 | Info Exposure | Error handling |
| CWE-259 | Hardcoded Password | Secret management |
| CWE-284 | Improper Access Control | Authorization checks |
| CWE-352 | CSRF | Anti-forgery tokens |
| CWE-434 | Unrestricted Upload | File validation |
| CWE-502 | Deserialization | JSON-only, type constraints |