grepleaks 1.4.1 → 1.4.3

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.
Files changed (2) hide show
  1. package/bin/grepleaks.js +14 -8
  2. package/package.json +3 -2
package/bin/grepleaks.js CHANGED
@@ -8,7 +8,7 @@ const http = require('http');
8
8
  const archiver = require('archiver');
9
9
  const readline = require('readline');
10
10
 
11
- const API_URL = 'http://grepleaks.com';
11
+ const API_URL = 'https://grepleaks.com';
12
12
  const CONFIG_FILE = '.grepleaksrc';
13
13
 
14
14
  // Colors for terminal output
@@ -138,8 +138,11 @@ async function createZip() {
138
138
 
139
139
  // Send scan request to API (async endpoint with AI analysis)
140
140
  async function sendScan(zipPath, apiKey) {
141
+ // Get project name from current directory
142
+ const projectName = path.basename(process.cwd());
143
+
141
144
  // Step 1: Submit the scan job
142
- const jobId = await submitScanJob(zipPath, apiKey);
145
+ const jobId = await submitScanJob(zipPath, apiKey, projectName);
143
146
 
144
147
  // Step 2: Poll for completion
145
148
  logInfo('Processing with analysis...');
@@ -149,7 +152,7 @@ async function sendScan(zipPath, apiKey) {
149
152
  }
150
153
 
151
154
  // Submit scan job to async endpoint
152
- function submitScanJob(zipPath, apiKey) {
155
+ function submitScanJob(zipPath, apiKey, projectName) {
153
156
  return new Promise((resolve, reject) => {
154
157
  const boundary = '----FormBoundary' + Math.random().toString(36).slice(2);
155
158
  const fileContent = fs.readFileSync(zipPath);
@@ -157,7 +160,10 @@ function submitScanJob(zipPath, apiKey) {
157
160
  const bodyParts = [
158
161
  `--${boundary}\r\n`,
159
162
  `Content-Disposition: form-data; name="source"\r\n\r\n`,
160
- `terminal\r\n`,
163
+ `cli\r\n`,
164
+ `--${boundary}\r\n`,
165
+ `Content-Disposition: form-data; name="project_name"\r\n\r\n`,
166
+ `${projectName}\r\n`,
161
167
  `--${boundary}\r\n`,
162
168
  `Content-Disposition: form-data; name="file"; filename="code.zip"\r\n`,
163
169
  `Content-Type: application/zip\r\n\r\n`,
@@ -171,7 +177,7 @@ function submitScanJob(zipPath, apiKey) {
171
177
  const url = new URL(`${API_URL}/api/v1/scan/async`);
172
178
  const options = {
173
179
  hostname: url.hostname,
174
- port: url.port || 80,
180
+ port: url.port || 443,
175
181
  path: url.pathname,
176
182
  method: 'POST',
177
183
  headers: {
@@ -181,7 +187,7 @@ function submitScanJob(zipPath, apiKey) {
181
187
  },
182
188
  };
183
189
 
184
- const req = http.request(options, (res) => {
190
+ const req = https.request(options, (res) => {
185
191
  let data = '';
186
192
  res.on('data', (chunk) => data += chunk);
187
193
  res.on('end', () => {
@@ -217,7 +223,7 @@ function pollForCompletion(jobId, apiKey, maxAttempts = 60) {
217
223
  const url = new URL(`${API_URL}/api/v1/scan/${jobId}/status`);
218
224
  const options = {
219
225
  hostname: url.hostname,
220
- port: url.port || 80,
226
+ port: url.port || 443,
221
227
  path: url.pathname,
222
228
  method: 'GET',
223
229
  headers: {
@@ -225,7 +231,7 @@ function pollForCompletion(jobId, apiKey, maxAttempts = 60) {
225
231
  },
226
232
  };
227
233
 
228
- const req = http.request(options, (res) => {
234
+ const req = https.request(options, (res) => {
229
235
  let data = '';
230
236
  res.on('data', (chunk) => data += chunk);
231
237
  res.on('end', () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "grepleaks",
3
- "version": "1.4.1",
3
+ "version": "1.4.3",
4
4
  "description": "Security scanner for your code - detect vulnerabilities, secrets, and misconfigurations",
5
5
  "main": "bin/grepleaks.js",
6
6
  "bin": {
@@ -34,6 +34,7 @@
34
34
  "bin/"
35
35
  ],
36
36
  "dependencies": {
37
- "archiver": "^7.0.1"
37
+ "archiver": "^7.0.1",
38
+ "grepleaks": "^1.4.1"
38
39
  }
39
40
  }