sergeyglazyrindev / uadmin

The web framework for Golang
https://uadmindocs.sergeyg.me
MIT License
3 stars 1 forks source link

Provide more test edge cases for CSRF token #26

Open sergeyglazyrindev opened 3 years ago

sergeyglazyrindev commented 3 years ago

Right now I had to temporarly disable CSRF check for admin panel cause there were some unexpected issues, so we have to fix that.

sergeyglazyrindev commented 3 years ago

Stack trace:

assignment to entry in nil map
/home/sergeyg/.gvm/gos/go1.16/src/runtime/map_faststr.go:204 (0x41d02c)
        mapassign_faststr: panic(plainError("assignment to entry in nil map"))
/home2/Projects/Projects/Repos/uadmin/blueprint/sessions/models/models.go:107 (0xbbd5b4)
        (*Session).SetData: s._data[name] = value
/home2/Projects/Projects/Repos/uadmin/blueprint/sessions/interfaces/db.go:20 (0xbbd57d)
        (*DbSession).Set: s.session.SetData(name, value)
/home2/Projects/Projects/Repos/uadmin/templatecontext/templatecontext.go:148 (0xbc09c1)
        PopulateTemplateContextForAdminPanel: session.Set("csrf_token", token)
/home2/Projects/Projects/Repos/uadmin/blueprint/user/user.go:245 (0xbdeba7)
        Blueprint.InitRouter.func7: templatecontext.PopulateTemplateContextForAdminPanel(ctx, c, interfaces.NewAdminRequestParams())
/home/sergeyg/.gvm/pkgsets/go1.16/uadmin-updated/pkg/mod/github.com/gin-gonic/gin@v1.5.0/context.go:147 (0x980490)
        (*Context).Next: c.handlers[c.index](c)
/home/sergeyg/.gvm/pkgsets/go1.16/uadmin-updated/pkg/mod/github.com/gin-gonic/gin@v1.5.0/recovery.go:83 (0x980477)
        RecoveryWithWriter.func1: c.Next()
/home/sergeyg/.gvm/pkgsets/go1.16/uadmin-updated/pkg/mod/github.com/gin-gonic/gin@v1.5.0/context.go:147 (0x97f513)
        (*Context).Next: c.handlers[c.index](c)
/home/sergeyg/.gvm/pkgsets/go1.16/uadmin-updated/pkg/mod/github.com/gin-gonic/gin@v1.5.0/logger.go:241 (0x97f4d2)
        LoggerWithConfig.func1: c.Next()
/home/sergeyg/.gvm/pkgsets/go1.16/uadmin-updated/pkg/mod/github.com/gin-gonic/gin@v1.5.0/context.go:147 (0x9767c3)
        (*Context).Next: c.handlers[c.index](c)
/home/sergeyg/.gvm/pkgsets/go1.16/uadmin-updated/pkg/mod/github.com/gin-gonic/gin@v1.5.0/gin.go:403 (0x9767aa)
        (*Engine).handleHTTPRequest: c.Next()
/home/sergeyg/.gvm/pkgsets/go1.16/uadmin-updated/pkg/mod/github.com/gin-gonic/gin@v1.5.0/gin.go:364 (0x97624c)
        (*Engine).ServeHTTP: engine.handleHTTPRequest(c)
/home/sergeyg/.gvm/gos/go1.16/src/net/http/server.go:2887 (0x6db1c2)
        serverHandler.ServeHTTP: handler.ServeHTTP(rw, req)
/home/sergeyg/.gvm/gos/go1.16/src/net/http/server.go:1952 (0x6d65ec)
        (*conn).serve: serverHandler{c.server}.ServeHTTP(w, w.req)
/home/sergeyg/.gvm/gos/go1.16/src/runtime/asm_amd64.s:1371 (0x474fe0)
        goexit: BYTE    $0x90   // NOP