Clear accountUUID if it's still me after validation
This commit is contained in:
@@ -328,6 +328,10 @@ func getValidatedAccountUUID(c context.Context, accountUUID string) string {
|
|||||||
accountUUID = ownAccountUUID
|
accountUUID = ownAccountUUID
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if accountUUID == "me" {
|
||||||
|
// no matter what happens above, an accountUUID of `me` must not be passed on. Clear it instead.
|
||||||
|
accountUUID = ""
|
||||||
|
}
|
||||||
return accountUUID
|
return accountUUID
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,11 +26,17 @@ var (
|
|||||||
expect: ctxWithUUID.Value(middleware.UUIDKey).(string),
|
expect: ctxWithUUID.Value(middleware.UUIDKey).(string),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "context without UUID; identifier = 'me'",
|
name: "context with empty UUID; identifier = 'me'",
|
||||||
ctx: ctxWithEmptyUUID,
|
ctx: ctxWithEmptyUUID,
|
||||||
accountUUID: "me",
|
accountUUID: "me",
|
||||||
expect: "",
|
expect: "",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "context without UUID; identifier = 'me'",
|
||||||
|
ctx: emptyCtx,
|
||||||
|
accountUUID: "me",
|
||||||
|
expect: "",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "context with UUID; identifier not 'me'",
|
name: "context with UUID; identifier not 'me'",
|
||||||
ctx: ctxWithUUID,
|
ctx: ctxWithUUID,
|
||||||
|
|||||||
Reference in New Issue
Block a user