fix: HEAD /list 500 crash when caller has no read permission - #311
Merged
Conversation
getList/getVersionList return {status:403} with no body when caller
has no read permission. head.js destructured body.length unconditionally,
throwing a TypeError that escaped index.js uncaught, producing a raw 500
with no x-error header. Guard body access and catch handler errors in
index.js so 5xx responses always carry x-error.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
buuhuu
approved these changes
Aug 6, 2026
adobe-bot
pushed a commit
that referenced
this pull request
Aug 6, 2026
## [1.14.1](v1.14.0...v1.14.1) (2026-08-06) ### Bug Fixes * HEAD /list 500 crash when caller has no read permission ([#311](#311)) ([5658b63](5658b63))
Collaborator
|
🎉 This PR is included in version 1.14.1 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
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
/list500s over 7 days, none carrying anx-errorheader — root-caused to an uncaughtTypeError.getList/getVersionListreturn{ status: 403 }(nobody) when the caller has neither direct nor descendant read permission.head.jsdestructuredbody.lengthunconditionally, throwing before the request ever reacheddaResp(), so it skippedx-errorentirely.head.jsto guard body access (body?.length ?? 0) for both/listand/versionlist.index.jsin try/catch so any future handler exception is converted todaResp({ status: 500, error }), guaranteeingx-erroron all 5xx responses instead of a raw crash.Test plan
test/handlers/head.test.js(new): reproduces the crash pre-fix, verifies 403 withcontentLength: 0post-fix for both/listand/versionlist, plus a success-path sanity check.test/index.test.js: new case assertingx-errorheader is set when a handler throws unexpectedly.npm test— 494 passing, no regressions.npm run lint— clean.