Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nil pointer dereference accessing account webhooks #83

Closed
weppos opened this issue Jun 13, 2019 · 0 comments · Fixed by #85
Closed

nil pointer dereference accessing account webhooks #83

weppos opened this issue Jun 13, 2019 · 0 comments · Fixed by #85
Assignees
Labels
bug Code defect or incorrect behavior

Comments

@weppos
Copy link
Member

weppos commented Jun 13, 2019

I found the issue while tracking back several exceptions happening in strillone.

Here's the error in strillone:

2019-06-13T07:59:36.100612+00:00 app[web.1]: 2019/06/13 07:59:36 http: panic serving 10.33.137.185:11287: runtime error: invalid memory address or nil pointer dereference
2019-06-13T07:59:36.100616+00:00 app[web.1]: goroutine 727 [running]:
2019-06-13T07:59:36.100618+00:00 app[web.1]: net/http.(*conn).serve.func1(0xc00014c320)
2019-06-13T07:59:36.100621+00:00 app[web.1]: /app/tmp/cache/go1.12.5/go/src/net/http/server.go:1769 +0x139
2019-06-13T07:59:36.100623+00:00 app[web.1]: panic(0x6cf920, 0x9858a0)
2019-06-13T07:59:36.100624+00:00 app[web.1]: /app/tmp/cache/go1.12.5/go/src/runtime/panic.go:522 +0x1b5
2019-06-13T07:59:36.100627+00:00 app[web.1]: main.Message(0x78f4a0, 0xc000058d90, 0x792c40, 0xc0001500e0, 0xc0000b5a28, 0x40cdf9)
2019-06-13T07:59:36.100629+00:00 app[web.1]: /tmp/build_460942fe7080468b42a8e419284c6ff8/message.go:14 +0x65
2019-06-13T07:59:36.100631+00:00 app[web.1]: main.(*SlackService).PostEvent(0xc000058d90, 0x792c40, 0xc0001500e0, 0x3, 0x3, 0xc00001a270, 0x2c)
2019-06-13T07:59:36.100633+00:00 app[web.1]: /tmp/build_460942fe7080468b42a8e419284c6ff8/service.go:36 +0x98
2019-06-13T07:59:36.100636+00:00 app[web.1]: main.(*Server).Slack(0xc000010040, 0x792480, 0xc0000d2460, 0xc00006a200, 0xc00006c360, 0x3, 0x3)
2019-06-13T07:59:36.100638+00:00 app[web.1]: /tmp/build_460942fe7080468b42a8e419284c6ff8/server.go:118 +0x836
2019-06-13T07:59:36.100639+00:00 app[web.1]: github.com/julienschmidt/httprouter.(*Router).ServeHTTP(0xc000020480, 0x792480, 0xc0000d2460, 0xc00006a200)
2019-06-13T07:59:36.100641+00:00 app[web.1]: /app/tmp/cache/go-path/pkg/mod/github.com/julienschmidt/httprouter@v1.2.0/router.go:334 +0x948
2019-06-13T07:59:36.100643+00:00 app[web.1]: main.(*Server).ServeHTTP(0xc000010040, 0x792480, 0xc0000d2460, 0xc00006a200)
2019-06-13T07:59:36.100645+00:00 app[web.1]: /tmp/build_460942fe7080468b42a8e419284c6ff8/server.go:70 +0x4c
2019-06-13T07:59:36.100648+00:00 app[web.1]: net/http.serverHandler.ServeHTTP(0xc000092b60, 0x792480, 0xc0000d2460, 0xc00006a200)
2019-06-13T07:59:36.100650+00:00 app[web.1]: /app/tmp/cache/go1.12.5/go/src/net/http/server.go:2774 +0xa8
2019-06-13T07:59:36.100652+00:00 app[web.1]: net/http.(*conn).serve(0xc00014c320, 0x792a40, 0xc000180300)
2019-06-13T07:59:36.100653+00:00 app[web.1]: /app/tmp/cache/go1.12.5/go/src/net/http/server.go:1878 +0x851
2019-06-13T07:59:36.100655+00:00 app[web.1]: created by net/http.(*Server).Serve
2019-06-13T07:59:36.100657+00:00 app[web.1]: /app/tmp/cache/go1.12.5/go/src/net/http/server.go:2884 +0x2f4

Here's the relevant code:

https://github.com/dnsimple/strillone/blob/7471dc6e58bffe6ae597219d63345df4387edc03/message.go#L11-L14

Here's an example of a webhook that crashes:

{
  "data": {
    "account": {
      "id": 0,
      "email": "ops@example.com",
      "created_at": "2012-03-16T16:02:54Z",
      "updated_at": "2019-06-12T13:33:07Z",
      "plan_identifier": "monthly"
    },
    "account_invitation": {
      "id": 0,
      "email": "example@example.com",
      "token": "256bffc4",
      "account_id": 0,
      "created_at": "2019-06-13T07:45:29Z",
      "updated_at": "2019-06-13T07:45:29Z",
      "invitation_sent_at": "2019-06-13T07:45:29Z",
      "invitation_accepted_at": null
    }
  },
  "name": "account.user_invite",
  "actor": {
    "id": "0",
    "entity": "user",
    "pretty": "user@example.com"
  },
  "account": {
    "id": 0,
    "display": "Example",
    "identifier": "example"
  },
  "api_version": "v2",
  "request_identifier": "0e55bda3-8fdf-4ca2-8bcc-fce18417d40a"
}
@weppos weppos added the bug Code defect or incorrect behavior label Jun 13, 2019
@weppos weppos self-assigned this Jun 13, 2019
weppos added a commit that referenced this issue Jun 21, 2019
This commit it's a significant rewrite of the webhook parsing system. The key difference is how a webhook event is represented.

Closes #83
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Code defect or incorrect behavior
Projects
None yet
1 participant