Skip to content

Fail mnemonic generation when entropy is unavailable - #1

Merged
chen-yijiang merged 3 commits into
iotexproject:mainfrom
chen-yijiang:fix/mnemonic-csprng-failure
Sep 20, 2026
Merged

chen-yijiang merged 3 commits into
iotexproject:mainfrom
chen-yijiang:fix/mnemonic-csprng-failure

Conversation

@chen-yijiang

@chen-yijiang chen-yijiang commented Sep 16, 2026 •

Copy link
Copy Markdown
Member

Summary

  • make random mnemonic generation throwing instead of trapping or silently continuing
  • reject invalid entropy strengths with MnemonicError.invalidStrength
  • check SecRandomCopyBytes and fail with MnemonicError.entropyUnavailable unless it returns errSecSuccess
  • propagate mnemonic-generation failures through both throwing KeyPair(phrase:) initializers
  • add injectable entropy generation for deterministic failure-path coverage
  • repair stale API client and transaction test fixtures
  • update GitHub Actions dependencies so fork coverage upload works

This is the dependency-side fix for iopay/iopay-ios#1909.

Verification

  • swift test --filter "SolanaSwiftUnitTests" --enable-code-coverage: 133 tests passed
  • regression coverage covers invalid strength, entropy-source failure, unexpected entropy length, and successful deterministic entropy
  • GitHub unit-test workflow passed on commit 0e422434036bef4d85e37b4d6bcc21092bcc2039
  • git diff --check

@codecov-commenter

Copy link
Copy Markdown

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

@chen-yijiang
chen-yijiang marked this pull request as ready for review September 19, 2026 13:41
@chen-yijiang

Copy link
Copy Markdown
Member Author

Ready for maintainer merge: commit 0e422434036bef4d85e37b4d6bcc21092bcc2039 is CLEAN and the unit-test workflow passed (133/133 tests locally, including entropy failure regressions). The current GitHub identity does not have MergePullRequest permission on this repository. Please squash-merge this PR; ioPay PR #1952 will then be switched from the temporary personal fork pin to the resulting canonical iotexproject/solanaswift commit.

@chen-yijiang
chen-yijiang merged commit 1dc9b39 into iotexproject:main Sep 20, 2026
1 check passed
@chen-yijiang
chen-yijiang deleted the fix/mnemonic-csprng-failure branch September 20, 2026 02:33
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.

3 participants