ipfs / ipfs/go-ipld-cbor

Validate input to WrapObject

Open
#22 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
37
Forks
26
PR merge metrics
No merged PRs in 30d

Description

The CBOR library is smart and will try to serialize arbitrary types using reflection. Unfortunately, this makes it very easy to introduce silent bugs.

For example, the following *does not* panic. Instead, cbor just uses reflection to serialize `child`.

```go
child, _ := WrapObject("thing")
parent, err := WrapObject(map[string]interface{}{
"child": child, // missing a call to `.Cid()`
})

if err != nil {
panic(err)
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.