[
https://issues.apache.org/jira/browse/STORM-269?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13981627#comment-13981627
]
ASF GitHub Bot commented on STORM-269:
--------------------------------------
Github user d2r commented on a diff in the pull request:
https://github.com/apache/incubator-storm/pull/91#discussion_r12016652
--- Diff: storm-core/src/clj/backtype/storm/daemon/logviewer.clj ---
@@ -30,9 +30,10 @@
[clojure.string :as string])
(:gen-class))
-(defn tail-file [path tail]
+(defn tail-file [path tail root-dir]
(let [flen (.length (clojure.java.io/file path))
skip (- flen tail)]
+ (if (.startsWith path root-dir)
--- End diff --
The string check will not prevent log-dir/../../../../etc/passwd I don't
think.
Can we try something like this?
```
(let [file (.getCanonicalFile (File. LOG-DIR fname))
path (.getCanonicalPath file)]
(if (= (File. LOG-DIR) (.getParentFile file))
```
Indentation looks a little weird too, after the if was added. Not sure if
that's a tabs vs. spaces issue.
> Any readable file exposed via UI log viewer
> -------------------------------------------
>
> Key: STORM-269
> URL: https://issues.apache.org/jira/browse/STORM-269
> Project: Apache Storm (Incubating)
> Issue Type: Bug
> Affects Versions: 0.9.2-incubating
> Reporter: Jared Kuolt
> Assignee: P. Taylor Goetz
> Labels: security
>
> Note: This is actually version 0.9.0.1 but I couldn't choose that in the
> dropdown. I suspect that the problem still exists.
> I found that it's possible to access any readable file on the system via the
> UI worker log viewer. To reproduce, navigate to:
> http://<host:port>/log?file=../../../../../../../../etc/passwd
--
This message was sent by Atlassian JIRA
(v6.2#6252)