@ever-works/bluesky-connector-plugin 1.0.2 → 1.0.3

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.cjs CHANGED
@@ -40847,6 +40847,7 @@ function isSafeWebhookUrl(rawUrl) {
40847
40847
  if (host.startsWith("[") && host.endsWith("]")) {
40848
40848
  host = host.slice(1, -1);
40849
40849
  }
40850
+ host = host.replace(/\.+$/, "");
40850
40851
  if (CLOUD_METADATA_HOSTNAMES.has(host)) {
40851
40852
  return false;
40852
40853
  }
@@ -40876,23 +40877,69 @@ function isPrivateIPv4(ip) {
40876
40877
  if (a === 172 && b >= 16 && b <= 31) return true;
40877
40878
  if (a === 192 && b === 168) return true;
40878
40879
  if (a === 192 && b === 0 && parts[2] === 0) return true;
40880
+ if (a === 198 && (b === 18 || b === 19)) return true;
40881
+ if (a === 192 && b === 0 && parts[2] === 2) return true;
40882
+ if (a === 198 && b === 51 && parts[2] === 100) return true;
40883
+ if (a === 203 && b === 0 && parts[2] === 113) return true;
40879
40884
  if (a === 100 && b >= 64 && b <= 127) return true;
40880
40885
  if (a >= 224) return true;
40881
40886
  return false;
40882
40887
  }
40883
- function isPrivateIPv6(ip) {
40884
- const lower = ip.toLowerCase();
40885
- if (lower === "::1" || lower === "::") return true;
40886
- if (lower.startsWith("fc") || lower.startsWith("fd")) return true;
40887
- const firstHextet = lower.split(":", 1)[0];
40888
- if (/^[0-9a-f]{1,4}$/.test(firstHextet)) {
40889
- const group0 = parseInt(firstHextet, 16);
40890
- if ((group0 & 65472) === 65152) return true;
40891
- }
40892
- if (lower.startsWith("::ffff:")) {
40893
- const v4 = lower.slice("::ffff:".length);
40894
- if (net.isIP(v4) === 4) return isPrivateIPv4(v4);
40888
+ function parseIPv6Groups(ip) {
40889
+ let text = ip.trim().toLowerCase();
40890
+ const zone = text.indexOf("%");
40891
+ if (zone >= 0) text = text.slice(0, zone);
40892
+ if (net.isIP(text) !== 6) return null;
40893
+ const lastColon = text.lastIndexOf(":");
40894
+ const tail = text.slice(lastColon + 1);
40895
+ if (tail.includes(".")) {
40896
+ if (net.isIP(tail) !== 4) return null;
40897
+ const [a, b, c, d] = tail.split(".").map((part) => Number(part));
40898
+ text = `${text.slice(0, lastColon + 1)}${(a << 8 | b).toString(16)}:${(c << 8 | d).toString(16)}`;
40899
+ }
40900
+ const halves = text.split("::");
40901
+ if (halves.length > 2) return null;
40902
+ const head = halves[0] ? halves[0].split(":") : [];
40903
+ const rest = halves.length === 2 && halves[1] ? halves[1].split(":") : [];
40904
+ const fill = halves.length === 2 ? 8 - head.length - rest.length : 0;
40905
+ if (fill < 0) return null;
40906
+ const groups = [...head, ...new Array(fill).fill("0"), ...rest].map((group) => parseInt(group, 16));
40907
+ if (groups.length !== 8 || groups.some((group) => Number.isNaN(group) || group < 0 || group > 65535)) {
40908
+ return null;
40895
40909
  }
40910
+ return groups;
40911
+ }
40912
+ function ipv4FromGroups(high, low) {
40913
+ return `${high >> 8}.${high & 255}.${low >> 8}.${low & 255}`;
40914
+ }
40915
+ function embeddedIPv4(ip) {
40916
+ const g = parseIPv6Groups(ip);
40917
+ if (!g) return null;
40918
+ const zeros = (from3, to) => g.slice(from3, to).every((group) => group === 0);
40919
+ if (zeros(0, 5) && g[5] === 65535) return ipv4FromGroups(g[6], g[7]);
40920
+ if (zeros(0, 4) && g[4] === 65535 && g[5] === 0) return ipv4FromGroups(g[6], g[7]);
40921
+ if (zeros(0, 6) && (g[6] !== 0 || g[7] > 1)) return ipv4FromGroups(g[6], g[7]);
40922
+ if (g[0] === 100 && g[1] === 65435 && zeros(2, 6)) return ipv4FromGroups(g[6], g[7]);
40923
+ if (g[0] === 8194) return ipv4FromGroups(g[1], g[2]);
40924
+ if (g[0] === 8193 && g[1] === 0) return ipv4FromGroups(g[6] ^ 65535, g[7] ^ 65535);
40925
+ return null;
40926
+ }
40927
+ function isPrivateIPv6(ip) {
40928
+ const g = parseIPv6Groups(ip);
40929
+ if (!g) {
40930
+ const lower = ip.toLowerCase();
40931
+ return lower === "::1" || lower === "::" || lower.startsWith("fc") || lower.startsWith("fd");
40932
+ }
40933
+ if (g.every((group) => group === 0)) return true;
40934
+ if (g.slice(0, 7).every((group) => group === 0) && g[7] === 1) return true;
40935
+ if ((g[0] & 65024) === 64512) return true;
40936
+ if ((g[0] & 65472) === 65152) return true;
40937
+ if ((g[0] & 65472) === 65216) return true;
40938
+ if ((g[0] & 65280) === 65280) return true;
40939
+ if (g[0] === 8193 && g[1] === 3512) return true;
40940
+ if (g[0] === 100 && g[1] === 65435 && g[2] === 1) return true;
40941
+ const v4 = embeddedIPv4(ip);
40942
+ if (v4 && isPrivateIPv4(v4)) return true;
40896
40943
  return false;
40897
40944
  }
40898
40945
 
package/dist/index.js CHANGED
@@ -40839,6 +40839,7 @@ function isSafeWebhookUrl(rawUrl) {
40839
40839
  if (host.startsWith("[") && host.endsWith("]")) {
40840
40840
  host = host.slice(1, -1);
40841
40841
  }
40842
+ host = host.replace(/\.+$/, "");
40842
40843
  if (CLOUD_METADATA_HOSTNAMES.has(host)) {
40843
40844
  return false;
40844
40845
  }
@@ -40868,23 +40869,69 @@ function isPrivateIPv4(ip) {
40868
40869
  if (a === 172 && b >= 16 && b <= 31) return true;
40869
40870
  if (a === 192 && b === 168) return true;
40870
40871
  if (a === 192 && b === 0 && parts[2] === 0) return true;
40872
+ if (a === 198 && (b === 18 || b === 19)) return true;
40873
+ if (a === 192 && b === 0 && parts[2] === 2) return true;
40874
+ if (a === 198 && b === 51 && parts[2] === 100) return true;
40875
+ if (a === 203 && b === 0 && parts[2] === 113) return true;
40871
40876
  if (a === 100 && b >= 64 && b <= 127) return true;
40872
40877
  if (a >= 224) return true;
40873
40878
  return false;
40874
40879
  }
40875
- function isPrivateIPv6(ip) {
40876
- const lower = ip.toLowerCase();
40877
- if (lower === "::1" || lower === "::") return true;
40878
- if (lower.startsWith("fc") || lower.startsWith("fd")) return true;
40879
- const firstHextet = lower.split(":", 1)[0];
40880
- if (/^[0-9a-f]{1,4}$/.test(firstHextet)) {
40881
- const group0 = parseInt(firstHextet, 16);
40882
- if ((group0 & 65472) === 65152) return true;
40883
- }
40884
- if (lower.startsWith("::ffff:")) {
40885
- const v4 = lower.slice("::ffff:".length);
40886
- if (isIP(v4) === 4) return isPrivateIPv4(v4);
40880
+ function parseIPv6Groups(ip) {
40881
+ let text = ip.trim().toLowerCase();
40882
+ const zone = text.indexOf("%");
40883
+ if (zone >= 0) text = text.slice(0, zone);
40884
+ if (isIP(text) !== 6) return null;
40885
+ const lastColon = text.lastIndexOf(":");
40886
+ const tail = text.slice(lastColon + 1);
40887
+ if (tail.includes(".")) {
40888
+ if (isIP(tail) !== 4) return null;
40889
+ const [a, b, c, d] = tail.split(".").map((part) => Number(part));
40890
+ text = `${text.slice(0, lastColon + 1)}${(a << 8 | b).toString(16)}:${(c << 8 | d).toString(16)}`;
40891
+ }
40892
+ const halves = text.split("::");
40893
+ if (halves.length > 2) return null;
40894
+ const head = halves[0] ? halves[0].split(":") : [];
40895
+ const rest = halves.length === 2 && halves[1] ? halves[1].split(":") : [];
40896
+ const fill = halves.length === 2 ? 8 - head.length - rest.length : 0;
40897
+ if (fill < 0) return null;
40898
+ const groups = [...head, ...new Array(fill).fill("0"), ...rest].map((group) => parseInt(group, 16));
40899
+ if (groups.length !== 8 || groups.some((group) => Number.isNaN(group) || group < 0 || group > 65535)) {
40900
+ return null;
40887
40901
  }
40902
+ return groups;
40903
+ }
40904
+ function ipv4FromGroups(high, low) {
40905
+ return `${high >> 8}.${high & 255}.${low >> 8}.${low & 255}`;
40906
+ }
40907
+ function embeddedIPv4(ip) {
40908
+ const g = parseIPv6Groups(ip);
40909
+ if (!g) return null;
40910
+ const zeros = (from3, to) => g.slice(from3, to).every((group) => group === 0);
40911
+ if (zeros(0, 5) && g[5] === 65535) return ipv4FromGroups(g[6], g[7]);
40912
+ if (zeros(0, 4) && g[4] === 65535 && g[5] === 0) return ipv4FromGroups(g[6], g[7]);
40913
+ if (zeros(0, 6) && (g[6] !== 0 || g[7] > 1)) return ipv4FromGroups(g[6], g[7]);
40914
+ if (g[0] === 100 && g[1] === 65435 && zeros(2, 6)) return ipv4FromGroups(g[6], g[7]);
40915
+ if (g[0] === 8194) return ipv4FromGroups(g[1], g[2]);
40916
+ if (g[0] === 8193 && g[1] === 0) return ipv4FromGroups(g[6] ^ 65535, g[7] ^ 65535);
40917
+ return null;
40918
+ }
40919
+ function isPrivateIPv6(ip) {
40920
+ const g = parseIPv6Groups(ip);
40921
+ if (!g) {
40922
+ const lower = ip.toLowerCase();
40923
+ return lower === "::1" || lower === "::" || lower.startsWith("fc") || lower.startsWith("fd");
40924
+ }
40925
+ if (g.every((group) => group === 0)) return true;
40926
+ if (g.slice(0, 7).every((group) => group === 0) && g[7] === 1) return true;
40927
+ if ((g[0] & 65024) === 64512) return true;
40928
+ if ((g[0] & 65472) === 65152) return true;
40929
+ if ((g[0] & 65472) === 65216) return true;
40930
+ if ((g[0] & 65280) === 65280) return true;
40931
+ if (g[0] === 8193 && g[1] === 3512) return true;
40932
+ if (g[0] === 100 && g[1] === 65435 && g[2] === 1) return true;
40933
+ const v4 = embeddedIPv4(ip);
40934
+ if (v4 && isPrivateIPv4(v4)) return true;
40888
40935
  return false;
40889
40936
  }
40890
40937
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ever-works/bluesky-connector-plugin",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "Bluesky social connector plugin for Ever Works platform (outbound posts via the official @atproto/api SDK, and event-source pull of mentions/replies plus the account's own timeline into the event-ingest pipeline, with opt-in historical backfill)",
5
5
  "author": {
6
6
  "name": "Ever Co. LTD",
@@ -33,8 +33,8 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "@atproto/api": "^0.20.34",
36
- "@ever-works/contracts": "^1.0.6",
37
- "@ever-works/plugin": "^1.2.5"
36
+ "@ever-works/contracts": "^1.0.12",
37
+ "@ever-works/plugin": "^1.2.9"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@types/node": "^26.6.4",
@@ -101,8 +101,8 @@
101
101
  "url": "https://github.com/ever-works/ever-works/issues"
102
102
  },
103
103
  "everworksRelease": {
104
- "contentHash": "sha256:3b2e9b2f7e88dab55139549e9bca2ca2d9e108f8dc4835991dadf89c380a1409",
105
- "commit": "19905c70cf05be3bc523db030597046067cd322a",
106
- "source": "https://github.com/ever-works/ever-works/tree/19905c70cf05be3bc523db030597046067cd322a/packages/plugins/bluesky-connector"
104
+ "contentHash": "sha256:640762359a0729f9584674df4b78c59fc72c3bcb6d516a7f499f79d6edef350e",
105
+ "commit": "5b5a17e1cdc02e06383d508a6424a863521fc3e0",
106
+ "source": "https://github.com/ever-works/ever-works/tree/5b5a17e1cdc02e06383d508a6424a863521fc3e0/packages/plugins/bluesky-connector"
107
107
  }
108
108
  }