• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

tinyhttp / tinyhttp / 29657149946
99%

Build:
DEFAULT BRANCH: master
Ran 18 Jul 2026 07:06PM UTC
Jobs 2
Files 44
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

18 Jul 2026 07:06PM UTC coverage: 99.489% (+0.002%) from 99.487%
29657149946

push

github

web-flow
fix(send): prevent DoS via malformed Range header (GHSA-w65r-fqv6-q6w9) (#512)

* fix(send): prevent DoS via malformed Range header (GHSA-w65r-fqv6-q6w9)

An inverted range such as 'bytes=10-5' passed the bounds check (both
offsets within the file), produced a negative Content-Length, and made
createReadStream throw ERR_OUT_OF_RANGE synchronously *after* the 206
headers were committed. The default onError handler then called
writeHead on the already-sent response, raising an uncaught
ERR_HTTP_HEADERS_SENT that crashed the process. A single unauthenticated
request could take down any server using res.sendFile.

- send: parse Range with an anchored regex and reject malformed,
  inverted (end < start), or out-of-bounds ranges with 416 before any
  headers are written. Also fixes the 'bytes=1-0' case where end parsed
  as falsy and silently fell back to stats.size - 1.
- app: onErrorHandler bails out (destroys the socket) when headersSent,
  as defense-in-depth against any handler throwing after headers.

Adds regression tests for bytes=10-5, bytes=1-0 and bytes=abc-def
(all now 416) and a test asserting the server survives a handler that
throws after committing headers.

* refactor(send): use header-range-parser for Range parsing

Replace the hand-rolled Range parser with header-range-parser (already a
transitive dependency of @tinyhttp/app via @tinyhttp/req; the same pin
1.1.4). It's a maintained fork of the parser Express uses and never
yields an inverted range, so it structurally eliminates the negative
Content-Length -> createReadStream crash class (GHSA-w65r-fqv6-q6w9)
rather than special-casing individual malformed inputs.

Behavior notes:
- bytes=10-5 / bytes=1-0 / bytes=abc-def -> 416 (unsatisfiable), no crash
- bytes=0-666 now clamps to 0-10 and serves 206 (RFC-correct) instead of
  416; a start beyond EOF (bytes=666-777) still returns 416
- malformed (no '=') and multi-range requests fall back to a 200 full
  response

Updates the out-of-range ... (continued)

1013 of 1022 branches covered (99.12%)

Branch coverage included in aggregate %.

15 of 15 new or added lines in 2 files covered. (100.0%)

1322 of 1325 relevant lines covered (99.77%)

175.84 hits per line

Jobs
ID Job ID Ran Files Coverage
1 29657149946.1 18 Jul 2026 07:06PM UTC 44
99.49
GitHub Action Run
2 29657149946.2 18 Jul 2026 07:06PM UTC 44
99.49
GitHub Action Run
Source Files on build 29657149946
  • Tree
  • List 44
  • Changed 2
  • Source Changed 0
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • 7f6bdf7f on github
  • Prev Build on master (#29643495249)
  • Next Build on master (#29658001347)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc