canonical / identity-platform-admin-ui

Admin UI for the Canonical identity broker and identity provider solution
Other
6 stars 4 forks source link

Panic on empty configmap when creating the first user managed IDP #392

Closed shipperizer closed 2 months ago

shipperizer commented 2 months ago

when performing a POST /api/v0/idps the Configmap used by kratos to store user-managed providers is empty

this triggers a panic

the data field in the configmap is a map and needs to be initialized

Screenshot from 2024-08-30 11-56-50

2024-08-30T09:55:29.459Z [admin-ui] {"severity":"debug","@timestamp":"2024-08-30T09:55:29.459671711Z","message":"[admin-ui-0/fBSw7FdNcK-000115] POST http://iam.dev.canonical.com/api/v0/idps HTTP/1.1 from 10.1.19.203:58128 map[Content-Type:[application/json] Vary:[Origin]] 000 0B in 75.001199ms"}
2024-08-30T09:55:29.459Z [admin-ui] 2024/08/30 09:55:29 http: panic serving 10.1.19.203:58128: assignment to entry in nil map
2024-08-30T09:55:29.459Z [admin-ui] goroutine 642 [running]:
2024-08-30T09:55:29.459Z [admin-ui] net/http.(*conn).serve.func1()
2024-08-30T09:55:29.459Z [admin-ui]     /snap/go/10678/src/net/http/server.go:1873 +0xb9
2024-08-30T09:55:29.459Z [admin-ui] panic({0x1a65140?, 0x21765a0?})
2024-08-30T09:55:29.459Z [admin-ui]     /snap/go/10678/src/runtime/panic.go:920 +0x270
2024-08-30T09:55:29.459Z [admin-ui] github.com/canonical/identity-platform-admin-ui/pkg/idp.(*Service).CreateResource(0xc000345d80, {0x2197170?, 0xc0009c5ad0?}, 0xc000a3a480)
2024-08-30T09:55:29.459Z [admin-ui]     /root/parts/go-build/build/pkg/idp/service.go:177 +0x56b
2024-08-30T09:55:29.459Z [admin-ui] github.com/canonical/identity-platform-admin-ui/pkg/idp.(*API).handleCreate(0xc0005394a0, {0x7f8ae4dc4cb8, 0xc0003e7880}, 0xc000193500)
2024-08-30T09:55:29.459Z [admin-ui]     /root/parts/go-build/build/pkg/idp/handlers.go:205 +0x219
2024-08-30T09:55:29.459Z [admin-ui] net/http.HandlerFunc.ServeHTTP(0xc000193400?, {0x7f8ae4dc4cb8?, 0xc0003e7880?}, 0xc000798b10?)
2024-08-30T09:55:29.459Z [admin-ui]     /snap/go/10678/src/net/http/server.go:2141 +0x29
2024-08-30T09:55:29.459Z [admin-ui] github.com/canonical/identity-platform-admin-ui/internal/validation.(*ValidationRegistry).ValidationMiddleware-fm.(*ValidationRegistry).ValidationMiddleware.func1({0x7f8ae4dc4cb8, 0xc0003e7880}, 0x308dc28?)
2024-08-30T09:55:29.459Z [admin-ui]     /root/parts/go-build/build/internal/validation/registry.go:89 +0x3fa
2024-08-30T09:55:29.459Z [admin-ui] net/http.HandlerFunc.ServeHTTP(0xc0004def00?, {0x7f8ae4dc4cb8?, 0xc0003e7880?}, 0xc000d960f0?)
2024-08-30T09:55:29.459Z [admin-ui]     /snap/go/10678/src/net/http/server.go:2141 +0x29
2024-08-30T09:55:29.459Z [admin-ui] github.com/canonical/identity-platform-admin-ui/pkg/web.NewRouter.(*Middleware).Authorize.func3.1({0x7f8ae4dc4cb8, 0xc0003e7880}, 0x2198030?)
2024-08-30T09:55:29.459Z [admin-ui]     /root/parts/go-build/build/internal/authorization/middlewares.go:161 +0x372
2024-08-30T09:55:29.459Z [admin-ui] net/http.HandlerFunc.ServeHTTP(0xc0004dee00?, {0x7f8ae4dc4cb8?, 0xc0003e7880?}, 0xc000806700?)
2024-08-30T09:55:29.459Z [admin-ui]     /snap/go/10678/src/net/http/server.go:2141 +0x29
2024-08-30T09:55:29.459Z [admin-ui] github.com/canonical/identity-platform-admin-ui/pkg/authentication.(*Middleware).oAuth2CookieAuthentication-fm.(*Middleware).oAuth2CookieAuthentication.func1({0x7f8ae4dc4cb8, 0xc0003e7880}, 0xc000bc8720?)
2024-08-30T09:55:29.459Z [admin-ui]     /root/parts/go-build/build/pkg/authentication/middlewares.go:139 +0x48e
2024-08-30T09:55:29.459Z [admin-ui] net/http.HandlerFunc.ServeHTTP(0xc0004ded00?, {0x7f8ae4dc4cb8?, 0xc0003e7880?}, 0x1d792da?)
2024-08-30T09:55:29.459Z [admin-ui]     /snap/go/10678/src/net/http/server.go:2141 +0x29
2024-08-30T09:55:29.459Z [admin-ui] github.com/canonical/identity-platform-admin-ui/pkg/authentication.(*Middleware).oAuth2BearerAuthentication-fm.(*Middleware).oAuth2BearerAuthentication.func1({0x7f8ae4dc4cb8, 0xc0003e7880}, 0x0?)
2024-08-30T09:55:29.459Z [admin-ui]     /root/parts/go-build/build/pkg/authentication/middlewares.go:86 +0x268
2024-08-30T09:55:29.459Z [admin-ui] net/http.HandlerFunc.ServeHTTP(0xc0006db5e0?, {0x7f8ae4dc4cb8?, 0xc0003e7880?}, 0x0?)
2024-08-30T09:55:29.459Z [admin-ui]     /snap/go/10678/src/net/http/server.go:2141 +0x29
2024-08-30T09:55:29.459Z [admin-ui] github.com/go-chi/chi/v5.(*ChainHandler).ServeHTTP(0x1a4b220?, {0x7f8ae4dc4cb8?, 0xc0003e7880?}, 0xc0002d00c5?)
2024-08-30T09:55:29.459Z [admin-ui]     /root/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.12/chain.go:31 +0x26
2024-08-30T09:55:29.459Z [admin-ui] github.com/go-chi/chi/v5.(*Mux).routeHTTP(0xc000539380, {0x7f8ae4dc4cb8, 0xc0003e7880}, 0xc0004dec00)
2024-08-30T09:55:29.459Z [admin-ui]     /root/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.12/mux.go:459 +0x2b4
2024-08-30T09:55:29.459Z [admin-ui] net/http.HandlerFunc.ServeHTTP(0xc0004deb00?, {0x7f8ae4dc4cb8?, 0xc0003e7880?}, 0x184c88b?)
2024-08-30T09:55:29.459Z [admin-ui]     /snap/go/10678/src/net/http/server.go:2141 +0x29
2024-08-30T09:55:29.459Z [admin-ui] github.com/canonical/identity-platform-admin-ui/pkg/web.NewRouter.RequestLogger.func4.1({0x7f8ae4dc4cb8, 0xc0003e7800}, 0xc0004deb00)
2024-08-30T09:55:29.459Z [admin-ui]     /root/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.12/middleware/logger.go:55 +0x16d
2024-08-30T09:55:29.459Z [admin-ui] net/http.HandlerFunc.ServeHTTP(0xc000794be0?, {0x7f8ae4dc4cb8?, 0xc0003e7800?}, 0xc0004deb00?)
2024-08-30T09:55:29.459Z [admin-ui]     /snap/go/10678/src/net/http/server.go:2141 +0x29
2024-08-30T09:55:29.459Z [admin-ui] github.com/go-chi/cors.(*Cors).Handler-fm.(*Cors).Handler.func1({0x7f8ae4dc4cb8, 0xc0003e7800}, 0xc0004deb00)
2024-08-30T09:55:29.459Z [admin-ui]     /root/go/pkg/mod/github.com/go-chi/cors@v1.2.1/cors.go:228 +0x17e
2024-08-30T09:55:29.459Z [admin-ui] net/http.HandlerFunc.ServeHTTP(0x218b740?, {0x7f8ae4dc4cb8?, 0xc0003e7800?}, 0xc0006f4320?)
2024-08-30T09:55:29.459Z [admin-ui]     /snap/go/10678/src/net/http/server.go:2141 +0x29
2024-08-30T09:55:29.459Z [admin-ui] github.com/canonical/identity-platform-admin-ui/pkg/web.NewRouter.(*Middleware).ResponseTime.func2.1({0x218b740?, 0xc00081ea20?}, 0xc0004deb00)
2024-08-30T09:55:29.459Z [admin-ui]     /root/parts/go-build/build/internal/monitoring/middlewares.go:39 +0xba
2024-08-30T09:55:29.459Z [admin-ui] net/http.HandlerFunc.ServeHTTP(0x2197170?, {0x218b740?, 0xc00081ea20?}, 0x2174fb0?)
2024-08-30T09:55:29.459Z [admin-ui]     /snap/go/10678/src/net/http/server.go:2141 +0x29
2024-08-30T09:55:29.459Z [admin-ui] github.com/go-chi/chi/v5/middleware.RequestID.func1({0x218b740, 0xc00081ea20}, 0xc0004dea00)
2024-08-30T09:55:29.459Z [admin-ui]     /root/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.12/middleware/request_id.go:76 +0x21c
2024-08-30T09:55:29.459Z [admin-ui] net/http.HandlerFunc.ServeHTTP(0x2197170?, {0x218b740?, 0xc00081ea20?}, 0x30e31e0?)
2024-08-30T09:55:29.459Z [admin-ui]     /snap/go/10678/src/net/http/server.go:2141 +0x29
2024-08-30T09:55:29.459Z [admin-ui] github.com/go-chi/chi/v5.(*Mux).ServeHTTP(0xc000539380, {0x218b740, 0xc00081ea20}, 0xc0004de900)
2024-08-30T09:55:29.459Z [admin-ui]     /root/go/pkg/mod/github.com/go-chi/chi/v5@v5.0.12/mux.go:90 +0x330
2024-08-30T09:55:29.459Z [admin-ui] go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp.(*middleware).serveHTTP(0xc0008bc210, {0x2189a68?, 0xc0001461c0}, 0xc0004de800, {0x2179640, 0xc000539380})
2024-08-30T09:55:29.459Z [admin-ui]     /root/go/pkg/mod/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp@v0.45.0/handler.go:217 +0x1202
2024-08-30T09:55:29.459Z [admin-ui] go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp.NewMiddleware.func1.1({0x2189a68?, 0xc0001461c0?}, 0xc0006263e0?)
2024-08-30T09:55:29.459Z [admin-ui]     /root/go/pkg/mod/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp@v0.45.0/handler.go:81 +0x35
2024-08-30T09:55:29.459Z [admin-ui] net/http.HandlerFunc.ServeHTTP(0x410985?, {0x2189a68?, 0xc0001461c0?}, 0xc000146101?)
2024-08-30T09:55:29.459Z [admin-ui]     /snap/go/10678/src/net/http/server.go:2141 +0x29
2024-08-30T09:55:29.459Z [admin-ui] net/http.serverHandler.ServeHTTP({0x2182db0?}, {0x2189a68?, 0xc0001461c0?}, 0x6?)
2024-08-30T09:55:29.459Z [admin-ui]     /snap/go/10678/src/net/http/server.go:2943 +0x8e
2024-08-30T09:55:29.459Z [admin-ui] net/http.(*conn).serve(0xc0008f45a0, {0x2197170, 0xc0008eabd0})
2024-08-30T09:55:29.459Z [admin-ui]     /snap/go/10678/src/net/http/server.go:2014 +0x5f4
2024-08-30T09:55:29.459Z [admin-ui] created by net/http.(*Server).Serve in goroutine 40
2024-08-30T09:55:29.459Z [admin-ui]     /snap/go/10678/src/net/http/server.go:3091 +0x5cb
2024-08-30T09:55:32.412Z [admin-ui] {"severity":"debug","@timestamp":"2024-08-30T09:55:32.412039777Z","message":"[admin-ui-0/fBSw7FdNcK-000116] GET http://localhost:8080/api/v0/status HTTP/1.1 from [::1]:59366 map[Content-Type:[application/json] Vary:[Origin]] 200 163B in 87.003µs"}
2024-08-30T09:55:42.413Z [admin-ui] {"severity":"debug","@timestamp":"2024-08-30T09:55:42.412942316Z","message":"[admin-ui-0/fBSw7FdNcK-000117] GET http://localhost:8080/api/v0/status HTTP/1.1 from [::1]:60300 map[Content-Type:[application/json] Vary:[Origin]] 200 163B in 51.697µs"}
2024-08-30T09:55:51.188Z [pebble] GET /v1/notices?timeout=30s 30.002773356s 200
2024-08-30T09:55:52.411Z [admin-ui] {"severity":"debug","@timestamp":"2024-08-30T09:55:52.411909622Z","message":"[admin-ui-0/fBSw7FdNcK-000118] GET http://localhost:8080/api/v0/status HTTP/1.1 from [::1]:47432 map[Content-Type:[application/json] Vary:[Origin]] 200 163B in 49.402µs"}
2024-08-30T09:56:02.413Z [admin-ui] {"severity":"debug","@timestamp":"2024-08-30T09:56:02.412873644Z","message":"[admin-ui-0/fBSw7FdNcK-000119] GET http://localhost:8080/api/v0/status HTTP/1.1 from [::1]:35116 map[Content-Type:[application/json] Vary:[Origin]] 200 163B in 77.226µs"}
2024-08-30T09:56:02.764Z [admin-ui] 2024/08/30 09:56:02 
syncronize-issues-to-jira[bot] commented 2 months ago

Thank you for reporting us your feedback!

The internal ticket has been created: https://warthogs.atlassian.net/browse/IAM-1018.

This message was autogenerated