mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-31 20:02:09 +00:00
fix(sec): web route delete runner
The web route to delete action runners did not check if the ID that was given belonged to the context it was requested in, this made it possible to delete every existing runner of a instance by a authenticated user. The code was reworked to ensure that the caller of the delete runner function retrieved the runner by ID and then checks if it belongs to the context it was requested in, although this is not an optimal solution it is consistent with the context checking of other code for runners.
This commit is contained in:
parent
94845020e8
commit
f359ebeea5
4 changed files with 20 additions and 14 deletions
|
@ -34,7 +34,7 @@ func TestDeleteRunner(t *testing.T) {
|
|||
require.NoError(t, unittest.PrepareTestDatabase())
|
||||
before := unittest.AssertExistsAndLoadBean(t, &ActionRunner{ID: recordID})
|
||||
|
||||
err := DeleteRunner(db.DefaultContext, recordID)
|
||||
err := DeleteRunner(db.DefaultContext, &ActionRunner{ID: recordID})
|
||||
require.NoError(t, err)
|
||||
|
||||
var after ActionRunner
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue