MetaMask / MetaMask/torus.js

Bug: deriving private key will fail if index is larger than that of decryptedShares.length

Open
#146 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
TypeScript
Stars
23
Forks
11
PR merge metrics
No merged PRs in 30d

Description

Maximum index of decrypted shares should be used here instead of `decryptedShares.length` in order to get the correct kCombinations in all instances:

https://github.com/torusresearch/torus.js/blob/0160ae8fb4c622ba44c1e80872da2d17cb0e8650/src/helpers/nodeUtils.ts#L503

This is reproducible in the following scenario:
```
threshold = 3
decryptedShares.count = 3
indexes: [2,3,4]

kCombinations will not include a combination for [2,3,4]
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at src/helpers/nodeUtils.ts around line 503 and inspect how decryptedShares.length determines kCombinations. Reproduce the threshold 3 case with indexes [2,3,4], then verify that the combination [2,3,4] is included when the maximum index exceeds decryptedShares.length.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cryptography
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.