Hrithik.Security.Headers
1.0.0
dotnet add package Hrithik.Security.Headers --version 1.0.0
NuGet\Install-Package Hrithik.Security.Headers -Version 1.0.0
<PackageReference Include="Hrithik.Security.Headers" Version="1.0.0" />
<PackageVersion Include="Hrithik.Security.Headers" Version="1.0.0" />
<PackageReference Include="Hrithik.Security.Headers" />
paket add Hrithik.Security.Headers --version 1.0.0
#r "nuget: Hrithik.Security.Headers, 1.0.0"
#:package Hrithik.Security.Headers@1.0.0
#addin nuget:?package=Hrithik.Security.Headers&version=1.0.0
#tool nuget:?package=Hrithik.Security.Headers&version=1.0.0
π Hrithik.Security.Headers
Strongly-typed, validated, and standardized handling of security-relevant HTTP headers for .NET applications.
Designed for fintech, banking, microservices, and zero-trust architectures where consistency, traceability, and security are mandatory.
β¨ Why this package?
In most ASP.NET Core applications:
HTTP headers are accessed using magic strings
Security-critical headers are not validated consistently
Correlation, idempotency, and tenant context are scattered across controllers
Downstream services receive incomplete or inconsistent metadata
Hrithik.Security.Headers solves this by providing a single, strongly-typed source of truth for all security-relevant headers.
π Key Features
β Strongly-typed security headers model
β Centralized header extraction & validation
β ASP.NET Core middleware integration
β Options-driven enforcement (fail-fast)
β Fintech & banking friendly
β Clean foundation for audit logging, idempotency & signing
π¦ Installation dotnet add package Hrithik.Security.Headers
π§ Supported Headers Header Purpose X-Correlation-Id Distributed request tracing X-Request-Id Unique request identification Idempotency-Key Prevent duplicate processing X-API-Key Client / service authentication X-Tenant-Id Multi-tenant isolation X-Actor-Id User or service identity X-Client-IP Original caller IP X-Signature Request signing / integrity π§© Core Concept
This package extracts all security-relevant headers once, validates them, and exposes them as a single immutable model for the entire request lifecycle.
If a request passes the middleware, downstream components can trust the headers.
βοΈ Configuration 1οΈβ£ Register services builder.Services.AddSecurityHeaders(options β { options.RequireCorrelationId = true; options.GenerateIfMissing = true; options.EnforceIdempotencyKey = false; options.EnforceTenant = false; options.EnforceSignature = false; });
2οΈβ£ Enable middleware app.UseSecurityHeaders();
Place this early in the pipeline, before authentication, authorization, and logging.
π§ͺ Usage Example Access headers anywhere in the request var headers = HttpContext.Items["SecurityHeaders"] as SecurityHeaders;
_logger.LogInformation( "Request {RequestId} from actor {ActorId}", headers?.RequestId, headers?.ActorId );
π‘ Validation Behavior
Missing required headers β request is rejected
Validation failures throw SecurityException
Designed for fail-fast security enforcement
Example failures:
Missing X-Correlation-Id
Missing X-Tenant-Id (when enforced)
Missing Idempotency-Key (when enforced)
π Architecture Incoming Request β SecurityHeadersMiddleware β ISecurityHeadersReader β SecurityHeaders (strongly-typed) β ISecurityHeadersValidator β HttpContext.Items["SecurityHeaders"] β Controllers / Services / Logging
π Ecosystem Integration
This package is intentionally lightweight and acts as a foundation for:
Hrithik.Security.AuditLogging
Hrithik.Security.Idempotency
Hrithik.Security.RequestSigning
Hrithik.Security.Correlation
Hrithik.Security.TenantIsolation
π Security Philosophy
No silent defaults for security-critical headers
Explicit configuration over implicit behavior
Fail-fast on invalid or missing data
Separation of concerns (headers β auth β logging)
π License
MIT License
π€ Author
Hrithik Kalra
.NET | API Security | Fintech Systems
π§ Email: hrithikkalra11@gmail.com
GitHub: https://github.com/hrithikalra
LinkedIn: https://www.linkedin.com/in/hrithik-kalra-b6836a246/
If you find this package useful, consider supporting its development:
- β Buy Me a Coffee: https://www.buymeacoffee.com/alkylhalid9
- β€οΈ GitHub Sponsors: https://github.com/sponsors/hrithikalra
Support is entirely optional and helps sustain ongoing development and maintenance.
π Related Packages
This package is part of the Hrithik.Security ecosystem:
Hrithik.Security.ApiKeyManagement
API key generation, storage, and scope-based authorizationHrithik.Security.RequestSigning
HMAC-based request signing for tamper-proof APIsHrithik.Security.ReplayProtection
Short-window replay attack preventionHrithik.Security.RateLimiting
Flexible, API-keyβaware rate limiting for ASP.NET Core APIsHrithik.Security.Idempotency Idempotency-keyβbased protection for safe retries in financial APIs
Hrithik.Security.Jose JWT and JWS utilities for secure token handling and message signing
Hrithik.Security.AuditLogging Compliance-grade, tamper-evident audit logging for .NET APIs
Together, they form a complete API security framework.
These packages are independent and can be used together or individually.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- Microsoft.AspNetCore.Http.Abstractions (>= 2.3.9)
- Microsoft.Extensions.Options (>= 10.0.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0 | 125 | 2/5/2026 |