fix: cross-user unauthorized share-link deletion

This commit is contained in:
Henrique Dias 2026-06-03 10:31:44 +02:00
parent e07c59df0b
commit 0231b7ebdf
No known key found for this signature in database
5 changed files with 117 additions and 6 deletions

View file

@ -15,7 +15,7 @@ type StorageBackend interface {
Gets(path string, id uint) ([]*Link, error)
Save(s *Link) error
Delete(hash string) error
DeleteWithPathPrefix(path string) error
DeleteWithPathPrefix(path string, userID uint) error
}
// Storage is a storage.
@ -137,6 +137,6 @@ func (s *Storage) Delete(hash string) error {
return s.back.Delete(hash)
}
func (s *Storage) DeleteWithPathPrefix(path string) error {
return s.back.DeleteWithPathPrefix(path)
func (s *Storage) DeleteWithPathPrefix(path string, userID uint) error {
return s.back.DeleteWithPathPrefix(path, userID)
}

View file

@ -59,7 +59,7 @@ func (f fakeBackend) Delete(_ string) error {
return nil
}
func (f fakeBackend) DeleteWithPathPrefix(_ string) error {
func (f fakeBackend) DeleteWithPathPrefix(_ string, _ uint) error {
return nil
}