livepeer / livepeer/go-livepeer
Use of math/rand GO API in selection.go
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 586
- Forks
- 226
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 19
Description
Describe the bug
After reviewing the selection.go logic. Line #6 imports the math/rand function. As documented "pseudo-random number generators unsuitable for security-sensitive work."
Is the use of this package a cause for concern? The API clearly states its behavior is deterministic. The session selection criteria (IMHO) should NOT be deterministic. Can the core team explain the choice of this API and wether or not determinism is of concern.
See the crypto/rand package as a suitable replacement.
To Reproduce
There are no clear steps to reproduce the outcome described above. This ticket was opened to for 2 reasons:
- Raise awareness of the core team's go API choices. Should there be (is there) more oversight when team members are making these kinds of decisions?
- Further clarify the intended outcomes for a given Broadcaster's selection choices.
I really want to understand if this use case is considered "security-sensitive work" and the codebase should be updated to use crypto/rand instead.
Expected behavior
- I would expect an explanation of the API choice for the random function.
- Is this use case considered "security-sensitive work"? if so, I'd expect to see this API replaced.
Screenshots
N/A
Desktop (please complete the following information):
N/A
Smartphone (please complete the following information):
N/A
Additional context
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
Start by reading selection.go, especially its use of math/rand, and compare the stated session-selection requirements with the documented behavior of crypto/rand. Check whether broadcaster selection is security-sensitive or whether deterministic pseudo-randomness is intentional. Done means the intended behavior is documented and, if required, the issue identifies the appropriate random API change.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100