Commit cac76dd
authored
fix: Skip refetching the registry in
Our tests didn't catch this, but in production, triggering
`SnapRegistryController:registryUpdated` triggers `handleRegistryUpdate`
which may try to refetch the registry and cause an infinite loop. We can
fix this by passing a flag to not refetch the registry.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Changes registry verification/version-resolution calls to optionally
skip refetching, which could alter behavior on allowlist misses and
impact snap blocking/auto-update flows if misused.
>
> **Overview**
> Prevents an infinite update loop when handling
`SnapRegistryController:registryUpdated` by ensuring
`SnapController#handleRegistryUpdate` does not trigger a registry
refetch during blocklist checks and preinstalled allowlist version
resolution.
>
> This adds a `skipRefetch` flag plumbed through
`SnapRegistryController:get` and
`SnapController#resolveAllowlistVersion` (forwarded to
`SnapRegistryController:resolveVersion`), and updates the corresponding
`SnapController` test to assert the new `get(..., true)` call signature.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
c0401da. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->handleRegistryUpdate (#3961)1 parent 22f8da9 commit cac76dd
3 files changed
Lines changed: 18 additions & 10 deletions
File tree
- packages/snaps-controllers/src/snaps
- registry
Lines changed: 12 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10515 | 10515 | | |
10516 | 10516 | | |
10517 | 10517 | | |
10518 | | - | |
10519 | | - | |
10520 | | - | |
10521 | | - | |
10522 | | - | |
10523 | | - | |
10524 | | - | |
10525 | | - | |
| 10518 | + | |
| 10519 | + | |
| 10520 | + | |
| 10521 | + | |
| 10522 | + | |
| 10523 | + | |
| 10524 | + | |
| 10525 | + | |
| 10526 | + | |
| 10527 | + | |
10526 | 10528 | | |
10527 | | - | |
| 10529 | + | |
| 10530 | + | |
10528 | 10531 | | |
10529 | 10532 | | |
10530 | 10533 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1471 | 1471 | | |
1472 | 1472 | | |
1473 | 1473 | | |
| 1474 | + | |
1474 | 1475 | | |
1475 | 1476 | | |
1476 | 1477 | | |
| |||
1496 | 1497 | | |
1497 | 1498 | | |
1498 | 1499 | | |
| 1500 | + | |
1499 | 1501 | | |
1500 | 1502 | | |
1501 | 1503 | | |
| |||
3100 | 3102 | | |
3101 | 3103 | | |
3102 | 3104 | | |
| 3105 | + | |
3103 | 3106 | | |
3104 | 3107 | | |
3105 | 3108 | | |
3106 | 3109 | | |
3107 | 3110 | | |
| 3111 | + | |
3108 | 3112 | | |
3109 | 3113 | | |
3110 | 3114 | | |
| |||
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
321 | 321 | | |
322 | 322 | | |
323 | 323 | | |
| 324 | + | |
324 | 325 | | |
325 | 326 | | |
326 | 327 | | |
327 | 328 | | |
328 | | - | |
| 329 | + | |
329 | 330 | | |
330 | 331 | | |
331 | 332 | | |
| |||
0 commit comments