intility / intility/json-api-toolkit

Use DI parser in AllowedIncludesAttribute

Open
#134 0 comments 0 reactions 1 assignee View on GitHub

@erlendellefsen is already working on this.

Since Aug 20, 2026.

.NET bug
Dominant language
C#
Stars
7
Forks
0
Avg merge
1d 4h
Merged PRs (30d)
23

Description

AllowedIncludesAttribute.OnActionExecuting (line 64) calls JsonApiQueryParser.Parse directly, bypassing the QueryComplexityAnalyzer.Validate step that runs in IJsonApiQueryParser. Two issues:

  1. Filter limits (count, depth, value length) are not enforced for actions decorated with [AllowedIncludes].
  2. The same request is parsed twice (once in the attribute, once in the controller).

Acceptance criteria

  • Attribute resolves IJsonApiQueryParser from context.HttpContext.RequestServices
  • Parsed QueryParameters is stashed (e.g. on HttpContext.Items) and reused by the controller
  • New test: a request with a filter tree exceeding JsonApiOptions.MaxFilters returns 400 on a [AllowedIncludes] action
  • Existing [AllowedIncludes] integration tests still pass

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.