Commit 839c3e0
fix:
## Explanation
We aren't handling the case where a permitted account with the
`wallet:eip155` scope prefix is passed into
`isInternalAccountInPermittedAccountIds` - where it is the only
representation of its address in the permission set. In this case we
wouldn't find a permitted account matching a passed in internal account
and would [ultimately throw an
error](https://github.com/MetaMask/metamask-mobile/blob/97486f7d2aff5d075865e93126727590c88c0c4d/app/core/Permissions/index.ts#L145)
resulting in the app crashing.
## References
* Fixes error [reported
here](https://consensys.slack.com/archives/C08UFPWB3GB/p1749821334454809)
## Changelog
### `@metamask/chain-agnostic-permission`
- Fix `isInternalAccountInPermittedAccountIds` and
`isCaipAccountIdInPermittedAccountIds` to correctly handle comparison
against `permittedAccounts` values of the `wallet:<namespace>:<address>`
format
## Checklist
- [ ] I've updated the test suite for new or updated code as appropriate
- [ ] I've updated documentation (JSDoc, Markdown, etc.) for new or
updated code as appropriate
- [ ] I've communicated my changes to consumers by [updating changelogs
for packages I've
changed](https://github.com/MetaMask/core/tree/main/docs/contributing.md#updating-changelogs),
highlighting breaking changes as necessary
- [ ] I've prepared draft pull requests for clients and consumer
packages to resolve any breaking changes
---------
Co-authored-by: Jiexi Luan <jiexiluan@gmail.com>isInternalAccountInPermittedAccountIds case where only wallet:eip155 permission exists for a given address (MetaMask#5980)1 parent 4a936da commit 839c3e0
3 files changed
Lines changed: 64 additions & 2 deletions
File tree
- packages/chain-agnostic-permission
- src/adapters
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
16 | 20 | | |
17 | 21 | | |
18 | 22 | | |
| |||
Lines changed: 36 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
637 | 637 | | |
638 | 638 | | |
639 | 639 | | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
640 | 676 | | |
641 | 677 | | |
642 | 678 | | |
| |||
Lines changed: 24 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
319 | 319 | | |
320 | 320 | | |
321 | 321 | | |
322 | | - | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
323 | 337 | | |
324 | 338 | | |
325 | 339 | | |
326 | 340 | | |
327 | | - | |
328 | 341 | | |
329 | 342 | | |
330 | 343 | | |
331 | 344 | | |
332 | 345 | | |
333 | 346 | | |
334 | 347 | | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
335 | 357 | | |
336 | 358 | | |
337 | 359 | | |
| |||
0 commit comments