Skip to content

docs: clarify content-type parser/schema mismatch is outside threat model#6537

Merged
mcollina merged 7 commits intomainfrom
docs/clarify-content-type-validation-threat-model
Mar 11, 2026
Merged

docs: clarify content-type parser/schema mismatch is outside threat model#6537
mcollina merged 7 commits intomainfrom
docs/clarify-content-type-validation-threat-model

Conversation

@mcollina
Copy link
Copy Markdown
Member

@mcollina mcollina commented Feb 27, 2026

Summary

  • Add a new non-vulnerability example to SECURITY.md explaining that content-type parser/schema mismatches (regex parser accepts a content type with no matching schema.body.content key) are an application configuration concern, not a framework vulnerability
  • Add a warning to docs/Reference/Validation-and-Serialization.md explaining that the content map uses exact MIME type matching and how this interacts with regex-based parsers
  • Add a note to docs/Reference/ContentTypeParser.md warning that regex parsers can accept content types that bypass per-content-type validation if the schema content map lacks a matching entry

Context

This addresses reports like the one described in the bug report where a regex-based content-type parser (e.g., /^application\/.*json$/) matches requests with content types like application/v1+json, but the validation schema only has a key for application/json. The parser runs correctly but validation is skipped because the schema lookup is an exact string match. This is by design — schemas and configuration are trusted inputs in Fastify's threat model.

Test plan

  • npm run lint:markdown passes (no new lint errors)
  • Documentation-only change, no code changes

🤖 Generated with Claude Code

…the threat model

When a regex-based content-type parser matches requests that have no
corresponding key in schema.body.content, validation is skipped. This
is an application configuration concern, not a framework vulnerability.

Add documentation in three places:
- SECURITY.md: new non-vulnerability example in the threat model
- Validation-and-Serialization.md: warning about exact-match schema selection
- ContentTypeParser.md: note about validation implications of regex parsers

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@mcollina mcollina requested a review from RafaelGSS February 27, 2026 09:42
@github-actions github-actions bot added the documentation Improvements or additions to documentation label Feb 27, 2026
@mcollina mcollina changed the title docs: clarify that content-type parser/schema mismatches are outside the threat model docs: clarify content-type parser/schema mismatch is outside threat model Feb 27, 2026
Copy link
Copy Markdown
Member

@jsumners jsumners left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good with consistency restored.

mcollina and others added 2 commits February 27, 2026 14:54
Co-authored-by: James Sumners <[email protected]>
Signed-off-by: Matteo Collina <[email protected]>
Co-authored-by: James Sumners <[email protected]>
Signed-off-by: Matteo Collina <[email protected]>
Copy link
Copy Markdown
Member

@Fdawgs Fdawgs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just needs rejigging so it doesn't use second person "you" as noted in our style guide.

Copy link
Copy Markdown
Member

@gurgunday gurgunday left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@github-actions github-actions bot added the github actions Github actions related label Mar 11, 2026
@mcollina
Copy link
Copy Markdown
Member Author

@Fdawgs ptal

@mcollina mcollina merged commit d7f01b6 into main Mar 11, 2026
38 checks passed
@mcollina mcollina deleted the docs/clarify-content-type-validation-threat-model branch March 11, 2026 10:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation github actions Github actions related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants