Configures ABP ASP.NET Core CSRF protection (antiforgery tokens, auto-validation) and response security headers (CSP, script nonces).
Ships in abp-runtime. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
ABP's web-request security has two separate paths: MVC antiforgery services/filters validate state-changing browser requests, while AbpSecurityHeadersMiddleware adds response headers and optional Content Security Policy (CSP). Configure and validate both independently.
AbpAspNetCoreMvcModule adds AbpAutoValidateAntiforgeryTokenAttribute to MVC's global filters. The filter calls ASP.NET Core IAntiforgery.ValidateRequestAsync when validation is required and returns AntiforgeryValidationFailedResult on validation failure.
Configure ABP-specific behavior in the host module:
using Volo.Abp.AspNetCore.Mvc.AntiForgery;
Configure<AbpAntiForgeryOptions>(options =>
{
options.AutoValidate = true;
options.AutoValidateFilter = controllerType =>
controllerType.Namespace?.StartsWith("MyCompany.MyProduct") == true;
});
Defaults:
AutoValidate = true.AutoValidateFilter returns true for every controller type.GET, HEAD, TRACE, and OPTIONS.TokenCookie.Name = "XSRF-TOKEN", HttpOnly = false, IsEssential = true, SameSite = None, expiration 3650 days.AuthCookieSchemaName = "Identity.Application".NormalizeUserIdClaimIssuer = true (this option and the AbpAntiforgery wrapper described below are ABP 10.6+; 10.5 has neither).Changing the ignored-method set changes which verbs the automatic filter validates. Do not add a state-changing verb to it.
After the global auto-validation switches and method filter pass, the base ABP filter applies these request rules:
This behavior is cookie/request-based; it is not a replacement for authentication or authorization.
IAbpAntiForgeryManager exposes SetCookie() and GenerateToken():
public class AntiforgeryTokenController : AbpController
{
private readonly IAbpAntiForgeryManager _antiforgeryManager;
public AntiforgeryTokenController(
IAbpAntiForgeryManager antiforgeryManager)
{
_antiforgeryManager = antiforgeryManager;
}
[HttpGet]
public void SetCookie()
{
_antiforgeryManager.SetCookie();
}
}
SetCookie() calls GenerateToken(), then appends the configured token cookie. GenerateToken() returns the request token from IAntiforgery.GetAndStoreTokens.
ABP wraps an implementation-type IAntiforgery registration with AbpAntiforgery so token generation and validation use ABP's claim normalization. A custom factory/instance registration is left unchanged by that wrapping code.
ABP Blazor templates place ASP.NET Core's antiforgery middleware after routing/authentication-related middleware and before endpoint mapping:
app.UseRouting();
app.UseAuthentication();
app.UseAntiforgery();
app.UseAuthorization();
app.UseConfiguredEndpoints();
The simpler hosted WebAssembly template uses UseRouting(), then UseAntiforgery(), then maps Razor components.
AbpBlazorClientHttpMessageHandler reads XSRF-TOKEN and sends it as RequestVerificationToken only for same-host-and-port requests whose method is not GET/HEAD/TRACE/OPTIONS. If a custom client bypasses that handler, it must provide equivalent token transport.
The middleware is opt-in:
using Volo.Abp.AspNetCore.Security;
Configure<AbpSecurityHeadersOptions>(options =>
{
options.Headers["Referrer-Policy"] = "strict-origin-when-cross-origin";
options.UseContentSecurityPolicyHeader = true;
options.ContentSecurityPolicyValue =
"default-src 'self'; object-src 'none'; form-action 'self'; frame-ancestors 'none'";
});
public override void OnApplicationInitialization(
ApplicationInitializationContext context)
{
var app = context.GetApplicationBuilder();
app.UseRouting();
app.UseAbpSecurityHeaders();
app.UseConfiguredEndpoints();
}
Place it after routing so HttpContext.GetEndpoint() and endpoint metadata are available, and before endpoint execution.
Unless the request is excluded, the middleware always adds if absent:
X-Content-Type-Options: nosniffX-XSS-Protection: 1; mode=blockX-Frame-Options: SAMEORIGINEntries in AbpSecurityHeadersOptions.Headers are then added; for those custom entries, an existing response value is overwritten.
UseContentSecurityPolicyHeader and UseContentSecurityPolicyScriptNonce default to false. When CSP is enabled, the middleware handles a request only as CSP-capable HTML when its Accept includes text/html, */*, or application/xhtml+xml and endpoint metadata exists. It writes CSP on response start only for a 2xx response whose content type starts with text/html, and it does not overwrite an existing CSP header.
If ContentSecurityPolicyValue is empty, the fallback is:
object-src 'none'; form-action 'self'; frame-ancestors 'none'
With script nonces enabled, the middleware creates a per-request nonce. MVC/Razor views can render it with:
<script @Html.GetScriptNonceAttribute() src="/js/app.js"></script>
If the configured CSP has no script-src, ABP appends one containing the nonce. If it has script-src, ABP appends the nonce to that directive.
[IgnoreAbpSecurityHeader] on a controller/action endpoint skips this middleware entirely. IgnoredScriptNoncePaths and any IgnoredScriptNonceSelectors that return true also cause an early return, so they skip all three baseline headers and custom headers as well as CSP/nonce processing.
Configure<AbpSecurityHeadersOptions>(options =>
{
options.IgnoredScriptNoncePaths.Add("/external-callback");
});
Despite their names, these option lists are full middleware exclusions. Keep them narrow. The OpenID Connect module adds /signout-oidc to IgnoredScriptNoncePaths.
RequestVerificationToken matches XSRF-TOKEN.UseAbpSecurityHeaders and assert the three baseline headers plus configured custom headers.AutoValidate globally to fix one client — this removes MVC automatic CSRF validation. Fix token issuance/transport or narrowly filter the intended controller.UseAntiforgery() in a Blazor host — follow the verified template order before mapped Razor-component endpoints.UseAbpSecurityHeaders() before routing — endpoint metadata and CSP handling depend on a selected endpoint.GetScriptNonceAttribute() on allowed script tags.IgnoredScriptNoncePaths disables only nonces — it bypasses the entire middleware for the matching request.Content-Security-Policy value.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
csrf-protection, antiforgery, security-headers, csp, dotnet-security
/abp-runtime:secure-web-requestsfrom abp-runtime
npx claudepluginhub abpframework/abp-skills --plugin abp-runtime10 skills in this plugin
/background-jobs-and-eventsIn-process/cross-service events, entity change reactions, deferred/recurring background work. USE FOR: ILocalEventBus / IDistributedEventBus, EntityCreated/Updated/DeletedEventData, [EventName] ETOs, IBackgroundJobManager jobs, AsyncPeriodicBackgroundWorkerBase workers. DO NOT USE FOR: distributed cache/lock (distributed-caching-and-locking); SignalR push (add-signalr-realtime); microservice message contracts (design-module-and-service-communication)./cache-entitiesRead-only single-entity-by-id caching via the generic IEntityCache abstraction (cache to the entity or a DTO), auto-invalidated. USE FOR: AddEntityCache, caching to entity or DTO, batch lookups (FindMany/GetMany), expiration, EntityCacheWithObjectMapper mapping. DO NOT USE FOR: general key/value caching or distributed locks (distributed-caching-and-locking); querying/persisting entities (ef-core-integration or mongodb-integration)./configure-app-urlsNamed application roots and external URLs with AppUrlOptions, resolved tenant-aware via IAppUrlProvider. USE FOR: AppUrlOptions.Applications; RootUrl and named Urls; email links; cross-application links; tenantId and tenantName placeholders; redirect allow-list checks. DO NOT USE FOR: rendering the email body (render-text-templates) or sending it (send-emails); remote service base addresses (consume-remote-services); resolving tenants by domain (configure-multi-tenancy).Other plugins' skills for the same job