<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -55,6 +55,7 @@ module Network.Gitit.Handlers (
 where
 import Safe
 import Data.FileStore
+import Data.FileStore.Utils (isInsideDir)
 import Network.Gitit.Server
 import Network.Gitit.Framework
 import Network.Gitit.Layout
@@ -198,11 +199,17 @@ uploadFile = withData $ \(params :: Params) -&gt; do
                       if e == NotFound
                          then return False
                          else throwIO e &gt;&gt; return True
+  inStaticDir &lt;- liftIO $
+                  (repositoryPath cfg &lt;/&gt; wikiname) `isInsideDir` staticDir cfg
+  inTemplatesDir &lt;- liftIO $
+                  (repositoryPath cfg &lt;/&gt; wikiname) `isInsideDir` templatesDir cfg
   let imageExtensions = [&quot;.png&quot;, &quot;.jpg&quot;, &quot;.gif&quot;]
   let errors = validate
                  [ (null . filter (not . isSpace) $ logMsg,
                     &quot;Description cannot be empty.&quot;)
                  , (null origPath, &quot;File not found.&quot;)
+                 , (inStaticDir,  &quot;Destination is inside static directory.&quot;)
+                 , (inTemplatesDir,  &quot;Destination is inside templates directory.&quot;)
                  , (not overwrite &amp;&amp; exists, &quot;A file named '&quot; ++ wikiname ++
                     &quot;' already exists in the repository: choose a new name &quot; ++
                     &quot;or check the box to overwrite the existing file.&quot;)</diff>
      <filename>Network/Gitit/Handlers.hs</filename>
    </modified>
    <modified>
      <diff>@@ -109,7 +109,7 @@ Executable           gitit
                      pandoc &gt;= 1.2, process, filepath, directory, mtl, cgi,
                      network, old-time, highlighting-kate, bytestring,
                      utf8-string, SHA &gt; 1, HTTP, HStringTemplate, random,
-                     network &gt;= 2.1.0.0, recaptcha &gt;= 0.1, filestore &gt;= 0.3.2,
+                     network &gt;= 2.1.0.0, recaptcha &gt;= 0.1, filestore &gt;= 0.3.3,
                      datetime, zlib, url, happstack-server &gt;= 0.3.3 &amp;&amp; &lt; 0.4,
                      happstack-util &gt;= 0.3.2 &amp;&amp; &lt; 0.4, xml &gt;= 1.3.4,
                      hslogger &gt;= 1 &amp;&amp; &lt; 1.1, ConfigFile &gt;= 1, feed &gt;= 0.3.6,</diff>
      <filename>gitit.cabal</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>b054ec6bd2008a75108d33f0dd06447f1f2ba5f8</id>
    </parent>
  </parents>
  <author>
    <name>John MacFarlane</name>
    <email>jgm@berkeley.edu</email>
  </author>
  <url>http://github.com/jgm/gitit/commit/f6161477f5f2dd381c4e80b357eed933fca04c42</url>
  <id>f6161477f5f2dd381c4e80b357eed933fca04c42</id>
  <committed-date>2009-11-06T19:24:25-08:00</committed-date>
  <authored-date>2009-11-06T19:20:50-08:00</authored-date>
  <message>Check to make sure uploaded files don't go in static or templates dir.

(Which is possible when these are inside repositoryDir...)

Reason:  We don't want users uploading new CSS, javascript,
or templates that might break the site.

Also require filestore &gt;= 0.3.3.</message>
  <tree>8aef13d94ce284f507f26b747f959d84edbc656a</tree>
  <committer>
    <name>John MacFarlane</name>
    <email>jgm@berkeley.edu</email>
  </committer>
</commit>
