@tanakayuto/intmax402-cli 0.3.0 → 0.3.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.
Files changed (2) hide show
  1. package/dist/index.js +14 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -38,6 +38,18 @@ async function testCommand(url, mode = "identity") {
38
38
  console.error(chalk_1.default.red("Usage: intmax402 test <url> [--mode identity|payment]"));
39
39
  process.exit(1);
40
40
  }
41
+ // Validate URL: only http:// and https:// are allowed (SSRF prevention)
42
+ try {
43
+ const parsed = new URL(url);
44
+ if (parsed.protocol !== "http:" && parsed.protocol !== "https:") {
45
+ console.error(chalk_1.default.red("Error: Only http:// and https:// URLs are supported"));
46
+ process.exit(1);
47
+ }
48
+ }
49
+ catch {
50
+ console.error(chalk_1.default.red(`Error: Invalid URL: ${url}`));
51
+ process.exit(1);
52
+ }
41
53
  console.log(`Testing: ${chalk_1.default.cyan(url)}\n`);
42
54
  const startTime = Date.now();
43
55
  // Generate a random wallet for testing
@@ -79,8 +91,8 @@ async function testCommand(url, mode = "identity") {
79
91
  if (mode === "payment") {
80
92
  // Payment mode: include a mock txHash
81
93
  const mockTxHash = "0x" + Buffer.alloc(32).fill(0xab).toString("hex");
82
- const message = `${challenge.nonce}:${mockTxHash}`;
83
- const signature = await wallet.signMessage(message);
94
+ // Sign only the nonce (same format as server expects)
95
+ const signature = await wallet.signMessage(challenge.nonce);
84
96
  authHeader = `INTMAX402 address="${address}",nonce="${challenge.nonce}",signature="${signature}",txHash="${mockTxHash}"`;
85
97
  }
86
98
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanakayuto/intmax402-cli",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "main": "dist/index.js",
5
5
  "bin": {
6
6
  "intmax402": "dist/index.js"