This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2013年01月12日 14:14 by neologix, last changed 2022年04月11日 14:57 by admin.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| cgi_subprocess.diff | neologix, 2013年01月12日 14:14 | review | ||
| cgi_subprocess-1.diff | neologix, 2013年02月24日 09:47 | review | ||
| Messages (3) | |||
|---|---|---|---|
| msg179797 - (view) | Author: Charles-François Natali (neologix) * (Python committer) | Date: 2013年01月12日 14:14 | |
On Unix, CGIHTTPRequestHandler.run_cgi() uses the following code to run a CGI script: """ pid = os.fork() [...] # Child try: try: os.setuid(nobody) except OSError: pass os.dup2(self.rfile.fileno(), 0) os.dup2(self.wfile.fileno(), 1) os.execve(scriptfile, args, env) """ It's basically reimplementing subprocess.Popen, with a potential securiy issue: open file descriptors are not closed before exec, which means that the CGI script - which is run as 'nobody' on Unix to reduce its priviledges - can inherit open sockets or files (unless they're close-on-exec)... The attached patch rewrites run_cgi() to use subprocess on all platorms. I'm not at all familiar with CGI, so I don't guarantee it's correct, but the regression test test_httpservers passes on Linux. It leads to cleaner and safer code, so if someone with some httpsever/CGI background could review it, it would be great. |
|||
| msg188359 - (view) | Author: Charles-François Natali (neologix) * (Python committer) | Date: 2013年05月04日 12:44 | |
The latest version of the patch passes on Linux, OpenIndiana and Windows. Note that I did apply the select()-hack on all platforms (not only Windows), because if I understood #427345 correctly, it's really there to bypass a non-standard IE behavior (which appends trailing '\r\n'), and doesn't depend on the platform. |
|||
| msg194158 - (view) | Author: Charles-François Natali (neologix) * (Python committer) | Date: 2013年08月02日 06:56 | |
Marking #10496 as a dependency (since it could prevent Python from running with low level privileges). |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:40 | admin | set | github: 61149 |
| 2013年08月02日 06:56:00 | neologix | set | dependencies:
+ Python startup should not require passwd entry messages: + msg194158 |
| 2013年05月04日 12:44:17 | neologix | set | messages: + msg188359 |
| 2013年02月24日 09:47:20 | neologix | set | files: + cgi_subprocess-1.diff |
| 2013年02月23日 22:37:54 | neologix | set | nosy:
+ pitrou |
| 2013年01月19日 11:58:50 | neologix | set | nosy:
+ v+python |
| 2013年01月13日 14:47:07 | neologix | set | nosy:
+ orsenthil |
| 2013年01月12日 14:14:43 | neologix | create | |