Add request-scanning middleware, harden filter, rebrand to SpitFire#15
Merged
Conversation
- Skip null action arguments and null collection items instead of throwing (optional/unbound parameters no longer 500 the request) - Add reference-based, path-scoped cycle detection so cyclic object graphs terminate instead of stack-overflowing at the default infinite recursion depth - Read each property value once instead of up to three GetValue calls - Cache PropertyInfo per type to avoid re-reflecting on every request - Guard AttributeRouteInfo for convention-routed controllers - Wire up the previously-dead WhiteListEntry.ExclusionPattern Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Adds PayloadInjectionMiddleware as an alternative to the MVC action filter. It runs before model binding and scans the raw query string and request body, so it covers minimal APIs, Razor Pages and gRPC in addition to MVC controllers. - AddPayloadInjectionMiddleware / UsePayloadInjectionMiddleware helpers - Method gating, per-path exclusions, query/body scan toggles - URL-decodes the query string to catch percent-encoded payloads - Buffers and rewinds the body so downstream endpoints can re-read it - Rejects bodies larger than MaxScannedBodyBytes with 413 - Unit tests covering body/query short-circuit, rewind, exclusions, custom responses and the oversized-body path Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Renames the namespace (Zone24x7PayloadExtensionFilter -> SpitFirePayloadExtensionFilter), the NuGet PackageId (Zone24x7.PayloadInjectionFilter -> SpitFire.PayloadInjectionFilter) and the company metadata. Version bumped to 0.1.0 for the new middleware feature. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Add filter-vs-middleware comparison and middleware usage section - Document the now-functional ExclusionPattern - Add a scope note framing the library as defense-in-depth, not a replacement for output encoding, parameterized queries or a WAF - Add a reliability-notes section (cycle safety, null handling, caching) - Sync the packaged NuGet README with the root README Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The long-lived NUGET_API_KEY was revoked; nuget.org now recommends keyless publishing via short-lived OIDC tokens. - Use NuGet/login@v1 to exchange a GitHub OIDC token for a temporary API key (requires id-token: write and a NUGET_USER secret) - Publish on push to main (merge) instead of on every pull_request, which previously republished the same version and failed - Add --skip-duplicate so re-runs without a version bump don't fail - Bump checkout/setup-dotnet to v4 Requires a one-time Trusted Publishing policy on nuget.org pointing at this repo and the dotnet-publish.yml workflow file. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Adds `environment: release` to the publish job so a GitHub environment (with optional required reviewers) governs publishing. The environment name should also be set on the nuget.org Trusted Publishing policy. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a middleware-based alternative to the MVC action filter, fixes several latent crash/perf bugs in the existing filter, and rebrands the package from Zone24x7 to SpitFire.
Filter hardening
GetValuecallsPropertyInfoper type to avoid re-reflecting on every requestAttributeRouteInfofor convention-routed controllersWhiteListEntry.ExclusionPatternNew: request-scanning middleware
PayloadInjectionMiddlewareruns before model binding and scans the raw query string and request body, so it covers minimal APIs, Razor Pages and gRPC in addition to MVC controllers.AddPayloadInjectionMiddleware/UsePayloadInjectionMiddlewarehelpersMaxScannedBodyByteswith 413Rebrand
Zone24x7PayloadExtensionFilter→SpitFirePayloadExtensionFilterZone24x7.PayloadInjectionFilter→SpitFire.PayloadInjectionFilter0.1.0Docs
ExclusionPatternTests
31 → 41 passing. New tests cover null arguments, cyclic graphs,
ExclusionPattern, and the full middleware surface (body/query short-circuit, body rewind, method gating, path exclusion, custom response, oversized 413).🤖 Generated with Claude Code