-
Notifications
You must be signed in to change notification settings - Fork 246
Open
Labels
Description
Hi,
As issues had not received feedback here and the latest commit 3 years ago, I went ahead to make a fork and publish it as @brettz9/node-static.
Besides making a few of my own changes:
- (Breaking change) npm: Set
engines
to 10.11.0+ (allowing native URL to fix an issue and better flexibility in language features) - Security Update/fix: Use
URL
constructor over deprecatedurl.parse
;
should fix Open Redirect issue https://www.npmjs.com/advisories/1207 - Optimization: 'use strict' directive
- Refactoring: Use safer non-prototype version of
colors
- (Also some plain, dev-facing changes; see our
CHANGES.md
)
...the fork also incorporates the following, indicating also the PR numbers here that they close:
User-facing
- Security: Fix dependency vulnerabilities by switching from
optimist
to
neodoc
(@fidian); Fix vulnerabilities found with npm audit #222 - Security update:
mime
andcolors
(@fidian); Fix vulnerabilities found with npm audit #222 - Security update/fix: Protect
fs.stat
calls from bad path arguments; fixes
Denial of Service issue https://www.npmjs.com/advisories/1208
(@brpvieira); Protect fs.stat calls from invalid path arguments #223; also avoids need for Prevent DoS attack #213 - Fix: Support
bytes=0-0
Range header (@prajwalkman); Properly handle "bytes=0-0" range header #167 - Fix: Avoid octal (@bgao / @Ilrilan); Fix issue of 'Octal literals are not allowed in strict mode' #187, Fix: octal literals are not allowed in strict mode #215 ; also avoids need for Octal literals are not allowed in strict mode, passed string to parseInt method #155
- Fix: For
spa
, allow dots after path (@gjuchault); fix(spa): parse URL before matching files for 404 #204 - Enhancement: Allow access with local ip (@flyingsky); fix bug, cannot access with local ip #139 #140
- Enhancement: Allow
serverInfo
to benull
(@martindale); Allow Removal ofServer
Header #150 - Enhancement: Time display logging with leading 0 (@mauris); added zero leading time display for console log #154
- Enhancement: Respect static
--cache 0
(@matthew-andrews); Respect static --cache 0 #138 - Enhancement: New option:
defaultExtension
(@fmalk); New option: defaultExtension #173 - Enhancement: Added glob matching for setting cache headers (@lightswitch05); Added glob matching feature for setting cache headers. #183
- Docs: Fix header example (@emmanouil); fixed "headers" example in README #156
- Docs: Sp. (@EdwardBetts); correct spelling mistake #194
Dev-facing
- Testing: Allow tests to end (@fmalk); New option: defaultExtension #173
I also made some updates/improvements to the PRs:
- Expanded the
fs.stat
checking, adding one beyond that covered in the originalfs.stat
PR (Protect fs.stat calls from invalid path arguments #223), and covering the newly-added one in thedefaultExtension
PR (New option: defaultExtension #173). - Updated
minimatch
(Added glob matching feature for setting cache headers. #183) - I avoided the Travis addition, as figured might use GitHub Actions if someone wants to do so.
These remaining prexisting PRs were not fully incorporated:
- [#188] Allow disabling of cache #189 - the PR for Respect static --cache 0 #138 allowed for disabling of cache already; if you still want the
f
andfalse
aliases, feel free to file an issue - read content-type from response #184 - Looked like there were concerns
- Improvements for README. #177 on README improvements; I figure some would be good, but would like to continue showing output and keeping headings (useful in navigation for users of HeadingsMap type browser add-ons, as well as for accessibility in general)
- Renaming
static
tonodeStatic
#172 - There is no longer a need for avoiding the reservedstatic
keyword, as I renamed the examples (to usestatik
). - [writeHead] survive if http.serverResponse.writeHead() re-defined #166 - I guess we could protect overwrites to
writeHead
, but what's to prevent someone from rewritingsetHeader
? If it's a common enough use case to overwritewriteHead
, I could add the preventative measure, esp. with a test.
Remaining steps:
- The Unauthorized File Access issue https://www.npmjs.com/advisories/1206 does not appear to be an issue per testing (if it ever was); if you can provide a test case where it fails, please report
- I've added
nyc
for coverage, but I'm not sure that withvows
, we can do binary file testing. I'm thinking whether we should switch tomocha
for this (I prefer that to jest for the ecosystem). Ideally we'd get to full coverage, including the binary.
lightswitch05, fmalk, tschmidtnimble, mauris and piprett