MetaMask / MetaMask/snaps

wallet_requestSnaps always show install dialog in different localhost sites

Open
#2,376 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
853
Forks
662
Avg merge
2d 8h
Merged PRs (30d)
8

Description

I create two site A and site B in localhost. In site A, I have installed snap A(running in 8080). The snap's config is:

```
{
"version": "0.1.0",
"description": "SnapA",
"proposedName": "SnapA",
"repository": {
"type": "git",
"url": "https://github.com/MetaMask/template-snap-monorepo.git"
},
"source": {
"shasum": "63qRiHOi37RFs/GvzuscNwJ3wmyzz16bpckmJM7VUqI=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
"packageName": "snap-a",
"registry": "https://registry.npmjs.org/",
"iconPath": "images/logo.svg"
}
}
},
"initialPermissions": {
"snap_dialog": {},
"endowment:rpc": {
"dapps": true,
"snaps": true
},
"snap_manageState": {},
"endowment:network-access": {},
"endowment:page-home": {},
"endowment:ethereum-provider": {},
"endowment:cronjob": {
"jobs": [
{
"expression": "*/10 * * * * *",
"request": {
"method": "alert"
}
}
]
}
},
"manifestVersion": "0.1"
}

```

And in site B, I used wallet_requestSnaps to request permission to connect to the snap A, there is always an install dialog to install snap A.

```
const snap = await request({
method: 'wallet_requestSnaps',
params: {
'local:http://localhost:8080': {},
},
});
```

Contributor guide

Open the contributing guide

Research direction

Start by tracing the wallet_requestSnaps handling for local snap requests and how permissions are associated with different localhost sites. Reproduce the two-site setup described in the issue and inspect the existing permission state. Done means an already installed snap does not trigger an install dialog when requested from another localhost site, if that is the intended behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.