Skip to content

fix: add security warning for raw PRIVATE_KEY usage in launch-token guide#1374

Open
schoolkamsergj wants to merge 1 commit intobase:masterfrom
schoolkamsergj:fix/launch-token-private-key-warning
Open

fix: add security warning for raw PRIVATE_KEY usage in launch-token guide#1374
schoolkamsergj wants to merge 1 commit intobase:masterfrom
schoolkamsergj:fix/launch-token-private-key-warning

Conversation

@schoolkamsergj
Copy link
Copy Markdown

Summary

Fixes #1357

The launch-token guide used vm.envUint("PRIVATE_KEY") to load a private key directly from a .env file, but provided no security warning about the risks — while the deploy-smart-contracts guide on the same site explicitly recommends cast wallet import deployer --interactive as 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 .env files or commit them to version control.

Changes

Added a <Warning> callout directly before the .env configuration block in docs/get-started/launch-token.mdx:

  • Clearly states the raw PRIVATE_KEY approach is for local development and testing only
  • Warns never to commit .env or share the private key
  • Links to the deploy-smart-contracts guide for the recommended cast wallet import keystore approach

Why this matters

Both guides are in the same get-started section 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.

…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
@cb-heimdall
Copy link
Copy Markdown
Collaborator

🟡 Heimdall Review Status

Requirement Status More Info
Reviews 🟡 0/2
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 1
Sum 2

@cb-heimdall
Copy link
Copy Markdown
Collaborator

Review Error for Jhosepin @ 2026-05-02 00:35:39 UTC
User failed mfa authentication, either user does not exist or public email is not set on your github profile. \ see go/mfa-help

@knisaci
Copy link
Copy Markdown

knisaci commented May 2, 2026

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.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Launch a Token guide uses raw PRIVATE_KEY env variable, contradicting Deploy Smart Contracts guide's safer keystore approach

4 participants