* [PATCH] extras/try_gzip_static: require readability on HEAD requests
@ 2015-08-14 21:24 7% Eric Wong
0 siblings, 0 replies; 1+ results
From: Eric Wong @ 2015-08-14 21:24 UTC (permalink / raw)
To: yahns-public
Files may exist and be stat-able, but not readable. Return
a 403 response for non-readable files.
---
| 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
--git a/extras/try_gzip_static.rb b/extras/try_gzip_static.rb
index d562957..4279e65 100644
--- a/extras/try_gzip_static.rb
+++ b/extras/try_gzip_static.rb
@@ -92,7 +92,9 @@ class TryGzipStatic
path = fspath(env) or return r(403)
begin
st = File.stat(path)
- st.file? ? [ path, st ] : r(404)
+ return r(404) unless st.file?
+ return r(403) unless st.readable?
+ [ path, st ]
rescue Errno::ENOENT, Errno::ENOTDIR
r(404)
rescue Errno::EACCES
--
EW
^ permalink raw reply related [relevance 7%]
Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2015-08-14 21:24 7% [PATCH] extras/try_gzip_static: require readability on HEAD requests Eric Wong
Code repositories for project(s) associated with this public inbox
https://yhbt.net/yahns.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).