~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to lib/common/zip.py

  • Committer: mattgiuca
  • Date: 2008-07-21 04:21:18 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:917
interpret.py: Removed the code which removes HTTP_COOKIE from the CGI
    environment. Student code can now access cookies.
Note: This was previously a security risk because malicious code could
steal IVLE cookies. Now that we have separate domain space for other users,
the worst you can do is:
    a) Steal your own IVLE cookie.
    b) Steal other user's non-IVLE cookies (ie. other public cookies).

This makes all student code vulnerable to cookie theft, but that is simply a
disclaimer (if you use cookies, your apps are vulnerable). It is not a
security risk to IVLE itself.

Show diffs side-by-side

added added

removed removed

Lines of Context:
51
51
            # Relative to req.path
52
52
            relpath = os.path.join(basepath, path)
53
53
 
54
 
        _, r = studpath.url_to_local(relpath)
 
54
        #_, r = studpath.url_to_local(relpath)
 
55
        r = relpath
55
56
        if r is None:
56
57
            raise OSError("ZIP: Invalid path")
57
58
        if not os.access(r, os.R_OK):
90
91
    Note: All files go directly into the path. To avoid having a "zip bomb"
91
92
    situation, the zip file should have a single directory in it with all the
92
93
    files.
 
94
    The path is an absolute path in the current filesystem
 
95
    (if this code is executed inside the jail, then it's inside the jail,
 
96
    if it's not then it's not).
93
97
    """
94
98
    zip = zipfile.ZipFile(file, 'r')
95
99
    # First test the zip file
97
101
        raise OSError("ZIP: Bad zip file")
98
102
 
99
103
    for filename in zip.namelist():
100
 
        # Work out the name of this file on the local file system, and make
101
 
        # sure it is valid
102
 
        relpath = os.path.join(path, filename)
103
 
        _, localpath = studpath.url_to_local(relpath)
104
 
        if localpath is None:
105
 
            raise OSError("ZIP: Permission denied")
 
104
        localpath = os.path.join(path, filename)
106
105
        # Create directory for filename
107
106
        (file_dir, _) = os.path.split(localpath)
108
107
        if not os.path.exists(file_dir):