Skip to content

Validate declared MIME types - #160

Merged
jeremy merged 1 commit into
security/robust-io-sniffingfrom
security/strict-declared-type
Aug 19, 2026
Merged

jeremy merged 1 commit into
security/robust-io-sniffingfrom
security/strict-declared-type

Conversation

@jeremy

@jeremy jeremy commented Aug 13, 2026 •

Copy link
Copy Markdown
Member

Stacked on #159.

Declared types now accept one well-formed media type with optional parameters. Malformed values, comma-separated lists, invalid encodings, and values larger than 8 KiB are ignored so detection can continue with the other inputs.

A single trailing semicolon remains accepted for compatibility. A valid but unregistered media type is still returned by design.

Local validation: bundle exec ruby -Itest test/declared_type_test.rb.

@jeremy
jeremy force-pushed the security/strict-declared-type branch from 14c84c4 to a78be60 Compare August 18, 2026 09:36
@jeremy
jeremy changed the base branch from main to security/robust-io-sniffing August 18, 2026 09:36
@jeremy
jeremy force-pushed the security/strict-declared-type branch from a78be60 to ba0e17c Compare August 18, 2026 09:37
@jeremy jeremy changed the title Parse declared types strictly Validate declared MIME types Aug 18, 2026
@jeremy
jeremy force-pushed the security/strict-declared-type branch from ba0e17c to 5f02592 Compare August 18, 2026 09:40
Accept one well-formed media type with optional parameters, ignore malformed or oversized values, and preserve the common trailing-semicolon form. Invalid values fall back to the other detection inputs.
@jeremy
jeremy force-pushed the security/strict-declared-type branch from 5f02592 to 3ae4fd1 Compare August 18, 2026 18:28
@jeremy
jeremy merged commit 1b76b14 into main Aug 19, 2026
24 checks passed
@jeremy
jeremy deleted the security/strict-declared-type branch August 19, 2026 20:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant