Skip to content

Instantly share code, notes, and snippets.

@onur-ozkan
Last active May 25, 2022 07:39
Show Gist options
  • Save onur-ozkan/725f56c05a2eb01e0428f03191f8da86 to your computer and use it in GitHub Desktop.
Save onur-ozkan/725f56c05a2eb01e0428f03191f8da86 to your computer and use it in GitHub Desktop.

Metamask has their own method for using services in a dapp that require authority. However, I find it pretty unsafe. It took around 1 hour for me to figure out the INFURA_PROJECT_ID.

When you check the source code, you can't see the hard-coded api keys. They use environment variable instead, and provide it from the builder machine. So the key must be inside of the build files.

2022-05-25_09-55

In Metamask's browser extension, all the magic happens in the background.html running background.js which runs like a background worker. So you can't track the network on dev-tools if you don't have background.html page opened.

2022-05-25_10-11

But, if you open the background.html page, there you can track the network operations and find the INFURA_PROJECT_ID

2022-05-25_10-12

You can also find it by using browser's debugging feature.

2022-05-25_10-15

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