grepleaks 1.1.0 → 1.2.0

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 +17 -3
  2. package/package.json +1 -1
package/bin/grepleaks.js CHANGED
@@ -9,7 +9,7 @@ const readline = require('readline');
9
9
  const { exec } = require('child_process');
10
10
  const archiver = require('archiver');
11
11
 
12
- const VERSION = '1.1.0';
12
+ const VERSION = '1.2.0';
13
13
  const API_URL = 'https://grepleaks.com/api/v1';
14
14
  const WEB_URL = 'https://grepleaks.com';
15
15
  const CONFIG_DIR = path.join(os.homedir(), '.grepleaks');
@@ -282,7 +282,7 @@ function request(method, url, data = null, headers = {}) {
282
282
  }
283
283
 
284
284
  // Upload file with multipart
285
- function uploadFile(url, filePath, token) {
285
+ function uploadFile(url, filePath, token, projectName) {
286
286
  return new Promise((resolve, reject) => {
287
287
  const boundary = '----grepleaks' + Date.now();
288
288
  const fileName = path.basename(filePath);
@@ -316,6 +316,19 @@ function uploadFile(url, filePath, token) {
316
316
 
317
317
  req.on('error', reject);
318
318
 
319
+ // Add project_name field
320
+ req.write(`--${boundary}\r\n`);
321
+ req.write(`Content-Disposition: form-data; name="project_name"\r\n\r\n`);
322
+ req.write(projectName || 'Unknown');
323
+ req.write('\r\n');
324
+
325
+ // Add source field
326
+ req.write(`--${boundary}\r\n`);
327
+ req.write(`Content-Disposition: form-data; name="source"\r\n\r\n`);
328
+ req.write('cli');
329
+ req.write('\r\n');
330
+
331
+ // Add file
319
332
  req.write(`--${boundary}\r\n`);
320
333
  req.write(`Content-Disposition: form-data; name="file"; filename="${fileName}"\r\n`);
321
334
  req.write('Content-Type: application/zip\r\n\r\n');
@@ -625,7 +638,8 @@ async function cmdScan(args) {
625
638
  const uploadRes = await uploadFile(
626
639
  `${API_URL}/scan/async`,
627
640
  tempZip,
628
- creds.access_token
641
+ creds.access_token,
642
+ projectName
629
643
  );
630
644
 
631
645
  if (uploadRes.status !== 202) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "grepleaks",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "Security scanner for your code - detect vulnerabilities, secrets, and misconfigurations",
5
5
  "main": "bin/grepleaks.js",
6
6
  "bin": {