Skip to content

Commit e3856dc

Browse files
authored
Merge pull request #11 from jgiannuzzi/fix-unauthorized-uploads
[fix] Prevent users from uploading new versions of packages they do not own
2 parents 716f18a + 7083b62 commit e3856dc

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pypi_server/handlers/pypi/package.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,10 @@ def action_file_upload(self):
282282
raise HTTPError(404)
283283

284284
package = Package.get(lower_name=package_name)
285+
286+
if package.owner != self.current_user and not self.current_user.is_admin:
287+
raise HTTPError(403)
288+
285289
version = package.create_version(self.get_body_argument('version'))
286290

287291
uploaded_file = self.request.files['content'][0]

0 commit comments

Comments
 (0)