How to analyze Solana programs by uploading source code files
File Upload analysis allows you to analyze Solana programs by directly uploading your source code files. This method is ideal for programs that aren't hosted in a public repository or when you want to analyze a specific version of your code without pushing it to GitHub.
To analyze a program using File Upload, you need:
Follow these steps to prepare your code for upload:
Ensure your project is organized correctly:
To reduce the ZIP file size and improve analysis speed, remove unnecessary files:
Create a ZIP file containing your project:
Create your ZIP file from a clean copy of your project that includes only the files needed for analysis. This ensures faster uploads and more efficient processing.
From the Dashboard, click on "New Analysis" and select "File Upload" as your analysis source.
You can upload your ZIP file in two ways:
The maximum file size for uploads is 50MB. If your ZIP file exceeds this limit, try removing unnecessary files or contact support for assistance with larger projects.
After uploading your ZIP file, you can configure additional options:
Click "Start Analysis" to begin. Believe Security will:
Believe Security supports various Solana project structures:
my-solana-program/ ├── Cargo.toml ├── Cargo.lock ├── src/ │ ├── lib.rs │ ├── entrypoint.rs │ ├── processor.rs │ ├── instruction.rs │ ├── state.rs │ └── error.rs └── tests/ └── integration_tests.rs
anchor-program/ ├── Anchor.toml ├── programs/ │ └── my-program/ │ ├── Cargo.toml │ ├── Cargo.lock │ └── src/ │ └── lib.rs ├── tests/ │ └── my-program.ts └── migrations/ └── deploy.ts
solana-workspace/ ├── Cargo.toml (workspace) ├── program-a/ │ ├── Cargo.toml │ └── src/ │ └── lib.rs ├── program-b/ │ ├── Cargo.toml │ └── src/ │ └── lib.rs └── common/ ├── Cargo.toml └── src/ └── lib.rs
For projects with multiple programs or complex structures, you can:
If your project uses custom dependencies or specific versions that aren't available in the public registry, you can include them in your ZIP file:
You can customize your analysis with these advanced options:
If you encounter an "Invalid ZIP file" error:
If Believe Security can't locate a Cargo.toml file:
If there are issues with dependencies:
If your upload times out: