@wrongstack/plugins 0.257.0 → 0.260.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.
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@ import { execFileSync, execSync } from 'child_process';
2
2
  import { watch, existsSync, readFileSync, writeFileSync, readdirSync } from 'fs';
3
3
  import * as path from 'path';
4
4
  import { isAbsolute, join } from 'path';
5
- import { expectDefined, deepMerge as deepMerge$1 } from '@wrongstack/core';
5
+ import { expectDefined, deepMerge as deepMerge$1, isPrivateIPv4, isPrivateIPv6 } from '@wrongstack/core';
6
6
  import { lookup } from 'dns/promises';
7
7
  import { isIPv4, isIPv6 } from 'net';
8
8
 
@@ -1392,29 +1392,6 @@ async function duckduckgoSearch(query, numResults) {
1392
1392
  }
1393
1393
  return results;
1394
1394
  }
1395
- function isPrivateIPv4(host) {
1396
- const parts = host.split(".").map(Number);
1397
- if (parts.length !== 4 || parts.some((n) => !Number.isInteger(n) || n < 0 || n > 255)) return true;
1398
- const [a, b] = parts;
1399
- return a === 0 || // 0.0.0.0/8 "this host"
1400
- a === 10 || // private
1401
- a === 127 || // loopback
1402
- a === 100 && b >= 64 && b <= 127 || // CGNAT 100.64/10
1403
- a === 169 && b === 254 || // link-local incl. 169.254.169.254 (cloud IMDS)
1404
- a === 172 && b >= 16 && b <= 31 || // private
1405
- a === 192 && b === 168 || // private
1406
- a >= 224;
1407
- }
1408
- function isPrivateIPv6(raw) {
1409
- const host = raw.toLowerCase();
1410
- if (host === "::1" || host === "::") return true;
1411
- const mapped = host.match(/(?:::ffff:)?(\d+\.\d+\.\d+\.\d+)$/);
1412
- if (mapped?.[1]) return isPrivateIPv4(mapped[1]);
1413
- if (host.startsWith("fc") || host.startsWith("fd")) return true;
1414
- if (host.startsWith("fe8") || host.startsWith("fe9") || host.startsWith("fea") || host.startsWith("feb"))
1415
- return true;
1416
- return false;
1417
- }
1418
1395
  function assertSafeIp(ip) {
1419
1396
  if (isIPv4(ip) && isPrivateIPv4(ip)) {
1420
1397
  throw new Error(`Blocked private/loopback address: ${ip}`);
@@ -1,5 +1,6 @@
1
1
  import { lookup } from 'dns/promises';
2
2
  import { isIPv4, isIPv6 } from 'net';
3
+ import { isPrivateIPv4, isPrivateIPv6 } from '@wrongstack/core';
3
4
 
4
5
  // src/web-search/index.ts
5
6
  var API_VERSION = "^0.1.10";
@@ -31,29 +32,6 @@ async function duckduckgoSearch(query, numResults) {
31
32
  }
32
33
  return results;
33
34
  }
34
- function isPrivateIPv4(host) {
35
- const parts = host.split(".").map(Number);
36
- if (parts.length !== 4 || parts.some((n) => !Number.isInteger(n) || n < 0 || n > 255)) return true;
37
- const [a, b] = parts;
38
- return a === 0 || // 0.0.0.0/8 "this host"
39
- a === 10 || // private
40
- a === 127 || // loopback
41
- a === 100 && b >= 64 && b <= 127 || // CGNAT 100.64/10
42
- a === 169 && b === 254 || // link-local incl. 169.254.169.254 (cloud IMDS)
43
- a === 172 && b >= 16 && b <= 31 || // private
44
- a === 192 && b === 168 || // private
45
- a >= 224;
46
- }
47
- function isPrivateIPv6(raw) {
48
- const host = raw.toLowerCase();
49
- if (host === "::1" || host === "::") return true;
50
- const mapped = host.match(/(?:::ffff:)?(\d+\.\d+\.\d+\.\d+)$/);
51
- if (mapped?.[1]) return isPrivateIPv4(mapped[1]);
52
- if (host.startsWith("fc") || host.startsWith("fd")) return true;
53
- if (host.startsWith("fe8") || host.startsWith("fe9") || host.startsWith("fea") || host.startsWith("feb"))
54
- return true;
55
- return false;
56
- }
57
35
  function assertSafeIp(ip) {
58
36
  if (isIPv4(ip) && isPrivateIPv4(ip)) {
59
37
  throw new Error(`Blocked private/loopback address: ${ip}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wrongstack/plugins",
3
- "version": "0.257.0",
3
+ "version": "0.260.0",
4
4
  "description": "Official WrongStack plugin collection — auto-doc, git-autocommit, shell-check, cost-tracker, file-watcher, web-search, json-path, cron, template-engine, semver-bump",
5
5
  "license": "MIT",
6
6
  "author": "ECOSTACK TECHNOLOGY OÜ",
@@ -63,7 +63,7 @@
63
63
  "vitest": "^4.1.8"
64
64
  },
65
65
  "dependencies": {
66
- "@wrongstack/core": "0.257.0"
66
+ "@wrongstack/core": "0.260.0"
67
67
  },
68
68
  "scripts": {
69
69
  "build": "tsup",