Skip to content

Application crash after authentication sources update #16342

Closed
@Mattia-Nocerino

Description

@Mattia-Nocerino
  • Gitea version (or commit ref): 1.15.0
  • Git version: 2.30.2
  • Operating system: running on docker using image gitea/gitea:latest
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
  • Log gist:

| 2021/07/05 09:42:29 ...dels/login_source.go:408:GetLoginSourceByID() [I] [SQL] SELECT TOP 1 [id], [type], [name], [is_actived], [is_sync_enabled], [cfg], [created_unix], [updated_unix] FROM [login_source] WHERE [id]=? [8] - 900.206µs
| 2021/07/05 09:42:29 routers/web/base.go:131:1() [E] PANIC: runtime error: invalid memory address or nil pointer dereference
| /usr/local/go/src/runtime/panic.go:212 (0x43da5a)
| /usr/local/go/src/runtime/signal_unix.go:734 (0x457a32)
| /go/src/code.gitea.io/gitea/models/login_source.go:283 (0x2232b9a)
| /go/src/code.gitea.io/gitea/routers/web/admin/auths.go:310 (0x2232bab)
| /go/src/code.gitea.io/gitea/modules/web/route.go:64 (0x201ab5b)
2021/07/05 09:42:29 ...common/middleware.go:64:1() [E] PANIC: interface conversion: interface {​​​}​​​ is nil, not *context.APIContext
| /usr/local/go/src/runtime/iface.go:261 (0x412e4e)
| /go/src/code.gitea.io/gitea/modules/context/api.go:135 (0x224bffe)
| /go/src/code.gitea.io/gitea/routers/web/base.go:151 (0x224b680)
| /usr/local/go/src/runtime/panic.go:965 (0x43f998)
| /usr/local/go/src/runtime/panic.go:212 (0x43da5a)
2021/07/05 09:42:29 Completed GET /admin/auths/8 500 Internal Server Error in 32.85603ms

Description

Whenever we try to make an update on the authentication sources the application crashes.
We managed to get the query that is being executed on our SQL Server istance and we noticed that:

  • On the first insert, config json string is being passed correctly.
  • On update the json string is converted to hexadecimal. This is the query:
    exec sp_executesql N'UPDATE [login_source] SET [type] = @p1, [name] = @p2, [is_actived] = @p3, [is_sync_enabled] = @p4, [cfg] = @p5, [updated_unix] = @p6 WHERE [id]=@p7',N'@p1 bigint,@p2 nvarchar(9),@p3 bit,@p4 bit,@p5 varbinary(818),@p6 bigint,@p7 bigint',@p1=2,@p2=N'TDT-LDAPS',@p3=1,@p4=1,@p5=0X7B224E616D65223A22746573742D4C44415053222C22486F7374223A22746573742E746573742E6974222C22506F7274223A3633362C22536563757269747950726F746F636F6C223A312C22536B6970566572696679223A747275652C2242696E64444E223A22434E3D4C64617020536572766963652C4F553D4C6461702C4F553D41757468656E7469636174696F6E2C4F553D5365727669636573204163636F756E742C44433D746573742C44433D6974222C2242696E6450617373776F7264456E6372797074223A226436626238323539663164333834303165636538393431333237343433306461356331653366643264366236393638613264303439303734326436613165393038623530366564633434613461336261222C2242696E6450617373776F7264223A22222C225573657242617365223A2244433D746573742C44433D6974222C2255736572444E223A22222C22417474726962757465557365726E616D65223A2273414D4163636F756E744E616D65222C224174747269627574654E616D65223A22676976656E6E616D65222C224174747269627574655375726E616D65223A22736E222C224174747269627574654D61696C223A226D61696C222C2241747472696275746573496E42696E64223A66616C73652C224174747269627574655353485075626C69634B6579223A22222C225365617263685061676553697A65223A302C2246696C746572223A22285C75303032362873414D4163636F756E744E616D653D257329286D656D6265724F663D434E3D5379732041646D696E2C4F553D496E6672617374727563747572652C4F553D746573742C4F553D49542C4F553D5573657273204F752C44433D746573742C44433D69742929222C2241646D696E46696C746572223A22222C225265737472696374656446696C746572223A22222C22456E61626C6564223A747275652C22416C6C6F7744656163746976617465416C6C223A66616C73652C2247726F757073456E61626C6564223A66616C73652C2247726F7570444E223A22222C2247726F757046696C746572223A22222C2247726F75704D656D626572554944223A22222C2255736572554944223A22227D,@p6=1625476484,@p7=5

Screenshots

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions