Skip to content

fix: reject single-share Shamir splits#60

Open
slashdevcorpse wants to merge 1 commit into
bitaps-com:masterfrom
slashdevcorpse:security/reject-single-share-splits
Open

fix: reject single-share Shamir splits#60
slashdevcorpse wants to merge 1 commit into
bitaps-com:masterfrom
slashdevcorpse:security/reject-single-share-splits

Conversation

@slashdevcorpse
Copy link
Copy Markdown

@slashdevcorpse slashdevcorpse commented May 12, 2026

Summary

  • Reject Shamir splits with thresholds below 2, matching the restore path that requires at least two points.
  • Update the mnemonic and helper tests so threshold-1 requests fail at split time instead of producing share sets that cannot be recovered through the existing API.

Validation

  • Focused affected Mocha tests for initialization, mnemonic split/combine, embedded indexes, GF256, and secret splitting
  • npm test
  • git diff --check

Bounty payout address if accepted: bc1qssrlr7qu0kq2kmf7arwznpuad0aw5wr9ls7c3q

Threshold-1 splits generate shares that expose the raw secret but cannot be restored through the existing recovery path, which rejects fewer than two points. Reject the split up front so callers do not create unusable mnemonic share sets.

Co-authored-by: Codex <noreply@openai.com>
Copilot AI review requested due to automatic review settings May 12, 2026 22:55
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR prevents creation of unrecoverable Shamir share sets by rejecting threshold-1 splits at split time, aligning behavior with the existing restore path (which requires at least two points).

Changes:

  • Add an explicit threshold < 2 guard in __split_secret.
  • Update mnemonic splitting tests to expect failure for threshold=1 instead of producing shares.
  • Add a test asserting raw secret splitting rejects threshold=1.

Reviewed changes

Copilot reviewed 1 out of 2 changed files in this pull request and generated no comments.

File Description
test/jsbtc.test.js Updates/extends tests to assert threshold-1 splits throw "Minimum 2 shares required".
src/functions/shamir_secret_sharing.js Adds a runtime guard rejecting threshold < 2 in __split_secret.
Files not reviewed (1)
  • test/jsbtc.test.js: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants