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.



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to