fix: add security warning for raw PRIVATE_KEY usage in launch-token guide#1374
fix: add security warning for raw PRIVATE_KEY usage in launch-token guide#1374schoolkamsergj wants to merge 2 commits intobase:masterfrom
Conversation
…uide
The launch-token guide used vm.envUint("PRIVATE_KEY") without any
security warning, while the deploy-smart-contracts guide explicitly
recommends cast wallet import (keystore) as the safer approach.
Added a Warning callout before the .env configuration block to:
- Alert developers that raw PRIVATE_KEY in .env is for local/testing only
- Recommend cast wallet import for production deployments
- Link to the deploy-smart-contracts guide for the secure approach
Fixes base#1357
🟡 Heimdall Review Status
|
|
Review Error for Jhosepin @ 2026-05-02 00:35:39 UTC |
|
Thanks for picking this up! I'd also suggest mentioning in the note that .env files should be added to .gitignore to prevent accidental key commits — might be worth adding while this is open. |
Good point! I'll update the Warning block to also mention |
Added a reminder to include '.env' in .gitignore to prevent accidental key commits.
|
Done — updated the |
Summary
Fixes #1357
The
launch-tokenguide usedvm.envUint("PRIVATE_KEY")to load a private key directly from a.envfile, but provided no security warning about the risks — while thedeploy-smart-contractsguide on the same site explicitly recommendscast wallet import deployer --interactiveas the safer approach and warns: "Never share or commit your private key."This inconsistency could lead developers (especially those new to Foundry) to accidentally expose their private keys in local
.envfiles or commit them to version control.Changes
Added a
<Warning>callout directly before the.envconfiguration block indocs/get-started/launch-token.mdx:PRIVATE_KEYapproach is for local development and testing only.envor share the private keydeploy-smart-contractsguide for the recommendedcast wallet importkeystore approachWhy this matters
Both guides are in the same
get-startedsection and developers often follow them together. Without this warning, a developer could reasonably assume the raw env var approach is acceptable for production — leading to potential key exposure.This is a minimal, targeted fix that resolves the inconsistency without rewriting either guide.