ConnectHubWebApi.Security 1.0.0

dotnet add package ConnectHubWebApi.Security --version 1.0.0
                    
NuGet\Install-Package ConnectHubWebApi.Security -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ConnectHubWebApi.Security" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ConnectHubWebApi.Security" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="ConnectHubWebApi.Security" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ConnectHubWebApi.Security --version 1.0.0
                    
#r "nuget: ConnectHubWebApi.Security, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package ConnectHubWebApi.Security@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ConnectHubWebApi.Security&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=ConnectHubWebApi.Security&version=1.0.0
                    
Install as a Cake Tool

ConnectHubWebApi.Security 🔐

Camada de segurança reutilizável para APIs do ecossistema Hub / ERP, focada em validação de requisições, prevenção de injeções e proteção básica contra ataques vindos do client sem impacto significativo de performance.

Projetado para uso em microserviços ASP.NET Core (.NET 8), podendo ser consumido via ProjectReference ou NuGet interno.


🎯 Objetivo

Centralizar regras de segurança de entrada de dados em um único pacote, garantindo:

  • Consistência entre microserviços
  • Redução de código duplicado
  • Evolução controlada de políticas de segurança
  • Facilidade de auditoria e manutenção

🧱 O que o Hub.Security faz

  • Validação de QueryString
  • Validação de RouteValues
  • Validação de Body JSON
  • Bloqueio de padrões comuns de:
    • SQL Injection
    • XSS
    • Path Traversal
    • Injeções genéricas
  • Execução via Middleware
  • Configuração centralizada via DI

📌 Não substitui WAF, mas adiciona uma camada defensiva importante dentro da API.


🧩 Estrutura do projeto

Hub.Security ├─ Abstractions │ ├─ IInputValidator │ ├─ IRequestSecurityValidator │ └─ IRequestInspectionPolicy │ ├─ Validators │ ├─ SqlInjectionValidator │ ├─ XssValidator │ ├─ PathTraversalValidator │ └─ GenericInjectionValidator │ ├─ Policies │ └─ DefaultInspectionPolicy │ ├─ Middleware │ └─ SecurityMiddleware │ ├─ Models │ └─ SecurityResult │ ├─ Extensions │ └─ SecurityServiceCollectionExtensions │ └─ Hub.Security.csproj


Instalação

dotnet add package ConnectHubWebApi.Security

Uso

No Program.cs:

//csharp
using ConnectHubWebApi.Security.Extensions;

var builder = WebApplication.CreateBuilder(args);

// Adicione a segurança
builder.Services.AddHubSecurity();

var app = builder.Build();

// Use o middleware de segurança
app.UseHubSecurity();

app.Run();
Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.

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 263 1/28/2026