Handle rustls_result more robustly
Open
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 170
- Forks
- 43
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 10
Description
As seen in #227 and #195, our current approach to rustls_result is too easy to make mistakes with, and those mistakes lead to undefined behavior. We should try a different approach, either:
- Use a newtype with associated constants, as recommended in https://users.rust-lang.org/t/guarding-against-invalid-enum-values-arriving-via-ffi/33482, OR
- Use some static checking to ensure that (a) rustls_result is never a parameter of a function in the public API, and (b) rustls_result is never a return value of a callback.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Search the public API and callback definitions for rustls_result, then review the failure cases described in #227 and #195. Compare the newtype-with-associated-constants and static-checking approaches; the work is done when invalid rustls_result use cannot enter the public API or callback returns and the cited undefined-behavior cases are addressed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- backend-api-design, security
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100