Skip to main content

Upload File to 0G Storage

Facilitates file uploads to 0G decentralized storage, ensuring data integrity with Merkle tree organization and secure retrieval.

Install this skill

or
22/100

Security score

The Upload File to 0G Storage skill was audited on Feb 25, 2026 and we found 30 security issues across 2 threat categories. Review the findings below before installing.

Categories Tested

Security Issues

medium line 66

Template literal with variable interpolation in command context

SourceSKILL.md
66if (err) throw new Error(`Merkle tree error: ${err}`);
medium line 72

Template literal with variable interpolation in command context

SourceSKILL.md
72if (uploadErr) throw new Error(`Upload failed: ${uploadErr.message}`);
medium line 102

Template literal with variable interpolation in command context

SourceSKILL.md
102const tempPath = path.join(os.tmpdir(), `0g-upload-${Date.now()}-${filename}`);
medium line 108

Template literal with variable interpolation in command context

SourceSKILL.md
108if (err) throw new Error(`Merkle tree error: ${err}`);
medium line 112

Template literal with variable interpolation in command context

SourceSKILL.md
112if (uploadErr) throw new Error(`Upload failed: ${uploadErr.message}`);
medium line 140

Template literal with variable interpolation in command context

SourceSKILL.md
140if (!fs.existsSync(filePath)) throw new Error(`File not found: ${filePath}`);
medium line 144

Template literal with variable interpolation in command context

SourceSKILL.md
144console.log(`Uploading ${filePath} (${stats.size} bytes)...`);
medium line 159

Template literal with variable interpolation in command context

SourceSKILL.md
159if (err) throw new Error(`Merkle tree generation failed: ${err}`);
medium line 166

Template literal with variable interpolation in command context

SourceSKILL.md
166if (uploadErr) throw new Error(`Upload failed: ${uploadErr.message}`);
medium line 20

Access to .env file

SourceSKILL.md
20- `.env` with `PRIVATE_KEY`, `RPC_URL`, `STORAGE_INDEXER`
medium line 24

Access to .env file

SourceSKILL.md
241. Initialize ethers provider and wallet from `.env`
low line 59

Access to .env file

SourceSKILL.md
59const provider = new ethers.JsonRpcProvider(process.env.RPC_URL);
low line 60

Access to .env file

SourceSKILL.md
60const wallet = new ethers.Wallet(process.env.PRIVATE_KEY!, provider);
low line 61

Access to .env file

SourceSKILL.md
61const indexer = new Indexer(process.env.STORAGE_INDEXER!);
low line 71

Access to .env file

SourceSKILL.md
71const [tx, uploadErr] = await indexer.upload(file, process.env.RPC_URL!, wallet);
low line 97

Access to .env file

SourceSKILL.md
97const provider = new ethers.JsonRpcProvider(process.env.RPC_URL);
low line 98

Access to .env file

SourceSKILL.md
98const wallet = new ethers.Wallet(process.env.PRIVATE_KEY!, provider);
low line 99

Access to .env file

SourceSKILL.md
99const indexer = new Indexer(process.env.STORAGE_INDEXER!);
low line 111

Access to .env file

SourceSKILL.md
111const [, uploadErr] = await indexer.upload(file, process.env.RPC_URL!, wallet);
low line 135

Access to .env file

SourceSKILL.md
135if (!process.env.PRIVATE_KEY) throw new Error('PRIVATE_KEY not set in .env');
low line 136

Access to .env file

SourceSKILL.md
136if (!process.env.RPC_URL) throw new Error('RPC_URL not set in .env');
low line 137

Access to .env file

SourceSKILL.md
137if (!process.env.STORAGE_INDEXER) throw new Error('STORAGE_INDEXER not set in .env');
low line 146

Access to .env file

SourceSKILL.md
146const provider = new ethers.JsonRpcProvider(process.env.RPC_URL);
low line 147

Access to .env file

SourceSKILL.md
147const wallet = new ethers.Wallet(process.env.PRIVATE_KEY!, provider);
low line 153

Access to .env file

SourceSKILL.md
153const indexer = new Indexer(process.env.STORAGE_INDEXER!);
low line 165

Access to .env file

SourceSKILL.md
165const [tx, uploadErr] = await indexer.upload(file, process.env.RPC_URL!, wallet);
low line 182

Access to .env file

SourceSKILL.md
182await indexer.upload(file, process.env.RPC_URL!, wallet);
low line 187

Access to .env file

SourceSKILL.md
187await indexer.upload(file, process.env.RPC_URL!, wallet); // May fail or produce invalid upload
low line 194

Access to .env file

SourceSKILL.md
194await indexer.upload(file, process.env.RPC_URL!, wallet); // Root hash lost!
medium line 206

Access to .env file

SourceSKILL.md
206| `indexer not available` | Wrong indexer URL | Check `STORAGE_INDEXER` in `.env` |
Scanned on Feb 25, 2026
View Security Dashboard