-
-
Notifications
You must be signed in to change notification settings - Fork 110
Description
I have setup OIDC authentication with a limit on group membership.
If a user is not in a group the returned value is "null" which crashes Gokapi consistently:
██████ ██████ ██ ██ █████ ██████ ██
██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ███ ██ ██ █████ ███████ ██████ ██
██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██████ ██████ ██ ██ ██ ██ ██ ██
Gokapi v1.9.0 starting
Saving new files to local storage
Binding webserver to :53842
Webserver can be accessed at https://share.xxx/admin
Press CTRL+C to stop Gokapi
2024/07/28 18:08:30 http: panic serving 172.23.0.2:50044: interface conversion: interface {} is nil, not []interface {}
goroutine 73 [running]:
net/http.(*conn).serve.func1()
/usr/local/go/src/net/http/server.go:1898 +0xbe
panic({0xdaf940?, 0xc0004fd4d0?})
/usr/local/go/src/runtime/panic.go:770 +0x132
github.com/forceu/gokapi/internal/webserver/authentication.extractOauthGroups({0x2cb1d40, 0xc000486640}, {0xc0003c82a6, 0x6})
/compile/internal/webserver/authentication/Authentication.go:174 +0x285
github.com/forceu/gokapi/internal/webserver/authentication.CheckOauthUserAndRedirect({{0xc000533020, 0x24}, {0x0, 0x0}, {0x2cb1d40, 0xc000486640}}, {0x2cb66d8, 0xc0000a0000})
/compile/internal/webserver/authentication/Authentication.go:237 +0xfb
github.com/forceu/gokapi/internal/webserver/authentication/oauth.HandlerCallback({0x2cb66d8, 0xc0000a0000}, 0xc0003aa120)
/compile/internal/webserver/authentication/oauth/Oauth.go:105 +0x2bd
net/http.HandlerFunc.ServeHTTP(0xc00048f1e0?, {0x2cb66d8?, 0xc0000a0000?}, 0x9b17da?)
/usr/local/go/src/net/http/server.go:2166 +0x29
net/http.(*ServeMux).ServeHTTP(0x46a6d9?, {0x2cb66d8, 0xc0000a0000}, 0xc0003aa120)
/usr/local/go/src/net/http/server.go:2683 +0x1ad
net/http.serverHandler.ServeHTTP({0xc00062ec30?}, {0x2cb66d8?, 0xc0000a0000?}, 0x6?)
/usr/local/go/src/net/http/server.go:3137 +0x8e
net/http.(*conn).serve(0xc0003c67e0, {0x2cb6f88, 0xc00062e420})
/usr/local/go/src/net/http/server.go:2039 +0x5e8
created by net/http.(*Server).Serve in goroutine 28
/usr/local/go/src/net/http/server.go:3285 +0x4b4
Shutting down...
If I use a user with any group membership this doesn't occur, and the right membership gives the user access.
The authentication server is Authelia, the Gokapi config looks like this:
{
"Authentication": {
"Method": 1,
"SaltAdmin": "xx",
"SaltFiles": "xx",
"Username": "zz",
"Password": "zz",
"HeaderKey": "",
"OauthProvider": "https://auth.xxx",
"OAuthClientId": "gokapi",
"OAuthClientSecret": "xxx",
"OauthUserScope": "",
"OauthGroupScope": "groups",
"OAuthRecheckInterval": 12,
"HeaderUsers": null,
"OAuthGroups": [
"gokapi"
],
"OauthUsers": []
},
"Port": ":53842",
"ServerUrl": "https://share.xxx/",
"RedirectUrl": "https://lnxgeek.org/",
"PublicName": "Gokapi",
"DataDir": "data",
"DatabaseUrl": "redis://redis:6379?prefix=gokapi_",
"ConfigVersion": 21,
"LengthId": 15,
"MaxFileSizeMB": 102400,
"MaxMemory": 50,
"ChunkSize": 45,
"MaxParallelUploads": 4,
"Encryption": {
"Level": 0,
"Cipher": null,
"Salt": "",
"Checksum": "",
"ChecksumSalt": ""
},
"UseSsl": false,
"PicturesAlwaysLocal": false,
"SaveIp": true,
"IncludeFilename": true
}