[chore] No sigs for retrieving instance actor

As a possible path towards resolving #1186, this removes the signature
check on the instance actor. Also adds a test to check authentication
for a user other than the instance actor to ensure we don't poke a big
hole into that check.
This commit is contained in:
Daenney 2025-06-03 19:11:07 +02:00
commit e65bda768c
6 changed files with 120 additions and 4 deletions

View file

@ -20,6 +20,7 @@ package uris
import (
"fmt"
"net/url"
"path"
"strings"
"code.superseriousbusiness.org/gotosocial/internal/config"
@ -325,6 +326,11 @@ func IsPublicKeyPath(id *url.URL) bool {
return regexes.PublicKeyPath.MatchString(id.Path)
}
// IsInstanceActorPath returns true if the given URL corresponds to /users/instance_actor
func IsInstanceActorPath(u *url.URL) bool {
return u.Path == path.Join("/", "users", config.InstanceActor())
}
// IsBlockPath returns true if the given URL path corresponds to eg /users/example_username/blocks/SOME_ULID_OF_A_BLOCK
func IsBlockPath(id *url.URL) bool {
return regexes.BlockPath.MatchString(id.Path)