anchor icon indicating copy to clipboard operation
anchor copied to clipboard

Warn users to remove `[provider].wallet` from Anchor.toml path when `anchor publish`-ing

Open serejke opened this issue 2 years ago • 2 comments

Problem anchor publish uploads all the sources including Anchor.toml to APR. Anchor.toml might contain sensitive information (computer's path to the wallet) in the [provider].wallet

[provider]
cluster = "mainnet"
wallet = <sensitive wallet path>

This is what happened to me when I published APR for my smart-contract https://www.apr.dev/program/PLACEMmfm3ZMpYKWfTwzHsTGnPnnDgmK2QkJPeLnZWE?tab=Explorer

I followed the Anchor tutorial on publishing sources and configured the path to the wallet on mainnet and commented the one on the local net. In fact, the wallet option is not used by anchor publish so it was redundant.

Surely, source code must have been sanitised before doing anchor publish but I forgot to check it.

Solution Perform sanity checks and warn users on anchor publish if some option might be sensitive in the project.

serejke avatar Sep 05 '22 12:09 serejke

Through the link I spot these. Is it an critical things that we need to remove?

[provider]
cluster = "localnet"
wallet = "~/.config/solana/id.json"

SkyYap avatar Sep 06 '22 12:09 SkyYap

I've uploaded a new version with the paths replaced. I suppose, the exact default one like this one, is not critical. And for Windows default one whatever it is. But it used to be my machine's one

serejke avatar Sep 06 '22 14:09 serejke

Not sure what the current status of the APR is but certainly worth noting to anyone working on that in the future.

Henry-E avatar Dec 07 '22 19:12 Henry-E