web3guard-cli 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api.js +8 -2
- package/dist/cli.js +9 -3
- package/package.json +1 -1
package/dist/api.js
CHANGED
|
@@ -56,7 +56,13 @@ async function scanContract(filePath) {
|
|
|
56
56
|
throw new Error(`File not found: ${absolutePath}`);
|
|
57
57
|
}
|
|
58
58
|
const sourceCode = fs.readFileSync(absolutePath, 'utf8');
|
|
59
|
-
|
|
59
|
+
let ecosystem = 'Rust';
|
|
60
|
+
if (absolutePath.endsWith('.sol'))
|
|
61
|
+
ecosystem = 'Solidity';
|
|
62
|
+
else if (absolutePath.endsWith('.move'))
|
|
63
|
+
ecosystem = 'Move';
|
|
64
|
+
else if (absolutePath.endsWith('.cairo'))
|
|
65
|
+
ecosystem = 'Cairo';
|
|
60
66
|
const response = await client.post('/scan', {
|
|
61
67
|
source_code: sourceCode,
|
|
62
68
|
ecosystem: ecosystem,
|
|
@@ -79,7 +85,7 @@ function findContracts(dir) {
|
|
|
79
85
|
}
|
|
80
86
|
}
|
|
81
87
|
else {
|
|
82
|
-
if (filePath.endsWith('.rs') || filePath.endsWith('.sol')) {
|
|
88
|
+
if (filePath.endsWith('.rs') || filePath.endsWith('.sol') || filePath.endsWith('.move') || filePath.endsWith('.cairo')) {
|
|
83
89
|
results.push(filePath);
|
|
84
90
|
}
|
|
85
91
|
}
|
package/dist/cli.js
CHANGED
|
@@ -62,7 +62,7 @@ program
|
|
|
62
62
|
if (options.staged) {
|
|
63
63
|
try {
|
|
64
64
|
const output = (0, child_process_1.execSync)('git diff --cached --name-only --diff-filter=ACM').toString();
|
|
65
|
-
filesToScan = output.split('\n').filter(f => f.endsWith('.rs') || f.endsWith('.sol')).map(f => f.trim()).filter(f => f.length > 0);
|
|
65
|
+
filesToScan = output.split('\n').filter(f => f.endsWith('.rs') || f.endsWith('.sol') || f.endsWith('.move') || f.endsWith('.cairo')).map(f => f.trim()).filter(f => f.length > 0);
|
|
66
66
|
}
|
|
67
67
|
catch (e) {
|
|
68
68
|
console.error(chalk_1.default.red('Error running git command. Are you in a git repository?'));
|
|
@@ -89,7 +89,7 @@ program
|
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
if (filesToScan.length === 0) {
|
|
92
|
-
console.log(chalk_1.default.yellow('No .rs or .
|
|
92
|
+
console.log(chalk_1.default.yellow('No .rs, .sol, .move, or .cairo files found to scan.'));
|
|
93
93
|
return;
|
|
94
94
|
}
|
|
95
95
|
let allResults = [];
|
|
@@ -122,7 +122,13 @@ program
|
|
|
122
122
|
allResults.forEach(({ file, result, error }) => {
|
|
123
123
|
console.log(`\n${chalk_1.default.cyan.bold(file)}:`);
|
|
124
124
|
if (error) {
|
|
125
|
-
|
|
125
|
+
if (String(error).includes("429") || String(error).toLowerCase().includes("exhausted")) {
|
|
126
|
+
console.log(chalk_1.default.bgRed.white.bold(' ⏳ AI SCANNER RATE LIMITED '));
|
|
127
|
+
console.log(chalk_1.default.yellow('The backend is under heavy load. Exponential backoff retry limit reached. Please try again in a few seconds.'));
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
console.log(chalk_1.default.red(`Error: ${error}`));
|
|
131
|
+
}
|
|
126
132
|
return;
|
|
127
133
|
}
|
|
128
134
|
if (result.vulnerabilities && result.vulnerabilities.length > 0) {
|