@sockethub/platform-feeds 4.0.0-beta.0 → 4.0.0-beta.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/README.md CHANGED
@@ -150,6 +150,13 @@ Returns an ActivityStreams Collection with feed entries:
150
150
  }
151
151
  ```
152
152
 
153
+ ## Entry fields
154
+
155
+ `object.content` is the entry description in full. `object.type` is `note`
156
+ when the description is 256 characters or shorter and `article` when it is
157
+ longer. `contentType` is `html` when HTML tags appear in the first 1000
158
+ characters of the description, otherwise `text`.
159
+
153
160
  ## Request Hardening (SSRF Guard)
154
161
 
155
162
  Because the server fetches whatever URL a client supplies as `actor.id`, feed
@@ -160,8 +167,12 @@ exhaustion, using the shared guarded fetch dispatcher from `@sockethub/util`:
160
167
  * The connection is refused if the destination resolves to a loopback, private,
161
168
  link-local, carrier-grade NAT, or otherwise non-public address — validated at
162
169
  the connection layer, so it also covers every redirect hop (no
163
- check-then-fetch rebinding gap). IPv4-mapped, IPv4-compatible, and NAT64 IPv6
164
- spellings of those ranges are normalized and blocked as well.
170
+ check-then-fetch rebinding gap). IPv4-mapped, IPv4-compatible, and
171
+ well-known NAT64 (`64:ff9b::/96`) embeddings are judged as the embedded IPv4
172
+ address, so a public embedding is allowed. The local-use NAT64 prefix
173
+ `64:ff9b:1::/48` is refused entirely. The same address rules apply to
174
+ metadata, CalDAV, and CardDAV; see
175
+ [Outbound URL guard](../../docs/configuration.md#outbound-url-guard).
165
176
  * Response bodies are capped (a missing or lying `Content-Length` does not
166
177
  bypass the cap).
167
178
  * Non-2xx responses fail the job with a descriptive error.
package/dist/index.js CHANGED
@@ -41057,7 +41057,7 @@ var ActivityStreamSchema = {
41057
41057
  var package_default = {
41058
41058
  name: "@sockethub/schemas",
41059
41059
  description: "JSON schema files for validating Sockethub Activity Streams",
41060
- version: "3.0.0-beta.0",
41060
+ version: "3.0.0-beta.2",
41061
41061
  type: "module",
41062
41062
  private: false,
41063
41063
  author: "Nick Jennings <nick@silverbucket.net>",
@@ -41127,7 +41127,7 @@ var package_default = {
41127
41127
  "ajv-formats": "^2.1.1",
41128
41128
  "ajv-formats-draft2019": "^1.6.1"
41129
41129
  },
41130
- gitHead: "75002ae8f15d7679bd58a9327f5a1d7eeaffa237",
41130
+ gitHead: "1f74d4e07311496f0acc021855137bc197d79eab",
41131
41131
  types: "./dist/index.d.ts"
41132
41132
  };
41133
41133
 
@@ -41232,8 +41232,11 @@ var SockethubConfigSchema = {
41232
41232
  "@sockethub/platform-caldav",
41233
41233
  "@sockethub/platform-dummy",
41234
41234
  "@sockethub/platform-feeds",
41235
+ "@sockethub/platform-email",
41235
41236
  "@sockethub/platform-irc",
41236
41237
  "@sockethub/platform-metadata",
41238
+ "@sockethub/platform-messenger",
41239
+ "@sockethub/platform-instagram",
41237
41240
  "@sockethub/platform-xmpp"
41238
41241
  ]
41239
41242
  },
@@ -41249,7 +41252,8 @@ var SockethubConfigSchema = {
41249
41252
  connectTimeoutMs: { type: "integer", minimum: 1 },
41250
41253
  allowPrivateAddresses: { type: "boolean" },
41251
41254
  allowInsecureHttp: { type: "boolean" },
41252
- concurrency: { type: "integer", minimum: 1 }
41255
+ concurrency: { type: "integer", minimum: 1 },
41256
+ discoveryCacheTtlMs: { type: "integer", minimum: 0 }
41253
41257
  }
41254
41258
  },
41255
41259
  "@sockethub/platform-caldav": {
@@ -41259,7 +41263,20 @@ var SockethubConfigSchema = {
41259
41263
  connectTimeoutMs: { type: "integer", minimum: 1 },
41260
41264
  allowPrivateAddresses: { type: "boolean" },
41261
41265
  allowInsecureHttp: { type: "boolean" },
41262
- concurrency: { type: "integer", minimum: 1 }
41266
+ concurrency: { type: "integer", minimum: 1 },
41267
+ discoveryCacheTtlMs: { type: "integer", minimum: 0 }
41268
+ }
41269
+ },
41270
+ "@sockethub/platform-email": {
41271
+ type: "object",
41272
+ additionalProperties: false,
41273
+ properties: {
41274
+ connectTimeoutMs: {
41275
+ type: "integer",
41276
+ minimum: 5000,
41277
+ maximum: 120000
41278
+ },
41279
+ allowPrivateAddresses: { type: "boolean" }
41263
41280
  }
41264
41281
  },
41265
41282
  "@sockethub/platform-dummy": {
@@ -41282,14 +41299,16 @@ var SockethubConfigSchema = {
41282
41299
  type: "object",
41283
41300
  additionalProperties: false,
41284
41301
  properties: {
41285
- connectTimeoutMs: { type: "number" }
41302
+ connectTimeoutMs: { type: "number" },
41303
+ allowPrivateAddresses: { type: "boolean" }
41286
41304
  }
41287
41305
  },
41288
41306
  "@sockethub/platform-xmpp": {
41289
41307
  type: "object",
41290
41308
  additionalProperties: false,
41291
41309
  properties: {
41292
- connectTimeoutMs: { type: "number" }
41310
+ connectTimeoutMs: { type: "number" },
41311
+ allowPrivateAddresses: { type: "boolean" }
41293
41312
  }
41294
41313
  },
41295
41314
  "@sockethub/platform-metadata": {
@@ -41379,11 +41398,29 @@ var SockethubConfigSchema = {
41379
41398
  type: "object",
41380
41399
  additionalProperties: false,
41381
41400
  properties: {
41401
+ maxInstancesPerSession: {
41402
+ type: "integer",
41403
+ minimum: 0,
41404
+ default: 10,
41405
+ description: "Maximum persistent instances per socket session. 0 disables the cap."
41406
+ },
41407
+ maxInstancesPerIp: {
41408
+ type: "integer",
41409
+ minimum: 0,
41410
+ default: 20,
41411
+ description: "Maximum persistent instances per client IP, including HTTP actions. 0 disables the cap."
41412
+ },
41413
+ maxStartsPerIpPerMinute: {
41414
+ type: "integer",
41415
+ minimum: 0,
41416
+ default: 60,
41417
+ description: "Maximum new persistent instances a client IP may start per minute, " + "including HTTP actions. Bounds fork/teardown churn that the " + "concurrent caps allow. Reusing a running instance does not count. " + "0 disables the cap."
41418
+ },
41382
41419
  maxPlatformInstances: {
41383
41420
  type: "number",
41384
41421
  minimum: 0,
41385
41422
  default: 100,
41386
- description: "Upper bound on concurrently running platform instances " + "(child processes). Each persistent-platform actor forks " + "its own process, so an unbounded count is a resource " + "exhaustion risk on public instances. 0 disables the cap."
41423
+ description: "Upper bound on concurrently running persistent platform instances " + "(child processes). Each persistent-platform actor forks " + "its own process, so an unbounded count is a resource " + "exhaustion risk on public instances. 0 disables the cap."
41387
41424
  }
41388
41425
  }
41389
41426
  },
@@ -41564,33 +41601,66 @@ var SockethubConfigSchema = {
41564
41601
  };
41565
41602
  var SockethubConfigSchemaId = versionedSchemaId(SockethubConfigSchema.$id, package_default.version);
41566
41603
 
41567
- // ../schemas/src/service-descriptor.ts
41568
- var import_ajv = __toESM(require_ajv(), 1);
41569
- var ajv = new import_ajv.default({ strictTypes: false, allErrors: true });
41604
+ // ../schemas/src/helpers/codegen.ts
41605
+ var available;
41606
+ var warned = false;
41607
+ function isCodegenAvailable() {
41608
+ if (available === undefined) {
41609
+ try {
41610
+ new Function("return true");
41611
+ available = true;
41612
+ } catch {
41613
+ available = false;
41614
+ }
41615
+ }
41616
+ return available;
41617
+ }
41618
+ function warnCodegenUnavailable() {
41619
+ if (warned) {
41620
+ return;
41621
+ }
41622
+ warned = true;
41623
+ console.warn("[@sockethub/schemas] Schema validation is disabled: this environment's Content Security Policy blocks `new Function`, which Ajv needs to compile schemas. The Sockethub server still validates every message.");
41624
+ }
41570
41625
 
41571
41626
  // ../schemas/src/validator.ts
41572
- var import_ajv2 = __toESM(require_ajv(), 1);
41627
+ var import_ajv = __toESM(require_ajv(), 1);
41573
41628
  var import_ajv_formats = __toESM(require_dist(), 1);
41574
41629
  var import_ajv_formats_draft2019 = __toESM(require_ajv_formats_draft2019(), 1);
41575
- var ajv2 = new import_ajv2.default({ strictTypes: false, allErrors: true });
41576
- import_ajv_formats.default(ajv2);
41577
- import_ajv_formats_draft2019.default(ajv2);
41578
41630
  var schemaURL = "https://sockethub.org/schemas/v0";
41579
41631
  var schemas = {};
41580
41632
  var systemContextsRegistered = false;
41581
41633
  schemas[`${schemaURL}/activity-stream`] = ActivityStreamSchema;
41582
- for (const uri in schemas) {
41583
- ajv2.addSchema(schemas[uri], uri);
41634
+ var ajv;
41635
+ function getAjv() {
41636
+ if (!isCodegenAvailable()) {
41637
+ warnCodegenUnavailable();
41638
+ return;
41639
+ }
41640
+ if (!ajv) {
41641
+ const instance = new import_ajv.default({ strictTypes: false, allErrors: true });
41642
+ import_ajv_formats.default(instance);
41643
+ import_ajv_formats_draft2019.default(instance);
41644
+ for (const uri in schemas) {
41645
+ instance.addSchema(schemas[uri], uri);
41646
+ }
41647
+ ajv = instance;
41648
+ }
41649
+ return ajv;
41584
41650
  }
41585
41651
  function registerSystemContext(platformId, contextUrl) {
41586
41652
  registerPlatformContext(platformId, contextUrl, `${schemaURL}/context/${platformId}/messages`, `${schemaURL}/context/${platformId}/credentials`);
41653
+ const instance = getAjv();
41654
+ if (!instance) {
41655
+ return;
41656
+ }
41587
41657
  const messageSchemaRef = `${schemaURL}/context/${platformId}/messages`;
41588
- if (!ajv2.getSchema(messageSchemaRef)) {
41589
- ajv2.addSchema({}, messageSchemaRef);
41658
+ if (!instance.getSchema(messageSchemaRef)) {
41659
+ instance.addSchema({}, messageSchemaRef);
41590
41660
  }
41591
41661
  const credentialsSchemaRef = `${schemaURL}/context/${platformId}/credentials`;
41592
- if (!ajv2.getSchema(credentialsSchemaRef)) {
41593
- ajv2.addSchema({}, credentialsSchemaRef);
41662
+ if (!instance.getSchema(credentialsSchemaRef)) {
41663
+ instance.addSchema({}, credentialsSchemaRef);
41594
41664
  }
41595
41665
  }
41596
41666
  function registerSystemPlatformContexts() {
@@ -41866,7 +41936,7 @@ function createGuardedLookup(allowPrivateAddresses) {
41866
41936
  if (!allowPrivateAddresses) {
41867
41937
  for (const { address } of addresses) {
41868
41938
  if (isBlockedAddress(address)) {
41869
- callback(new Error(`blocked non-public address ${address} for ${hostname}`));
41939
+ callback(new Error(`blocked non-public address for ${hostname}`));
41870
41940
  return;
41871
41941
  }
41872
41942
  }
@@ -42076,7 +42146,7 @@ var import_podparse = __toESM(require_podparse(), 1);
42076
42146
  var package_default2 = {
42077
42147
  name: "@sockethub/platform-feeds",
42078
42148
  description: "A sockethub platform module implementing RSS/Atom functionality",
42079
- version: "4.0.0-beta.0",
42149
+ version: "4.0.0-beta.2",
42080
42150
  type: "module",
42081
42151
  private: false,
42082
42152
  author: "Nick Jennings <nick@silverbucket.net>",
@@ -42121,24 +42191,24 @@ var package_default2 = {
42121
42191
  "clean:deps": "rm -rf node_modules"
42122
42192
  },
42123
42193
  dependencies: {
42124
- "@sockethub/util": "^1.0.0-beta.0",
42194
+ "@sockethub/util": "^1.0.0-beta.2",
42125
42195
  "html-tags": "^3.3.1",
42126
42196
  htmlparser2: "^9.1.0",
42127
42197
  podparse: "^1.6.0"
42128
42198
  },
42129
42199
  devDependencies: {
42130
- "@sockethub/schemas": "^3.0.0-beta.0",
42200
+ "@sockethub/schemas": "^3.0.0-beta.2",
42131
42201
  "@types/bun": "latest"
42132
42202
  },
42133
42203
  peerDependencies: {
42134
- "@sockethub/server": "5.0.0-beta.0"
42204
+ "@sockethub/server": "5.0.0-beta.2"
42135
42205
  },
42136
42206
  peerDependenciesMeta: {
42137
42207
  "@sockethub/server": {
42138
42208
  optional: true
42139
42209
  }
42140
42210
  },
42141
- gitHead: "75002ae8f15d7679bd58a9327f5a1d7eeaffa237",
42211
+ gitHead: "1f74d4e07311496f0acc021855137bc197d79eab",
42142
42212
  types: "./dist/index.d.ts"
42143
42213
  };
42144
42214
 
@@ -42252,8 +42322,8 @@ var FEEDS_CONTEXT = buildCanonicalContext(schema_default.contextUrl);
42252
42322
  var basic = /\s?<!doctype html>|(<html\b[^>]*>|<body\b[^>]*>|<x-[^>]+>)+/i;
42253
42323
  var full = new RegExp(html_tags_default.map((tag) => `<${tag}\\b[^>]*>`).join("|"), "i");
42254
42324
  function isHtml(s) {
42255
- const limitedString = s.trim().slice(0, 1000);
42256
- return basic.test(limitedString) || full.test(s);
42325
+ const limitedString = s.slice(0, 1000).trim();
42326
+ return basic.test(limitedString) || full.test(limitedString);
42257
42327
  }
42258
42328
 
42259
42329
  class Feeds {
@@ -42403,4 +42473,4 @@ export {
42403
42473
  extractFetchParams
42404
42474
  };
42405
42475
 
42406
- //# debugId=B33C7094A94498B464756E2164756E21
42476
+ //# debugId=4B35A0602967263F64756E2164756E21