{"action":"created","comment":{"url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/pulls/comments/37500559","id":37500559,"diff_hunk":"@@ -0,0 +1,71 @@\n+# Copyright 2015 Google Inc. All Rights Reserved.\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+#     http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+#\n+\"\"\"Static file serving functionality invoked by wsgi_config.py.\"\"\"\n+\n+import logging\n+import mimetypes\n+import os\n+import re\n+\n+from werkzeug.wrappers import Request\n+from werkzeug.wrappers import Response\n+from werkzeug.wsgi import wrap_file\n+\n+\n+def static_app_for_regex_and_files(regex, files, upload, mime_type=None):\n+  \"\"\"Returns a WSGI app that serves static files.\n+\n+  Args:\n+    regex: A url-matching regex as specified in appinfo.URLMap.\n+    files: A static_files definition as specified in appinfo.URLMap.\n+      May include a regex backref. See the appinfo.URLMap docstring\n+      for more information.\n+    upload: A filename-matching regex as specified in appinfo.URLMap.","path":"multicore_runtime/static_files.py","position":35,"original_position":35,"commit_id":"3b45547acea5bea474a21a892dcdc2e81597491d","original_commit_id":"3b45547acea5bea474a21a892dcdc2e81597491d","user":{"login":"andrewsg","id":686551,"avatar_url":"https://avatars.githubusercontent.com/u/686551?v=3","gravatar_id":"","url":"https://api.github.com/users/andrewsg","html_url":"https://github.com/andrewsg","followers_url":"https://api.github.com/users/andrewsg/followers","following_url":"https://api.github.com/users/andrewsg/following{/other_user}","gists_url":"https://api.github.com/users/andrewsg/gists{/gist_id}","starred_url":"https://api.github.com/users/andrewsg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrewsg/subscriptions","organizations_url":"https://api.github.com/users/andrewsg/orgs","repos_url":"https://api.github.com/users/andrewsg/repos","events_url":"https://api.github.com/users/andrewsg/events{/privacy}","received_events_url":"https://api.github.com/users/andrewsg/received_events","type":"User","site_admin":false},"body":"The original use of the \"upload\" field in GAE 1.0 was literally to decide which files to upload to the static file server. In MVMs, we're not using a separate server, but I'm abusing the field to validate the request, to protect against path traversal attacks.\r\n\r\nWe should either have them named as they exist in URLMap or named in a way that makes sense for this function. Now that you've brought it up, I agree we should name them in a way that makes sense for this function; the docstring can link those to the origins in URLMap.","created_at":"2015-08-20T07:08:16Z","updated_at":"2015-08-20T07:08:16Z","html_url":"https://github.com/andrewsg/appengine-python-vm-runtime/pull/1#discussion_r37500559","pull_request_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/pulls/comments/37500559"},"html":{"href":"https://github.com/andrewsg/appengine-python-vm-runtime/pull/1#discussion_r37500559"},"pull_request":{"href":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/pulls/1","id":42734664,"html_url":"https://github.com/andrewsg/appengine-python-vm-runtime/pull/1","diff_url":"https://github.com/andrewsg/appengine-python-vm-runtime/pull/1.diff","patch_url":"https://github.com/andrewsg/appengine-python-vm-runtime/pull/1.patch","issue_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/issues/1","number":1,"state":"open","locked":false,"title":"Re-submit files for readability review","user":{"login":"andrewsg","id":686551,"avatar_url":"https://avatars.githubusercontent.com/u/686551?v=3","gravatar_id":"","url":"https://api.github.com/users/andrewsg","html_url":"https://github.com/andrewsg","followers_url":"https://api.github.com/users/andrewsg/followers","following_url":"https://api.github.com/users/andrewsg/following{/other_user}","gists_url":"https://api.github.com/users/andrewsg/gists{/gist_id}","starred_url":"https://api.github.com/users/andrewsg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrewsg/subscriptions","organizations_url":"https://api.github.com/users/andrewsg/orgs","repos_url":"https://api.github.com/users/andrewsg/repos","events_url":"https://api.github.com/users/andrewsg/events{/privacy}","received_events_url":"https://api.github.com/users/andrewsg/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-08-18T18:52:55Z","updated_at":"2015-08-20T07:08:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fff401d1efe0807a8f6d9ae1710a718a7f7c4ab5","assignee":{"login":"filbranden","id":106037,"avatar_url":"https://avatars.githubusercontent.com/u/106037?v=3","gravatar_id":"","url":"https://api.github.com/users/filbranden","html_url":"https://github.com/filbranden","followers_url":"https://api.github.com/users/filbranden/followers","following_url":"https://api.github.com/users/filbranden/following{/other_user}","gists_url":"https://api.github.com/users/filbranden/gists{/gist_id}","starred_url":"https://api.github.com/users/filbranden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/filbranden/subscriptions","organizations_url":"https://api.github.com/users/filbranden/orgs","repos_url":"https://api.github.com/users/filbranden/repos","events_url":"https://api.github.com/users/filbranden/events{/privacy}","received_events_url":"https://api.github.com/users/filbranden/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/pulls/1/commits","review_comments_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/pulls/1/comments","review_comment_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/pulls/comments{/number}","comments_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/issues/1/comments","statuses_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/statuses/3b45547acea5bea474a21a892dcdc2e81597491d","head":{"label":"andrewsg:readability","ref":"readability","sha":"3b45547acea5bea474a21a892dcdc2e81597491d","user":{"login":"andrewsg","id":686551,"avatar_url":"https://avatars.githubusercontent.com/u/686551?v=3","gravatar_id":"","url":"https://api.github.com/users/andrewsg","html_url":"https://github.com/andrewsg","followers_url":"https://api.github.com/users/andrewsg/followers","following_url":"https://api.github.com/users/andrewsg/following{/other_user}","gists_url":"https://api.github.com/users/andrewsg/gists{/gist_id}","starred_url":"https://api.github.com/users/andrewsg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrewsg/subscriptions","organizations_url":"https://api.github.com/users/andrewsg/orgs","repos_url":"https://api.github.com/users/andrewsg/repos","events_url":"https://api.github.com/users/andrewsg/events{/privacy}","received_events_url":"https://api.github.com/users/andrewsg/received_events","type":"User","site_admin":false},"repo":{"id":37627647,"name":"appengine-python-vm-runtime","full_name":"andrewsg/appengine-python-vm-runtime","owner":{"login":"andrewsg","id":686551,"avatar_url":"https://avatars.githubusercontent.com/u/686551?v=3","gravatar_id":"","url":"https://api.github.com/users/andrewsg","html_url":"https://github.com/andrewsg","followers_url":"https://api.github.com/users/andrewsg/followers","following_url":"https://api.github.com/users/andrewsg/following{/other_user}","gists_url":"https://api.github.com/users/andrewsg/gists{/gist_id}","starred_url":"https://api.github.com/users/andrewsg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrewsg/subscriptions","organizations_url":"https://api.github.com/users/andrewsg/orgs","repos_url":"https://api.github.com/users/andrewsg/repos","events_url":"https://api.github.com/users/andrewsg/events{/privacy}","received_events_url":"https://api.github.com/users/andrewsg/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/andrewsg/appengine-python-vm-runtime","description":"Google Managed VMs Python Runtime","fork":true,"url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime","forks_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/forks","keys_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/keys{/key_id}","collaborators_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/teams","hooks_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/hooks","issue_events_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/issues/events{/number}","events_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/events","assignees_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/assignees{/user}","branches_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/branches{/branch}","tags_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/tags","blobs_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/git/refs{/sha}","trees_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/git/trees{/sha}","statuses_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/statuses/{sha}","languages_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/languages","stargazers_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/stargazers","contributors_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/contributors","subscribers_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/subscribers","subscription_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/subscription","commits_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/commits{/sha}","git_commits_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/git/commits{/sha}","comments_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/comments{/number}","issue_comment_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/issues/comments{/number}","contents_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/contents/{+path}","compare_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/compare/{base}...{head}","merges_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/merges","archive_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/downloads","issues_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/issues{/number}","pulls_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/pulls{/number}","milestones_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/milestones{/number}","notifications_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/labels{/name}","releases_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/releases{/id}","created_at":"2015-06-18T00:02:48Z","updated_at":"2015-06-18T00:03:17Z","pushed_at":"2015-08-18T18:52:55Z","git_url":"git://github.com/andrewsg/appengine-python-vm-runtime.git","ssh_url":"git@github.com:andrewsg/appengine-python-vm-runtime.git","clone_url":"https://github.com/andrewsg/appengine-python-vm-runtime.git","svn_url":"https://github.com/andrewsg/appengine-python-vm-runtime","homepage":"","size":26009,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"andrewsg:readability-base","ref":"readability-base","sha":"93234db0efb2f3465ade3198575adffb0bc1afef","user":{"login":"andrewsg","id":686551,"avatar_url":"https://avatars.githubusercontent.com/u/686551?v=3","gravatar_id":"","url":"https://api.github.com/users/andrewsg","html_url":"https://github.com/andrewsg","followers_url":"https://api.github.com/users/andrewsg/followers","following_url":"https://api.github.com/users/andrewsg/following{/other_user}","gists_url":"https://api.github.com/users/andrewsg/gists{/gist_id}","starred_url":"https://api.github.com/users/andrewsg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrewsg/subscriptions","organizations_url":"https://api.github.com/users/andrewsg/orgs","repos_url":"https://api.github.com/users/andrewsg/repos","events_url":"https://api.github.com/users/andrewsg/events{/privacy}","received_events_url":"https://api.github.com/users/andrewsg/received_events","type":"User","site_admin":false},"repo":{"id":37627647,"name":"appengine-python-vm-runtime","full_name":"andrewsg/appengine-python-vm-runtime","owner":{"login":"andrewsg","id":686551,"avatar_url":"https://avatars.githubusercontent.com/u/686551?v=3","gravatar_id":"","url":"https://api.github.com/users/andrewsg","html_url":"https://github.com/andrewsg","followers_url":"https://api.github.com/users/andrewsg/followers","following_url":"https://api.github.com/users/andrewsg/following{/other_user}","gists_url":"https://api.github.com/users/andrewsg/gists{/gist_id}","starred_url":"https://api.github.com/users/andrewsg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrewsg/subscriptions","organizations_url":"https://api.github.com/users/andrewsg/orgs","repos_url":"https://api.github.com/users/andrewsg/repos","events_url":"https://api.github.com/users/andrewsg/events{/privacy}","received_events_url":"https://api.github.com/users/andrewsg/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/andrewsg/appengine-python-vm-runtime","description":"Google Managed VMs Python Runtime","fork":true,"url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime","forks_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/forks","keys_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/keys{/key_id}","collaborators_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/teams","hooks_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/hooks","issue_events_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/issues/events{/number}","events_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/events","assignees_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/assignees{/user}","branches_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/branches{/branch}","tags_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/tags","blobs_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/git/refs{/sha}","trees_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/git/trees{/sha}","statuses_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/statuses/{sha}","languages_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/languages","stargazers_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/stargazers","contributors_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/contributors","subscribers_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/subscribers","subscription_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/subscription","commits_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/commits{/sha}","git_commits_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/git/commits{/sha}","comments_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/comments{/number}","issue_comment_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/issues/comments{/number}","contents_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/contents/{+path}","compare_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/compare/{base}...{head}","merges_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/merges","archive_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/downloads","issues_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/issues{/number}","pulls_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/pulls{/number}","milestones_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/milestones{/number}","notifications_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/labels{/name}","releases_url":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/releases{/id}","created_at":"2015-06-18T00:02:48Z","updated_at":"2015-06-18T00:03:17Z","pushed_at":"2015-08-18T18:52:55Z","git_url":"git://github.com/andrewsg/appengine-python-vm-runtime.git","ssh_url":"git@github.com:andrewsg/appengine-python-vm-runtime.git","clone_url":"https://github.com/andrewsg/appengine-python-vm-runtime.git","svn_url":"https://github.com/andrewsg/appengine-python-vm-runtime","homepage":"","size":26009,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/pulls/1"},"html":{"href":"https://github.com/andrewsg/appengine-python-vm-runtime/pull/1"},"issue":{"href":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/issues/1"},"comments":{"href":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/andrewsg/appengine-python-vm-runtime/statuses/3b45547acea5bea474a21a892dcdc2e81597491d"}}}}