- Can be hosted in-app
- Blazing-fast, as it is built on top of new .NET Core primitives
- Extensibility, easy to author new rules
- Easy deployment to the cloud, to the edge, or even on-premise
- Application Insights integration
- Protocol validation
- Information disclosure
- Cross-Site Scripting (XSS, Reflected)
- Popular scanners & bots
- Blacklist
- Augment: Rewrite references to HTTPS
- Augment: Antiforgery (CSRF)
- Augment: Sub-Resource Integrity
You can easily add the WAF middleware to the HTTP pipeline:
public void ConfigureServices(IServiceCollection services)
{
services.AddWebApplicationFirewall(); // setup
}
public void Configure(IApplicationBuilder app)
{
app.UseWebApplicationFirewall(); // add middleware
// add any other application logic behind it
app.UseStaticFiles();
app.UseMvc();
}
You can implement rules by implementing the IRequestInspector
or IResponseInspector
interfaces.
public void Inspect(RequestAnalysisContext context)
{
if (context.Request.Path.StartsWith("/secret"))
{
context.ReportDiagnostic(new Diagnostic(Rule, Location.Path));
}
}
View Authoring Rules for full documentation.
You can host it as a standalone reverse proxy as well, by proxying all requests after the WAF has inspected them. You can configure the rules by adding individual packages.
public void ConfigureServices(IServiceCollection services)
{
services.AddWebApplicationFirewall()
.AddDrupal() // add rule set
.AddWordPress() // add rule set
;
}
public void Configure(IApplicationBuilder app)
{
app.UseWebApplicationFirewall();
app.UseProxy();
}
Requirements:
- .NET Core 3.0 Runtime
- Windows or Linux that is supported by .NET Core
Configuration of the Firewall is under the Firewall
configuration section.
Mode
Detection
only detects potential attacks.Prevention
(default) not only detects, but prevents potential attacks.
DeniedResponseStatusCode
(default:403
) status code to set on a denied request.Depth
FindFirst
(default) stops analysis after detecting the first positive result.FindAll
collects all findings about a given request-response pair.
IncludedTags
white list rules based on tags. No other rules are evaluated.ExcludedTags
black list rules based on tags. All other rules are evaluated.
Configuration of the reverse proxy middleware is under the Proxy
configuration section.
Scheme
request scheme to use (default:https
)Host
hostname to send as originPort
destination port (default: 443)
Create a Web App in Azure and deploy the code.
- Web sockets are not supported yet.
- Serving large files as we have to inspect them may consume resources.
- The middleware buffers requests and responses, so it can inspect them.