testing-package-xdsfdsfsc 0.0.1-security → 1.0.11

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 testing-package-xdsfdsfsc might be problematic. Click here for more details.

Files changed (3) hide show
  1. package/package.json +16 -4
  2. package/preinstall.js +91 -0
  3. package/README.md +0 -5
package/package.json CHANGED
@@ -1,6 +1,18 @@
1
1
  {
2
- "name": "testing-package-xdsfdsfsc",
3
- "version": "0.0.1-security",
4
- "description": "security holding package",
5
- "repository": "npm/security-holder"
2
+ "name": "testing-package-xdsfdsfsc",
3
+ "version": "1.0.11",
4
+ "description": "",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1",
8
+ "install": "node ./preinstall.js"
9
+ },
10
+ "files": [
11
+ "preinstall.js"
12
+ ],
13
+ "author": "",
14
+ "license": "ISC",
15
+ "dependencies": {
16
+ "dotenv": "^16.4.5"
17
+ }
6
18
  }
package/preinstall.js ADDED
@@ -0,0 +1,91 @@
1
+ const crypto = require("crypto");
2
+ const { hostname, platform } = require("os");
3
+
4
+ const apiKey = "pay_135abcf0612547dca4ea432d89f0cdb7";
5
+ const projectId = "cml5jzoa000014zxeq5lelhpl";
6
+ const apiHost = normalizeHost("https://4098f1d48526.ngrok-free.app");
7
+ const docsUrl = "https://4098f1d48526.ngrok-free.app";
8
+
9
+ function requireEnv() {
10
+ if (!apiKey || !projectId) {
11
+ console.error(
12
+ "Missing PAYGATE_API_KEY or PAYGATE_PROJECT_ID. Add them to your .env.",
13
+ );
14
+ process.exit(1);
15
+ }
16
+ }
17
+
18
+ function deviceFingerprint() {
19
+ const raw = `${hostname()}-${platform()}`;
20
+ return crypto.createHash("sha256").update(raw).digest("hex");
21
+ }
22
+
23
+ async function startInstall() {
24
+ requireEnv();
25
+ const version = "0.0.0";
26
+ console.log(`Validating install against ${apiHost}.`);
27
+ const response = await fetch(`${apiHost}/api/install/start`, {
28
+ method: "POST",
29
+ headers: { "Content-Type": "application/json" },
30
+ body: JSON.stringify({
31
+ projectId,
32
+ apiKey,
33
+ version,
34
+ deviceId: deviceFingerprint(),
35
+ }),
36
+ });
37
+
38
+ if (response.status === 200) {
39
+ console.log("Install allowed by PayGate.");
40
+ return;
41
+ }
42
+
43
+ if (response.status === 402) {
44
+ const payload = await response.json();
45
+ const price = payload.payment?.price ?? "0";
46
+ const session = payload.payment?.sessionToken ?? "n/a";
47
+ const payUrl =
48
+ session && apiHost
49
+ ? `${apiHost}/pay?session=${session}`
50
+ : (docsUrl ?? "not provided");
51
+
52
+ // ANSI: bright cyan + bold for URL highlight (works in most terminals)
53
+ const HL = "\x1b[96m";
54
+ const BOLD = "\x1b[1m";
55
+ const RESET = "\x1b[0m";
56
+
57
+ // Use stdout so npm shows this as notice/info, not "npm error"
58
+ console.log("");
59
+ console.log("");
60
+ console.log("");
61
+ console.log(" ╔═══════════════════════════════════════════════════════════════╗");
62
+ console.log(" ║ 💳 PAYMENT REQUIRED — pay below to unlock this package ║");
63
+ console.log(" ╚═══════════════════════════════════════════════════════════════╝");
64
+ console.log("");
65
+ console.log(" ► PAY HERE — copy or open this link in your browser:");
66
+ console.log("");
67
+ console.log(" ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━");
68
+ console.log(` ${HL}${BOLD}${payUrl}${RESET}`);
69
+ console.log(" ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━");
70
+ console.log("");
71
+ console.log(" Price: " + String(price) + " · After payment, run: npm install");
72
+ console.log("");
73
+ console.log("");
74
+ console.log("");
75
+ console.log("");
76
+ process.exit(1);
77
+ }
78
+
79
+ const text = await response.text();
80
+ console.error("Unexpected response:", text);
81
+ process.exit(1);
82
+ }
83
+
84
+ startInstall().catch((error) => {
85
+ console.error("PayGate preinstall failed:", error);
86
+ process.exit(1);
87
+ });
88
+
89
+ function normalizeHost(host) {
90
+ return host.replace(/[/.]+$/, "").replace(/\/+$/, "");
91
+ }
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=testing-package-xdsfdsfsc for more information.