коммит произвёл
GitHub
родитель
540f4c1145
Коммит
e14175eb65
@@ -861,6 +861,7 @@ func (th *TestHelper) AddPermissionToRole(permission string, roleName string) {
|
||||
|
||||
func TestFullyQualifiedRedirectURL(t *testing.T) {
|
||||
const siteURL = "https://xxx.yyy/mm"
|
||||
|
||||
for target, expected := range map[string]string{
|
||||
"": siteURL,
|
||||
"/": siteURL + "/",
|
||||
@@ -881,9 +882,11 @@ func TestFullyQualifiedRedirectURL(t *testing.T) {
|
||||
"https://xxx.yyy/mm/some-path#section": siteURL + "/some-path#section",
|
||||
"https://xxx.yyy/mm/../malicious-path": siteURL,
|
||||
":foo": siteURL,
|
||||
"mmauth://callback": "mmauth://callback",
|
||||
"mmauth://xxx.yyy/mm": siteURL, // invalid mobile URL (wrong host)
|
||||
} {
|
||||
t.Run(target, func(t *testing.T) {
|
||||
require.Equal(t, expected, fullyQualifiedRedirectURL(siteURL, target))
|
||||
require.Equal(t, expected, fullyQualifiedRedirectURL(siteURL, target, []string{"mmauth://"}))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user