]> git.donarmstrong.com Git - dak.git/commitdiff
Check if our temp transitions file is in the path we expect it to be in
authorJoerg Jaspert <joerg@debian.org>
Thu, 17 Apr 2008 19:07:21 +0000 (21:07 +0200)
committerJoerg Jaspert <joerg@debian.org>
Thu, 17 Apr 2008 19:07:21 +0000 (21:07 +0200)
ChangeLog
config/debian/dak.conf
dak/transitions.py

index 7c22507c89fec920b91a65817f80e4a7edc59245..b0239f5152a54b875178d89acdbf523d59f79402 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2008-04-17  Joerg Jaspert  <joerg@debian.org>
+
+       * config/debian/dak.conf: Add TempPath statement for the Release
+       Transitions script
+
+       * dak/transitions.py (temp_transitions_file): Use the TempPath
+       (write_transitions_from_file): Check if the file we should get our
+       transitions from is in our TempPath, error out if it isnt
+
 2008-04-12  James Troup  <troup@debian.org>
 
        * dak/clean_proposed_updates.py: add support for -s/--suite and
index 182e28af871143eb559459a82919c8513924b2f5..245c4bd8f80b311242c56e7ea6f6e0aecc913136 100644 (file)
@@ -38,6 +38,11 @@ Dinstall
    };
 };
 
+Transitions
+{
+   TempPath "/srv/ftp.debian.org/tmp/";
+}
+
 Binary-Upload-Restrictions
 {
  Components
index 7c9b206a9220fb57f53b063733816f0419153381..43c2ae6e362884289b565db1749f639155bb0ad6 100755 (executable)
@@ -211,6 +211,11 @@ def write_transitions_from_file(from_file):
     """We have a file we think is valid; if we're using sudo, we invoke it
        here, otherwise we just parse the file and call write_transitions"""
 
+    # Lets check if from_file is in the directory we expect it to be in
+    if not os.path.abspath(from_file).startswith(Cnf["Transitions::TempPath"]):
+        print "Will not accept transitions file outside of %s" % (Cnf["Transitions::TempPath"])
+        sys.exit(3)
+
     if Options["sudo"]:
         os.spawnl(os.P_WAIT, "/usr/bin/sudo", "/usr/bin/sudo", "-u", "dak", "-H", 
               "/usr/local/bin/dak", "transitions", "--import", from_file)
@@ -227,7 +232,7 @@ def temp_transitions_file(transitions):
     # We need the chmod, as the file is (most possibly) copied from a
     # sudo-ed script and would be unreadable if it has default mkstemp mode
     
-    (fd, path) = tempfile.mkstemp("","transitions")
+    (fd, path) = tempfile.mkstemp("","transitions",Cnf["Transitions::TempPath"])
     os.chmod(path, 0644)
     f = open(path, "w")
     syck.dump(transitions, f)