Rite.InputSanitizer
1.0.1
See the version list below for details.
dotnet add package Rite.InputSanitizer --version 1.0.1
NuGet\Install-Package Rite.InputSanitizer -Version 1.0.1
<PackageReference Include="Rite.InputSanitizer" Version="1.0.1" />
<PackageVersion Include="Rite.InputSanitizer" Version="1.0.1" />
<PackageReference Include="Rite.InputSanitizer" />
paket add Rite.InputSanitizer --version 1.0.1
#r "nuget: Rite.InputSanitizer, 1.0.1"
#:package Rite.InputSanitizer@1.0.1
#addin nuget:?package=Rite.InputSanitizer&version=1.0.1
#tool nuget:?package=Rite.InputSanitizer&version=1.0.1
.NET 8 Input Sanitizer Library
A lightweight and extensible input sanitization library for .NET 8 projects. This library provides attributes and filters to automatically sanitize user input, helping to prevent injection attacks and ensure data integrity.
Features
- Attribute-based input sanitization for models and strings
- Action filter for automatic request sanitization in ASP.NET Core controllers
- Enum support for specifying sanitization modes
Installation
dotnet add package Rite.InputSanitizer
Usage
1. Apply the SanitizerAttribute
Decorate your model properties or parameters with the [Sanitizer]
attribute to enable automatic sanitization.
[ApiController]
[Route("[controller]")]
public class SampleController : ControllerBase
{
[HttpPost("submit")]
[Sanitizer(SanitizeType.Xss | SanitizeType.Sql)]
public IActionResult Submit([FromForm] SampleModel model) { // The model properties are sanitized according to the specified types
...
}
}
2. Use the SanitizerFilter
in Controllers
Apply the SanitizerFilter
to your ASP.NET Core controllers or actions to sanitize incoming requests.
builder.Services.AddScoped<SanitizerFilter>();
3. String Support
Use values from SanitizeType
to specify different sanitization modes or options as needed.
var sanitizedMessage = Sanitizer.Sanitize(message, SanitizeType.Sql | SanitizeType.Xss);
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.Mvc (>= 2.3.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.