Can upload release attachment via API to a release that isn't of the repo, or user #8282
Closed
1 of 3 tasks
Labels
issue/confirmed
Issue has been reviewed and confirmed to be present or accepted to be implemented
modifies/api
This PR adds API routes or modifies them
type/bug
Description
I have 2 repos:
test
andonemore
. In theonemore
repo I have a release ID 3281927.test
has no releases.Using the API I can upload a file to a release. This works great:
curl -X POST "https://bobemoe:[email protected]/api/v1/repos/bobemoe/onemore/releases/3281927/assets?name=test" -H "accept: application/json" -H "Content-Type: multipart/form-data" -F "attachment=@/home/bob/Downloads/Testing-2-150x150.png;type=image/png"
However if I get the wrong repo name,
test
rather thanonemore
it still uploads to the release inonemore
Maybe there should be a permission check to make sure the release is part of the repo specified:curl -X POST "https://bobemoe:[email protected]/api/v1/repos/bobemoe/test/releases/3281927/assets?name=test" -H "accept: application/json" -H "Content-Type: multipart/form-data" -F "attachment=@/home/bob/Downloads/Testing-2-150x150.png;type=image/png"
Additionally I can upload to a release that is probably owned by someone else: release 3281920!!
curl -X POST "https://bobemoe:[email protected]/api/v1/repos/bobemoe/test/releases/3281920/assets?name=test" -H "accept: application/json" -H "Content-Type: multipart/form-data" -F "attachment=@/home/bob/Downloads/Testing-2-150x150.png;type=image/png"
The file uploaded fine: https://try.gitea.io/attachments/182c448c-b3dc-41b0-b649-518819950ec2 but I have no idea whos repo/release that went to! cough :/
The text was updated successfully, but these errors were encountered: