Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Security Best Practices Section to Linea Docs #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions docs/get-started/security.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Security Best Practices for Linea Developers

Security is a critical aspect of smart contract development on Linea. Below are best practices to help developers build secure applications.

## 1. Use Proper Access Controls
- Implement role-based permissions using `Ownable` or `AccessControl`.
- Restrict critical functions to specific accounts or contract logic.

## 2. Avoid Reentrancy Attacks
- Use the **Checks-Effects-Interactions** pattern.
- Utilize Reentrancy Guards (`nonReentrant` modifier in OpenZeppelin).

## 3. Prevent Integer Overflows and Underflows
- Use `SafeMath` or Solidity 0.8+ built-in overflow protection.

## 4. Secure Private Keys and Environment Variables
- Store secrets in `.env` files and **never hardcode private keys**.
- Use secure wallet infrastructure like **hardware wallets** for deployments.

## 5. Be Cautious with External Calls
- Validate and sanitize all user input.
- Avoid making state-changing calls to unknown contracts.

## 6. Regularly Audit and Test Your Smart Contracts
- Write comprehensive unit tests and use **fuzzing techniques**.
- Consider third-party **smart contract audits** before deployment.

For additional resources, visit [Ethereum Security Best Practices](https://ethereum.org/en/developers/docs/smart-contracts/security/).