keybase / keybase/client

API Read Call Panics

Open
#10,315 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
9.2k
Forks
1.3k
Avg merge
12h 58m
Merged PRs (30d)
56

Description

```
[dnelson@sulaco keybase-chatbot]$ keybase -v
keybase version 1.0.39-20180119172947+d29f565ed
```

When calling the API, a panic occurs.

The first works, the second causes a panic:
```
{"method": "read", "params": {"options": {"conversation_id": "00006f986cf0c653670c2704e8e694c08bfe9936<24 digits omitted>"}}}

{"method": "read", "params": {"options": {"conversation_id": "0000a3a0d371f5163fa894c31986aa63d2fddd63<24 digits omitted>"}}}
```

The panic:
```
[dnelson@sulaco keybase-chatbot]$ keybase chat api
{"method": "read", "params": {"options": {"conversation_id": "0000a3a0d371f5163fa894c31986aa63d2fddd63<24 digits omitted>"}}}
panic: wrong case accessed

goroutine 1 [running]:
github.com/keybase/client/go/protocol/chat1.MessageUnboxed.Valid(0x3, 0x0, 0x0, 0xc42019f1e0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
/root/build/gopaths/amd64/src/github.com/keybase/client/go/protocol/chat1/local.go:2290 +0x9d
github.com/keybase/client/go/client.(*chatServiceHandler).ReadV1(0xc42008a0e0, 0x225c1e0, 0xc420088020, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
/root/build/gopaths/amd64/src/github.com/keybase/client/go/client/chat_svc_handler.go:178 +0x83d
github.com/keybase/client/go/client.(*ChatAPI).ReadV1(0xc4202d48c0, 0x225c1e0, 0xc420088020, 0x0, 0x0, 0x0, 0xc4202a8130, 0x4, 0x0, 0xc4201fe000, ...)
/root/build/gopaths/amd64/src/github.com/keybase/client/go/client/chat_api_handler.go:293 +0x299
github.com/keybase/client/go/client.(*ChatAPIVersionHandler).handleV1(0xc4202ca490, 0x225c1e0, 0xc420088020, 0x0, 0x0, 0x0, 0xc4202a8130, 0x4, 0x0, 0xc4201fe000, ...)
/root/build/gopaths/amd64/src/github.com/keybase/client/go/client/chat_api_version_handler.go:36 +0x308
github.com/keybase/client/go/client.(*ChatAPIVersionHandler).handle(0xc4202ca490, 0x225c1e0, 0xc420088020, 0x0, 0x0, 0x0, 0xc4202a8130, 0x4, 0x0, 0xc4201fe000, ...)
/root/build/gopaths/amd64/src/github.com/keybase/client/go/client/chat_api_version_handler.go:25 +0xb3
github.com/keybase/client/go/client.(*cmdAPI).decode(0xc42016dc48, 0x225c1e0, 0xc420088020, 0x224c0a0, 0xc42008a000, 0x224c0e0, 0xc42008a008, 0x2248b20, 0xc4202ca490, 0xc420302800, ...)
/root/build/gopaths/amd64/src/github.com/keybase/client/go/client/json_api_common.go:197 +0x161
github.com/keybase/client/go/client.(*cmdAPI).runHandler(0xc42016dc48, 0x2248b20, 0xc4202ca490, 0x0, 0x0)
/root/build/gopaths/amd64/src/github.com/keybase/client/go/client/json_api_common.go:181 +0xed
github.com/keybase/client/go/client.(*CmdChatAPI).Run(0xc42016dc40, 0xc4202c61c0, 0x2368310)
/root/build/gopaths/amd64/src/github.com/keybase/client/go/client/cmd_chat_api.go:31 +0x102
main.mainInner(0xc4202c2380, 0x0, 0x0)
/root/build/gopaths/amd64/src/github.com/keybase/client/go/keybase/main.go:159 +0x71b
main.main()
/root/build/gopaths/amd64/src/github.com/keybase/client/go/keybase/main.go:64 +0xa6
```

The channel which panics on read:
```
{'id': '0000a3a0d371f5163fa894c31986aa63d2fddd63<24 digits omitted>', 'channel': {'name': '', 'public': False, 'members_type': 'team', 'topic_type': 'chat', 'topic_name': 'general'}, 'unread': False, 'active_at': 1516824884, 'active_at_ms': 1516824884014}
```

The one which works fine:
```
{'id': '00006f986cf0c653670c2704e8e694c08bfe9936<24 digits omitted>', 'channel': {'name': '', 'public': False, 'members_type': 'team', 'topic_type': 'chat', 'topic_name': 'general'}, 'unread': False, 'active_at': 1516818495, 'active_at_ms': 1516818495377}
```

The first channel name contains numbers and an underscore, the second is all lowercase ascii.

Any thoughts? I'm at a loss.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the second read request with `keybase chat api`, then inspect `go/protocol/chat1/local.go` at `MessageUnboxed.Valid` and the caller in `go/client/chat_svc_handler.go`. Compare the failing and working channel responses and trace the `wrong case accessed` path; done means the failing API call no longer panics and returns an appropriate result.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.