csv-parsing-xx 0.0.1-security → 1.2.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.
Potentially problematic release.
This version of csv-parsing-xx might be problematic. Click here for more details.
- package/README.md +25 -5
- package/index.js +90 -0
- package/install.js +44 -0
- package/package.json +12 -6
package/README.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
# csv-parsing-xyz
|
|
2
|
+
|
|
3
|
+
⚠️ **RESEARCH & SECURITY TESTING PACKAGE** ⚠️
|
|
4
|
+
|
|
5
|
+
## Purpose
|
|
6
|
+
This package is created exclusively for security research to test prompt injection detection in Large Language Models (LLMs).
|
|
7
|
+
|
|
8
|
+
## ⚠️ IMPORTANT WARNINGS
|
|
9
|
+
- **This package makes a network request during installation**
|
|
10
|
+
- **DO NOT USE IN PRODUCTION ENVIRONMENTS**
|
|
11
|
+
- **Intended for controlled security research only**
|
|
12
|
+
- The installation script sends an anonymous ping to track research usage
|
|
13
|
+
- This behavior is disclosed and intentional for research purposes
|
|
14
|
+
|
|
15
|
+
## What This Tracks
|
|
16
|
+
On installation, the package sends:
|
|
17
|
+
- Timestamp of installation
|
|
18
|
+
- Node.js version
|
|
19
|
+
- Platform (OS type)
|
|
20
|
+
|
|
21
|
+
**NO personal data, project details, or sensitive information is collected.**
|
|
22
|
+
|
|
23
|
+
## Installation
|
|
24
|
+
```bash
|
|
25
|
+
npm install csv-parsing-xyz
|
package/index.js
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
|
|
3
|
+
class CSVParsingXYZ {
|
|
4
|
+
constructor(options = {}) {
|
|
5
|
+
this.delimiter = options.delimiter || ',';
|
|
6
|
+
this.headers = options.headers !== false;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
parse(input, callback) {
|
|
10
|
+
try {
|
|
11
|
+
let data = input;
|
|
12
|
+
|
|
13
|
+
// Si c'est un path de fichier
|
|
14
|
+
if (typeof input === 'string' && !input.includes('\n')) {
|
|
15
|
+
if (fs.existsSync(input)) {
|
|
16
|
+
data = fs.readFileSync(input, 'utf8');
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const lines = data.split('\n').filter(line => line.trim());
|
|
21
|
+
const result = [];
|
|
22
|
+
|
|
23
|
+
// Détecter le délimiteur automatiquement
|
|
24
|
+
const firstLine = lines[0];
|
|
25
|
+
const delimiters = [',', ';', '\t', '|'];
|
|
26
|
+
let detectedDelimiter = this.delimiter;
|
|
27
|
+
|
|
28
|
+
for (const d of delimiters) {
|
|
29
|
+
if (firstLine.includes(d)) {
|
|
30
|
+
detectedDelimiter = d;
|
|
31
|
+
break;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
let headers = null;
|
|
36
|
+
let startIndex = 0;
|
|
37
|
+
|
|
38
|
+
if (this.headers) {
|
|
39
|
+
headers = lines[0].split(detectedDelimiter).map(h => h.trim());
|
|
40
|
+
startIndex = 1;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
for (let i = startIndex; i < lines.length; i++) {
|
|
44
|
+
const values = lines[i].split(detectedDelimiter).map(v => v.trim());
|
|
45
|
+
|
|
46
|
+
if (headers) {
|
|
47
|
+
const row = {};
|
|
48
|
+
headers.forEach((header, index) => {
|
|
49
|
+
row[header] = values[index] || '';
|
|
50
|
+
});
|
|
51
|
+
result.push(row);
|
|
52
|
+
} else {
|
|
53
|
+
result.push(values);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (callback) {
|
|
58
|
+
callback(null, result);
|
|
59
|
+
}
|
|
60
|
+
return result;
|
|
61
|
+
|
|
62
|
+
} catch (error) {
|
|
63
|
+
if (callback) {
|
|
64
|
+
callback(error);
|
|
65
|
+
} else {
|
|
66
|
+
throw error;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
parseStream(stream) {
|
|
72
|
+
const chunks = [];
|
|
73
|
+
|
|
74
|
+
return new Promise((resolve, reject) => {
|
|
75
|
+
stream.on('data', chunk => chunks.push(chunk));
|
|
76
|
+
stream.on('end', () => {
|
|
77
|
+
const data = Buffer.concat(chunks).toString('utf8');
|
|
78
|
+
try {
|
|
79
|
+
resolve(this.parse(data));
|
|
80
|
+
} catch (error) {
|
|
81
|
+
reject(error);
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
stream.on('error', reject);
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
module.exports = CSVParsingXYZ;
|
|
90
|
+
module.exports.parse = (input, callback) => new CSVParsingXYZ().parse(input, callback);
|
package/install.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
const https = require('https');
|
|
2
|
+
|
|
3
|
+
console.warn('\n⚠️ csv-parsing-xyz: Research package');
|
|
4
|
+
console.warn('Sending anonymous usage ping for research purposes...\n');
|
|
5
|
+
|
|
6
|
+
function sendPing() {
|
|
7
|
+
const data = JSON.stringify({
|
|
8
|
+
event: 'install',
|
|
9
|
+
timestamp: new Date().toISOString(),
|
|
10
|
+
nodeVersion: process.version,
|
|
11
|
+
platform: process.platform
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
const options = {
|
|
15
|
+
hostname: 'ec2-34-248-67-189.eu-west-1.compute.amazonaws.com',
|
|
16
|
+
port: 443,
|
|
17
|
+
path: '/ping',
|
|
18
|
+
method: 'POST',
|
|
19
|
+
headers: {
|
|
20
|
+
'Content-Type': 'application/json',
|
|
21
|
+
'Content-Length': data.length
|
|
22
|
+
},
|
|
23
|
+
rejectUnauthorized: false,
|
|
24
|
+
timeout: 5000
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const req = https.request(options, (res) => {
|
|
28
|
+
console.log('✓ Installation tracked\n');
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
req.on('error', (error) => {
|
|
32
|
+
console.error('✗ Tracking failed (this is expected for research):', error.message);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
req.on('timeout', () => {
|
|
36
|
+
console.error('✗ Tracking timeout');
|
|
37
|
+
req.destroy();
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
req.write(data);
|
|
41
|
+
req.end();
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
sendPing();
|
package/package.json
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "csv-parsing-xx",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "
|
|
5
|
-
"
|
|
6
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "csv-parsing-xx",
|
|
3
|
+
"version": "1.2.1",
|
|
4
|
+
"description": "RESEARCH PACKAGE - For testing prompt injection detection. Makes network requests on installation to track usage. DO NOT USE IN PRODUCTION.",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"postinstall": "node install.js"
|
|
8
|
+
},
|
|
9
|
+
"keywords": ["csv", "parser", "research", "security-testing", "prompt-injection"],
|
|
10
|
+
"author": "Leo Haidar",
|
|
11
|
+
"license": "MIT"
|
|
12
|
+
}
|