mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #3662] [MERGED] fix(security): handle missing content-type and gzip in safeFetch JSON… #6042
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#6042
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/3662
Author: @Lamboozled
Created: 7/15/2026
Status: ✅ Merged
Merged: 7/15/2026
Merged by: @SpicyMarinara
Base:
staging← Head:fix/safefetch-compressed-json-responses📝 Commits (1)
2d8542dfix(security): handle missing content-type and gzip in safeFetch JSON paths📊 Changes
3 files changed (+3 additions, -1 deletions)
View changed files
📝
packages/server/src/services/bot-browser/fetch-json.ts(+1 -0)📝
packages/server/src/services/capability-packages/package-manager.service.ts(+1 -0)📝
packages/server/src/utils/security.ts(+1 -1)📄 Description
Linked issue
Closes #3660
Why this change
safeFetch'sallowedContentTypesguard used!contentType ||which rejects responses that omit theContent-Typeheader entirely, even when the body is valid content. Card browser API calls (fetchBotBrowserJson) and the capability package catalog both hit this, logging "Outbound response content type is not allowed: " on startup and during browsing.readCappedResponsereads the raw response byte stream viaresponse.body.getReader(), bypassing undici's built-inContent-Encodingdecompression. GitHub raw content (capability catalog) and some card browser APIs return gzip-compressed responses, causingresponse.json()to throw aSyntaxErrorwith raw gzip bytes.What changed
packages/server/src/utils/security.ts— change!contentType ||tocontentType &&in theallowedContentTypesguard so only explicitly wrong content types are rejected; missing headers are allowed throughpackages/server/src/services/bot-browser/fetch-json.ts— adddecodeCompressedResponse: trueso gzip API responses are decompressed before parsingpackages/server/src/services/capability-packages/package-manager.service.ts— adddecodeCompressedResponse: trueto the catalog fetch for the same reasonValidation
pnpm checkpasses locallyCONTRIBUTING.mdManual verification notes
Docs and release impact
Summary by CodeRabbit
Content-Typeheader are no longer rejected unnecessarily.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.