
Security News
CVE Volume Surges Past 48,000 in 2025 as WordPress Plugin Ecosystem Drives Growth
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.
InputSanitizer is a filter used to clear all illegal strings from the data received by the API or MVC Controller.
It is based on HtmlSanitizer as an HTML-related cleaner, and also adds Regex pattern matching cleanup.
It supports data model binding in DTO mode and also supports dynamic types based on Json.
Add InputSanitize to ServiceCollection with policy in Program.cs
var policy = new InputSanitizerPolicy()
{
Name = "Default",
AllowedTags = new HashSet<string>(HtmlSanitizerDefaults.AllowedTags, StringComparer.OrdinalIgnoreCase),
AllowedSchemes = new HashSet<string>(HtmlSanitizerDefaults.AllowedSchemes, StringComparer.OrdinalIgnoreCase),
AllowedAttributes = new HashSet<string>(HtmlSanitizerDefaults.AllowedAttributes, StringComparer.OrdinalIgnoreCase),
UriAttributes = new HashSet<string>(HtmlSanitizerDefaults.UriAttributes, StringComparer.OrdinalIgnoreCase),
AllowedCssProperties = new HashSet<string>(HtmlSanitizerDefaults.AllowedCssProperties, StringComparer.OrdinalIgnoreCase),
AllowedAtRules = new HashSet<CssRuleType>(HtmlSanitizerDefaults.AllowedAtRules),
AllowedCssClasses = new HashSet<string>(HtmlSanitizerDefaults.AllowedClasses),
ExceptionMessage = "What are you doing?",
InvalidInputBehaviour = InvalidInputBehaviour.SetModelState
}
builder.Services.AddInputSanitizer(InputSanitizerPolicies.Policies);
Add To the Controller
[ApiController]
[Route("[controller]")]
[SanitizeAllInputFilter(PolicyName = "Default")] // this line HERE
public class WeatherForecastController : ControllerBase
{
private readonly ILogger<WeatherForecastController> _logger;
public WeatherForecastController(ILogger<WeatherForecastController> logger)
{
_logger = logger;
}
[HttpPost(Name = "PostWeatherForecast")]
public IActionResult Post(DTOModel data) // OR public IActionResult Post(dynamic data)
{
if (!ModelState.IsValid)
{
return UnprocessableEntity(ModelState);
}
return Ok(data);
}
}
FAQs
Package Description
We found that inputsanitizer demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.

Security News
Socket CEO Feross Aboukhadijeh joins Insecure Agents to discuss CVE remediation and why supply chain attacks require a different security approach.

Security News
Tailwind Labs laid off 75% of its engineering team after revenue dropped 80%, as LLMs redirect traffic away from documentation where developers discover paid products.