Bug: EnvVar/Label/Volume/Port deletion does not verify resource belongs to the app in URL (IDOR) #3
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
The delete handlers for env vars, labels, volumes, and ports (e.g.,
HandleEnvVarDelete) look up the resource by its own ID but never verify that the resource'sAppIDmatches the{id}parameter in the URL path. This means a user can delete resources belonging to other apps by manipulating the resource ID.Impact
Insecure Direct Object Reference (IDOR) - any authenticated user can delete env vars, labels, volumes, or ports from any app.
Location
HandleEnvVarDelete()ininternal/handlers/app.goHandleLabelDelete()ininternal/handlers/app.goHandleVolumeDelete()ininternal/handlers/app.goHandlePortDelete()ininternal/handlers/app.goFix
After finding the resource, verify
resource.AppID == appIDbefore deleting.Closing as duplicate of #19, which was fixed in PR #28 (merged).