@fedify/fedify 2.0.28-dev.1974 → 2.0.28-dev.1979

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 (57) hide show
  1. package/dist/{builder-DBKy92BX.mjs → builder-CAAXTNeK.mjs} +3 -3
  2. package/dist/compat/mod.d.cts +1 -1
  3. package/dist/compat/mod.d.ts +1 -1
  4. package/dist/compat/transformers.test.mjs +1 -1
  5. package/dist/{context-DnsFj3yK.d.ts → context-DJ5oMnte.d.ts} +2 -1
  6. package/dist/{context-CJZHWLmz.d.cts → context-zLLwVY_G.d.cts} +2 -1
  7. package/dist/{deno-CGtm12Ft.mjs → deno-D3gZ1DsB.mjs} +1 -1
  8. package/dist/{docloader-_hXTUC-b.mjs → docloader-DIk3fEXZ.mjs} +2 -2
  9. package/dist/federation/builder.test.mjs +1 -1
  10. package/dist/federation/handler.test.mjs +4 -4
  11. package/dist/federation/idempotency.test.mjs +2 -2
  12. package/dist/federation/inbox.test.mjs +1 -1
  13. package/dist/federation/middleware.test.mjs +39 -7
  14. package/dist/federation/mod.cjs +1 -1
  15. package/dist/federation/mod.d.cts +2 -2
  16. package/dist/federation/mod.d.ts +2 -2
  17. package/dist/federation/mod.js +1 -1
  18. package/dist/federation/send.test.mjs +136 -3
  19. package/dist/federation/temporal.test.mjs +1 -1
  20. package/dist/federation/webfinger.test.mjs +1 -1
  21. package/dist/{http-BuaGj55w.cjs → http-BLqv_3ue.cjs} +1 -1
  22. package/dist/{http--P33qRwW.mjs → http-Bn3-am6C.mjs} +2 -2
  23. package/dist/{http-BP1pVF9m.js → http-Cx5dD1D_.js} +1 -1
  24. package/dist/{inbox-BZNyUPzW.mjs → inbox-DC8NbYIj.mjs} +1 -1
  25. package/dist/{key-rC9mW1U5.mjs → key-BQUnVMwc.mjs} +1 -1
  26. package/dist/{kv-cache-BVqMp1RC.cjs → kv-cache-CCEitzFw.cjs} +1 -1
  27. package/dist/{kv-cache-CKg5W012.js → kv-cache-DI4m-4xy.js} +1 -1
  28. package/dist/{ld-CN2nacLy.mjs → ld-CVbwQ8Fz.mjs} +2 -2
  29. package/dist/{middleware-CwIT91Nc.js → middleware-2Qp34eTb.js} +68 -8
  30. package/dist/{middleware-sbzAVAzo.mjs → middleware-BqkNe0c6.mjs} +1 -1
  31. package/dist/{middleware-DcmlYd2c.cjs → middleware-C7Afa66S.cjs} +1 -1
  32. package/dist/{middleware-DpEJSmjy.mjs → middleware-D3a1JsO1.mjs} +14 -11
  33. package/dist/{middleware-BXwn4gnl.cjs → middleware-Fcpx7tz6.cjs} +68 -8
  34. package/dist/{mod-43DJyETz.d.cts → mod-BtvLkCgb.d.cts} +1 -1
  35. package/dist/{mod-COgmn-UO.d.ts → mod-Du-UVCX_.d.ts} +1 -1
  36. package/dist/mod.cjs +4 -4
  37. package/dist/mod.d.cts +2 -2
  38. package/dist/mod.d.ts +2 -2
  39. package/dist/mod.js +4 -4
  40. package/dist/nodeinfo/handler.test.mjs +1 -1
  41. package/dist/{owner-CFgyZgkz.mjs → owner-D9CjMxWb.mjs} +2 -2
  42. package/dist/{proof-CpEH24hi.mjs → proof-DZWmoF6Z.mjs} +2 -2
  43. package/dist/{proof-ftbx50PI.js → proof-EY-uItWr.js} +1 -1
  44. package/dist/{proof-BTKH7fe9.cjs → proof-liMyPvsb.cjs} +1 -1
  45. package/dist/{send-pXXMu19o.mjs → send-IMhmEkun.mjs} +64 -6
  46. package/dist/sig/http.test.mjs +2 -2
  47. package/dist/sig/key.test.mjs +1 -1
  48. package/dist/sig/ld.test.mjs +2 -2
  49. package/dist/sig/mod.cjs +2 -2
  50. package/dist/sig/mod.js +2 -2
  51. package/dist/sig/owner.test.mjs +1 -1
  52. package/dist/sig/proof.test.mjs +1 -1
  53. package/dist/{temporal-B4rBDksp.mjs → temporal-BovRWwqL.mjs} +1 -1
  54. package/dist/utils/docloader.test.mjs +2 -2
  55. package/dist/utils/mod.cjs +1 -1
  56. package/dist/utils/mod.js +1 -1
  57. package/package.json +5 -5
@@ -2,8 +2,8 @@ import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
4
  import { n as RouterError, t as Router } from "./router-CrMLXoOr.mjs";
5
- import { n as version, t as name } from "./deno-CGtm12Ft.mjs";
6
- import { t as InboxListenerSet } from "./inbox-BZNyUPzW.mjs";
5
+ import { n as version, t as name } from "./deno-D3gZ1DsB.mjs";
6
+ import { t as InboxListenerSet } from "./inbox-DC8NbYIj.mjs";
7
7
  import { getTypeId } from "@fedify/vocab";
8
8
  import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
9
9
  import { getLogger } from "@logtape/logtape";
@@ -42,7 +42,7 @@ var FederationBuilderImpl = class {
42
42
  this.collectionTypeIds = {};
43
43
  }
44
44
  async build(options) {
45
- const { FederationImpl } = await import("./middleware-sbzAVAzo.mjs");
45
+ const { FederationImpl } = await import("./middleware-BqkNe0c6.mjs");
46
46
  const f = new FederationImpl(options);
47
47
  const trailingSlashInsensitiveValue = f.router.trailingSlashInsensitive;
48
48
  f.router = this.router.clone();
@@ -1,5 +1,5 @@
1
1
  /// <reference lib="esnext.temporal" />
2
- import { bt as ActivityTransformer, n as Context } from "../context-CJZHWLmz.cjs";
2
+ import { bt as ActivityTransformer, n as Context } from "../context-zLLwVY_G.cjs";
3
3
  import { Activity } from "@fedify/vocab";
4
4
 
5
5
  //#region src/compat/transformers.d.ts
@@ -1,5 +1,5 @@
1
1
  /// <reference lib="esnext.temporal" />
2
- import { bt as ActivityTransformer, n as Context } from "../context-DnsFj3yK.js";
2
+ import { bt as ActivityTransformer, n as Context } from "../context-DJ5oMnte.js";
3
3
  import { Activity } from "@fedify/vocab";
4
4
 
5
5
  //#region src/compat/transformers.d.ts
@@ -5,7 +5,7 @@ import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
5
5
  import { t as assertInstanceOf } from "../assert_instance_of-C4Ri6VuN.mjs";
6
6
  import { t as assert } from "../assert-ddO5KLpe.mjs";
7
7
  import { t as MemoryKvStore } from "../kv-BrZHNugx.mjs";
8
- import { _ as autoIdAssigner, g as actorDehydrator, n as FederationImpl } from "../middleware-DpEJSmjy.mjs";
8
+ import { _ as autoIdAssigner, g as actorDehydrator, n as FederationImpl } from "../middleware-D3a1JsO1.mjs";
9
9
  import { test } from "@fedify/fixture";
10
10
  import { Follow, Person } from "@fedify/vocab";
11
11
  //#region src/compat/transformers.test.ts
@@ -1391,7 +1391,8 @@ interface FederationOptions<TContextData> {
1391
1391
  */
1392
1392
  authenticatedDocumentLoaderFactory?: AuthenticatedDocumentLoaderFactory;
1393
1393
  /**
1394
- * Whether to allow fetching private network addresses in the document loader.
1394
+ * Whether to allow private network addresses in the document loader and
1395
+ * outbound activity delivery, including redirects.
1395
1396
  *
1396
1397
  * If turned on, {@link FederationOptions.documentLoader},
1397
1398
  * {@link FederationOptions.contextLoader}, and
@@ -1391,7 +1391,8 @@ interface FederationOptions<TContextData> {
1391
1391
  */
1392
1392
  authenticatedDocumentLoaderFactory?: AuthenticatedDocumentLoaderFactory;
1393
1393
  /**
1394
- * Whether to allow fetching private network addresses in the document loader.
1394
+ * Whether to allow private network addresses in the document loader and
1395
+ * outbound activity delivery, including redirects.
1395
1396
  *
1396
1397
  * If turned on, {@link FederationOptions.documentLoader},
1397
1398
  * {@link FederationOptions.contextLoader}, and
@@ -3,6 +3,6 @@ import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
4
  //#region deno.json
5
5
  var name = "@fedify/fedify";
6
- var version = "2.0.28-dev.1974+d70e3148";
6
+ var version = "2.0.28-dev.1979+d0048bc7";
7
7
  //#endregion
8
8
  export { version as n, name as t };
@@ -1,8 +1,8 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { a as validateCryptoKey } from "./key-rC9mW1U5.mjs";
5
- import { n as doubleKnock } from "./http--P33qRwW.mjs";
4
+ import { a as validateCryptoKey } from "./key-BQUnVMwc.mjs";
5
+ import { n as doubleKnock } from "./http-Bn3-am6C.mjs";
6
6
  import { curry } from "es-toolkit";
7
7
  import { UrlError, createActivityPubRequest, getRemoteDocument, logRequest, validatePublicUrl } from "@fedify/vocab-runtime";
8
8
  import { getLogger } from "@logtape/logtape";
@@ -5,7 +5,7 @@ import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
5
5
  import { a as assertExists } from "../std__assert-Duiq_YC9.mjs";
6
6
  import { t as assertThrows } from "../assert_throws-4NwKEy2q.mjs";
7
7
  import { t as MemoryKvStore } from "../kv-BrZHNugx.mjs";
8
- import { n as createFederationBuilder } from "../builder-DBKy92BX.mjs";
8
+ import { n as createFederationBuilder } from "../builder-CAAXTNeK.mjs";
9
9
  import { test } from "@fedify/fixture";
10
10
  import { Activity, Note, Person } from "@fedify/vocab";
11
11
  //#region src/federation/builder.test.ts
@@ -6,12 +6,12 @@ import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
6
6
  import "../std__assert-Duiq_YC9.mjs";
7
7
  import { t as assertRejects } from "../assert_rejects-B-qJtC9Z.mjs";
8
8
  import { t as assert } from "../assert-ddO5KLpe.mjs";
9
- import { s as signRequest } from "../http--P33qRwW.mjs";
9
+ import { s as signRequest } from "../http-Bn3-am6C.mjs";
10
10
  import { a as rsaPrivateKey3, c as rsaPublicKey3, s as rsaPublicKey2 } from "../keys-CtZLJq76.mjs";
11
- import { a as compactJsonLd, f as signJsonLd } from "../ld-CN2nacLy.mjs";
11
+ import { a as compactJsonLd, f as signJsonLd } from "../ld-CVbwQ8Fz.mjs";
12
12
  import { t as MemoryKvStore } from "../kv-BrZHNugx.mjs";
13
- import { a as createFederation, c as handleCollection, d as handleObject, f as respondWithObject, l as handleCustomCollection, p as respondWithObjectIfAcceptable, s as handleActor, u as handleInbox } from "../middleware-DpEJSmjy.mjs";
14
- import { t as InboxListenerSet } from "../inbox-BZNyUPzW.mjs";
13
+ import { a as createFederation, c as handleCollection, d as handleObject, f as respondWithObject, l as handleCustomCollection, p as respondWithObjectIfAcceptable, s as handleActor, u as handleInbox } from "../middleware-D3a1JsO1.mjs";
14
+ import { t as InboxListenerSet } from "../inbox-DC8NbYIj.mjs";
15
15
  import { createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
16
16
  import { Create, Note, Person } from "@fedify/vocab";
17
17
  //#region src/federation/handler.test.ts
@@ -4,9 +4,9 @@ globalThis.addEventListener = () => {};
4
4
  import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
5
5
  import "../std__assert-Duiq_YC9.mjs";
6
6
  import { n as ed25519PrivateKey, r as ed25519PublicKey, t as ed25519Multikey } from "../keys-CtZLJq76.mjs";
7
- import { n as signObject } from "../proof-CpEH24hi.mjs";
7
+ import { n as signObject } from "../proof-DZWmoF6Z.mjs";
8
8
  import { t as MemoryKvStore } from "../kv-BrZHNugx.mjs";
9
- import { a as createFederation } from "../middleware-DpEJSmjy.mjs";
9
+ import { a as createFederation } from "../middleware-D3a1JsO1.mjs";
10
10
  import { mockDocumentLoader, test } from "@fedify/fixture";
11
11
  import { Create, Follow, Person } from "@fedify/vocab";
12
12
  //#region src/federation/idempotency.test.ts
@@ -3,7 +3,7 @@ import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
4
  import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
5
5
  import { t as assertThrows } from "../assert_throws-4NwKEy2q.mjs";
6
- import { t as InboxListenerSet } from "../inbox-BZNyUPzW.mjs";
6
+ import { t as InboxListenerSet } from "../inbox-DC8NbYIj.mjs";
7
7
  import { test } from "@fedify/fixture";
8
8
  import { Activity, Create, Invite, Offer, Update } from "@fedify/vocab";
9
9
  //#region src/federation/inbox.test.ts
@@ -10,18 +10,18 @@ import { t as assertInstanceOf } from "../assert_instance_of-C4Ri6VuN.mjs";
10
10
  import { t as assertThrows } from "../assert_throws-4NwKEy2q.mjs";
11
11
  import { t as assertNotEquals } from "../assert_not_equals--wG9hV7u.mjs";
12
12
  import { t as assert } from "../assert-ddO5KLpe.mjs";
13
- import { l as verifyRequest, s as signRequest } from "../http--P33qRwW.mjs";
13
+ import { l as verifyRequest, s as signRequest } from "../http-Bn3-am6C.mjs";
14
14
  import { a as rsaPrivateKey3, c as rsaPublicKey3, i as rsaPrivateKey2, n as ed25519PrivateKey, r as ed25519PublicKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-CtZLJq76.mjs";
15
- import { t as getAuthenticatedDocumentLoader } from "../docloader-_hXTUC-b.mjs";
16
- import { a as compactJsonLd, f as signJsonLd, m as verifyJsonLd, s as detachSignature } from "../ld-CN2nacLy.mjs";
17
- import { t as doesActorOwnKey } from "../owner-CFgyZgkz.mjs";
18
- import { n as signObject, r as verifyObject } from "../proof-CpEH24hi.mjs";
15
+ import { t as getAuthenticatedDocumentLoader } from "../docloader-DIk3fEXZ.mjs";
16
+ import { a as compactJsonLd, f as signJsonLd, m as verifyJsonLd, s as detachSignature } from "../ld-CVbwQ8Fz.mjs";
17
+ import { t as doesActorOwnKey } from "../owner-D9CjMxWb.mjs";
18
+ import { n as signObject, r as verifyObject } from "../proof-DZWmoF6Z.mjs";
19
19
  import { t as MemoryKvStore } from "../kv-BrZHNugx.mjs";
20
- import { a as createFederation, i as KvSpecDeterminer, n as FederationImpl, r as InboxContextImpl, t as ContextImpl } from "../middleware-DpEJSmjy.mjs";
20
+ import { a as createFederation, i as KvSpecDeterminer, n as FederationImpl, r as InboxContextImpl, t as ContextImpl } from "../middleware-D3a1JsO1.mjs";
21
21
  import { mockDocumentLoader, test } from "@fedify/fixture";
22
22
  import * as vocab from "@fedify/vocab";
23
23
  import { Create, Offer, Person, getTypeId, lookupObject } from "@fedify/vocab";
24
- import { getDocumentLoader } from "@fedify/vocab-runtime";
24
+ import { UrlError, getDocumentLoader } from "@fedify/vocab-runtime";
25
25
  //#region ../fixture/src/fixtures/example.com/create.json
26
26
  var id$2 = "https://example.com/create";
27
27
  var create_default = {
@@ -2816,6 +2816,7 @@ test("FederationImpl.processQueuedTask() permanent failure", async (t) => {
2816
2816
  return Promise.resolve();
2817
2817
  }
2818
2818
  },
2819
+ allowPrivateAddress: true,
2819
2820
  ...options.permanentFailureStatusCodes ? { permanentFailureStatusCodes: options.permanentFailureStatusCodes } : {}
2820
2821
  });
2821
2822
  federation.setInboxListeners("/users/{identifier}/inbox", "/inbox");
@@ -3667,5 +3668,36 @@ test("KvSpecDeterminer", async (t) => {
3667
3668
  assertEquals(spec, "rfc9421");
3668
3669
  });
3669
3670
  });
3671
+ test("ContextImpl.sendActivity() honors the private-address policy", async (t) => {
3672
+ for (const allowPrivateAddress of [false, true]) await t.step(`allowPrivateAddress: ${allowPrivateAddress}`, async () => {
3673
+ const inbox = "http://127.0.0.1/inbox";
3674
+ esm_default.mockGlobal().post(inbox, 202);
3675
+ try {
3676
+ const ctx = createFederation({
3677
+ kv: new MemoryKvStore(),
3678
+ allowPrivateAddress
3679
+ }).createContext(new URL("https://example.com/"));
3680
+ const send = () => ctx.sendActivity({
3681
+ privateKey: ed25519PrivateKey,
3682
+ keyId: ed25519Multikey.id
3683
+ }, new Person({
3684
+ id: new URL("https://example.com/recipient"),
3685
+ inbox: new URL(inbox)
3686
+ }), new Create({
3687
+ id: new URL("https://example.com/activity"),
3688
+ actor: new URL("https://example.com/person")
3689
+ }), { immediate: true });
3690
+ if (allowPrivateAddress) {
3691
+ await send();
3692
+ assertEquals(esm_default.callHistory.calls(inbox).length, 1);
3693
+ } else {
3694
+ await assertRejects(send, UrlError);
3695
+ assertEquals(esm_default.callHistory.calls(inbox).length, 0);
3696
+ }
3697
+ } finally {
3698
+ esm_default.hardReset();
3699
+ }
3700
+ });
3701
+ });
3670
3702
  //#endregion
3671
3703
  export {};
@@ -2,7 +2,7 @@ const { Temporal } = require("@js-temporal/polyfill");
2
2
  const { URLPattern } = require("urlpattern-polyfill");
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
4
  require("../chunk-DDcVe30Y.cjs");
5
- const require_middleware = require("../middleware-BXwn4gnl.cjs");
5
+ const require_middleware = require("../middleware-Fcpx7tz6.cjs");
6
6
  let es_toolkit = require("es-toolkit");
7
7
  //#region src/federation/kv.ts
8
8
  /**
@@ -1,5 +1,5 @@
1
1
  /// <reference lib="esnext.temporal" />
2
- import { $ as AuthorizePredicate, A as CreateExponentialBackoffPolicyOptions, B as RespondWithObjectOptions, C as InboxListenerSetters, D as FederationOrigin, E as FederationKvPrefixes, F as createFederationBuilder, G as MessageQueue, H as respondWithObjectIfAcceptable, I as Router, J as ParallelMessageQueue, K as MessageQueueEnqueueOptions, L as RouterError, M as RetryPolicy, N as createExponentialBackoffPolicy, O as FederationQueueOptions, P as Message, Q as ActorKeyPairsDispatcher, R as RouterOptions, S as IdempotencyStrategy, T as Rfc6570Expression, U as InProcessMessageQueue, V as respondWithObject, W as InProcessMessageQueueOptions, X as ActorDispatcher, Y as ActorAliasMapper, Z as ActorHandleMapper, _ as FederationBuilder, _t as PageItems, a as InboxContext, at as CustomCollectionDispatcher, b as FederationStartQueueOptions, c as RouteActivityOptions, ct as NodeInfoDispatcher, d as ActorCallbackSetters, dt as OutboxErrorHandler, et as CollectionCounter, f as CollectionCallbackSetters, ft as OutboxPermanentFailureHandler, g as Federation, gt as SenderKeyPair, h as Federatable, ht as SendActivityError, i as GetSignedKeyOptions, it as CustomCollectionCursor, j as RetryContext, k as createFederation, l as SendActivityOptions, lt as ObjectAuthorizePredicate, m as CustomCollectionCallbackSetters, mt as WebFingerLinksDispatcher, n as Context, nt as CollectionDispatcher, o as ParseUriResult, ot as InboxErrorHandler, p as ConstructorWithTypeId, pt as SharedInboxKeyDispatcher, q as MessageQueueListenOptions, r as ForwardActivityOptions, rt as CustomCollectionCounter, s as RequestContext, st as InboxListener, t as ActorKeyPair, tt as CollectionCursor, u as SendActivityOptionsForCollection, ut as ObjectDispatcher, v as FederationFetchOptions, vt as buildCollectionSynchronizationHeader, w as ObjectCallbackSetters, x as IdempotencyKeyCallback, y as FederationOptions, yt as digest, z as RouterRouteResult } from "../context-CJZHWLmz.cjs";
2
+ import { $ as AuthorizePredicate, A as CreateExponentialBackoffPolicyOptions, B as RespondWithObjectOptions, C as InboxListenerSetters, D as FederationOrigin, E as FederationKvPrefixes, F as createFederationBuilder, G as MessageQueue, H as respondWithObjectIfAcceptable, I as Router, J as ParallelMessageQueue, K as MessageQueueEnqueueOptions, L as RouterError, M as RetryPolicy, N as createExponentialBackoffPolicy, O as FederationQueueOptions, P as Message, Q as ActorKeyPairsDispatcher, R as RouterOptions, S as IdempotencyStrategy, T as Rfc6570Expression, U as InProcessMessageQueue, V as respondWithObject, W as InProcessMessageQueueOptions, X as ActorDispatcher, Y as ActorAliasMapper, Z as ActorHandleMapper, _ as FederationBuilder, _t as PageItems, a as InboxContext, at as CustomCollectionDispatcher, b as FederationStartQueueOptions, c as RouteActivityOptions, ct as NodeInfoDispatcher, d as ActorCallbackSetters, dt as OutboxErrorHandler, et as CollectionCounter, f as CollectionCallbackSetters, ft as OutboxPermanentFailureHandler, g as Federation, gt as SenderKeyPair, h as Federatable, ht as SendActivityError, i as GetSignedKeyOptions, it as CustomCollectionCursor, j as RetryContext, k as createFederation, l as SendActivityOptions, lt as ObjectAuthorizePredicate, m as CustomCollectionCallbackSetters, mt as WebFingerLinksDispatcher, n as Context, nt as CollectionDispatcher, o as ParseUriResult, ot as InboxErrorHandler, p as ConstructorWithTypeId, pt as SharedInboxKeyDispatcher, q as MessageQueueListenOptions, r as ForwardActivityOptions, rt as CustomCollectionCounter, s as RequestContext, st as InboxListener, t as ActorKeyPair, tt as CollectionCursor, u as SendActivityOptionsForCollection, ut as ObjectDispatcher, v as FederationFetchOptions, vt as buildCollectionSynchronizationHeader, w as ObjectCallbackSetters, x as IdempotencyKeyCallback, y as FederationOptions, yt as digest, z as RouterRouteResult } from "../context-zLLwVY_G.cjs";
3
3
  import { a as MemoryKvStore, i as KvStoreSetOptions, n as KvStore, r as KvStoreListEntry, t as KvKey } from "../kv-gJ8LYbxX.cjs";
4
- import { n as handleWebFinger, t as WebFingerHandlerParameters } from "../mod-43DJyETz.cjs";
4
+ import { n as handleWebFinger, t as WebFingerHandlerParameters } from "../mod-BtvLkCgb.cjs";
5
5
  export { ActorAliasMapper, ActorCallbackSetters, ActorDispatcher, ActorHandleMapper, ActorKeyPair, ActorKeyPairsDispatcher, AuthorizePredicate, CollectionCallbackSetters, CollectionCounter, CollectionCursor, CollectionDispatcher, ConstructorWithTypeId, Context, CreateExponentialBackoffPolicyOptions, CustomCollectionCallbackSetters, CustomCollectionCounter, CustomCollectionCursor, CustomCollectionDispatcher, Federatable, Federation, FederationBuilder, FederationFetchOptions, FederationKvPrefixes, FederationOptions, FederationOrigin, FederationQueueOptions, FederationStartQueueOptions, ForwardActivityOptions, GetSignedKeyOptions, IdempotencyKeyCallback, IdempotencyStrategy, InProcessMessageQueue, InProcessMessageQueueOptions, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, KvKey, KvStore, KvStoreListEntry, KvStoreSetOptions, MemoryKvStore, Message, MessageQueue, MessageQueueEnqueueOptions, MessageQueueListenOptions, NodeInfoDispatcher, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher, OutboxErrorHandler, OutboxPermanentFailureHandler, PageItems, ParallelMessageQueue, ParseUriResult, RequestContext, RespondWithObjectOptions, RetryContext, RetryPolicy, Rfc6570Expression, RouteActivityOptions, Router, RouterError, RouterOptions, RouterRouteResult, SendActivityError, SendActivityOptions, SendActivityOptionsForCollection, SenderKeyPair, SharedInboxKeyDispatcher, WebFingerHandlerParameters, WebFingerLinksDispatcher, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, handleWebFinger, respondWithObject, respondWithObjectIfAcceptable };
@@ -1,5 +1,5 @@
1
1
  /// <reference lib="esnext.temporal" />
2
- import { $ as AuthorizePredicate, A as CreateExponentialBackoffPolicyOptions, B as RespondWithObjectOptions, C as InboxListenerSetters, D as FederationOrigin, E as FederationKvPrefixes, F as createFederationBuilder, G as MessageQueue, H as respondWithObjectIfAcceptable, I as Router, J as ParallelMessageQueue, K as MessageQueueEnqueueOptions, L as RouterError, M as RetryPolicy, N as createExponentialBackoffPolicy, O as FederationQueueOptions, P as Message, Q as ActorKeyPairsDispatcher, R as RouterOptions, S as IdempotencyStrategy, T as Rfc6570Expression, U as InProcessMessageQueue, V as respondWithObject, W as InProcessMessageQueueOptions, X as ActorDispatcher, Y as ActorAliasMapper, Z as ActorHandleMapper, _ as FederationBuilder, _t as PageItems, a as InboxContext, at as CustomCollectionDispatcher, b as FederationStartQueueOptions, c as RouteActivityOptions, ct as NodeInfoDispatcher, d as ActorCallbackSetters, dt as OutboxErrorHandler, et as CollectionCounter, f as CollectionCallbackSetters, ft as OutboxPermanentFailureHandler, g as Federation, gt as SenderKeyPair, h as Federatable, ht as SendActivityError, i as GetSignedKeyOptions, it as CustomCollectionCursor, j as RetryContext, k as createFederation, l as SendActivityOptions, lt as ObjectAuthorizePredicate, m as CustomCollectionCallbackSetters, mt as WebFingerLinksDispatcher, n as Context, nt as CollectionDispatcher, o as ParseUriResult, ot as InboxErrorHandler, p as ConstructorWithTypeId, pt as SharedInboxKeyDispatcher, q as MessageQueueListenOptions, r as ForwardActivityOptions, rt as CustomCollectionCounter, s as RequestContext, st as InboxListener, t as ActorKeyPair, tt as CollectionCursor, u as SendActivityOptionsForCollection, ut as ObjectDispatcher, v as FederationFetchOptions, vt as buildCollectionSynchronizationHeader, w as ObjectCallbackSetters, x as IdempotencyKeyCallback, y as FederationOptions, yt as digest, z as RouterRouteResult } from "../context-DnsFj3yK.js";
2
+ import { $ as AuthorizePredicate, A as CreateExponentialBackoffPolicyOptions, B as RespondWithObjectOptions, C as InboxListenerSetters, D as FederationOrigin, E as FederationKvPrefixes, F as createFederationBuilder, G as MessageQueue, H as respondWithObjectIfAcceptable, I as Router, J as ParallelMessageQueue, K as MessageQueueEnqueueOptions, L as RouterError, M as RetryPolicy, N as createExponentialBackoffPolicy, O as FederationQueueOptions, P as Message, Q as ActorKeyPairsDispatcher, R as RouterOptions, S as IdempotencyStrategy, T as Rfc6570Expression, U as InProcessMessageQueue, V as respondWithObject, W as InProcessMessageQueueOptions, X as ActorDispatcher, Y as ActorAliasMapper, Z as ActorHandleMapper, _ as FederationBuilder, _t as PageItems, a as InboxContext, at as CustomCollectionDispatcher, b as FederationStartQueueOptions, c as RouteActivityOptions, ct as NodeInfoDispatcher, d as ActorCallbackSetters, dt as OutboxErrorHandler, et as CollectionCounter, f as CollectionCallbackSetters, ft as OutboxPermanentFailureHandler, g as Federation, gt as SenderKeyPair, h as Federatable, ht as SendActivityError, i as GetSignedKeyOptions, it as CustomCollectionCursor, j as RetryContext, k as createFederation, l as SendActivityOptions, lt as ObjectAuthorizePredicate, m as CustomCollectionCallbackSetters, mt as WebFingerLinksDispatcher, n as Context, nt as CollectionDispatcher, o as ParseUriResult, ot as InboxErrorHandler, p as ConstructorWithTypeId, pt as SharedInboxKeyDispatcher, q as MessageQueueListenOptions, r as ForwardActivityOptions, rt as CustomCollectionCounter, s as RequestContext, st as InboxListener, t as ActorKeyPair, tt as CollectionCursor, u as SendActivityOptionsForCollection, ut as ObjectDispatcher, v as FederationFetchOptions, vt as buildCollectionSynchronizationHeader, w as ObjectCallbackSetters, x as IdempotencyKeyCallback, y as FederationOptions, yt as digest, z as RouterRouteResult } from "../context-DJ5oMnte.js";
3
3
  import { a as MemoryKvStore, i as KvStoreSetOptions, n as KvStore, r as KvStoreListEntry, t as KvKey } from "../kv-D6hNiMTK.js";
4
- import { n as handleWebFinger, t as WebFingerHandlerParameters } from "../mod-COgmn-UO.js";
4
+ import { n as handleWebFinger, t as WebFingerHandlerParameters } from "../mod-Du-UVCX_.js";
5
5
  export { ActorAliasMapper, ActorCallbackSetters, ActorDispatcher, ActorHandleMapper, ActorKeyPair, ActorKeyPairsDispatcher, AuthorizePredicate, CollectionCallbackSetters, CollectionCounter, CollectionCursor, CollectionDispatcher, ConstructorWithTypeId, Context, CreateExponentialBackoffPolicyOptions, CustomCollectionCallbackSetters, CustomCollectionCounter, CustomCollectionCursor, CustomCollectionDispatcher, Federatable, Federation, FederationBuilder, FederationFetchOptions, FederationKvPrefixes, FederationOptions, FederationOrigin, FederationQueueOptions, FederationStartQueueOptions, ForwardActivityOptions, GetSignedKeyOptions, IdempotencyKeyCallback, IdempotencyStrategy, InProcessMessageQueue, InProcessMessageQueueOptions, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, KvKey, KvStore, KvStoreListEntry, KvStoreSetOptions, MemoryKvStore, Message, MessageQueue, MessageQueueEnqueueOptions, MessageQueueListenOptions, NodeInfoDispatcher, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher, OutboxErrorHandler, OutboxPermanentFailureHandler, PageItems, ParallelMessageQueue, ParseUriResult, RequestContext, RespondWithObjectOptions, RetryContext, RetryPolicy, Rfc6570Expression, RouteActivityOptions, Router, RouterError, RouterOptions, RouterRouteResult, SendActivityError, SendActivityOptions, SendActivityOptionsForCollection, SenderKeyPair, SharedInboxKeyDispatcher, WebFingerHandlerParameters, WebFingerLinksDispatcher, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, handleWebFinger, respondWithObject, respondWithObjectIfAcceptable };
@@ -1,6 +1,6 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
- import { a as createExponentialBackoffPolicy, c as buildCollectionSynchronizationHeader, d as Router, f as RouterError, i as SendActivityError, l as digest, o as respondWithObject, r as handleWebFinger, s as respondWithObjectIfAcceptable, t as createFederation, u as createFederationBuilder } from "../middleware-CwIT91Nc.js";
3
+ import { a as createExponentialBackoffPolicy, c as buildCollectionSynchronizationHeader, d as Router, f as RouterError, i as SendActivityError, l as digest, o as respondWithObject, r as handleWebFinger, s as respondWithObjectIfAcceptable, t as createFederation, u as createFederationBuilder } from "../middleware-2Qp34eTb.js";
4
4
  import { isEqual } from "es-toolkit";
5
5
  //#region src/federation/kv.ts
6
6
  /**
@@ -8,12 +8,13 @@ import { n as assertFalse, t as assertRejects } from "../assert_rejects-B-qJtC9Z
8
8
  import { t as assertInstanceOf } from "../assert_instance_of-C4Ri6VuN.mjs";
9
9
  import { t as assertNotEquals } from "../assert_not_equals--wG9hV7u.mjs";
10
10
  import { t as assert } from "../assert-ddO5KLpe.mjs";
11
- import { l as verifyRequest } from "../http--P33qRwW.mjs";
11
+ import { l as verifyRequest } from "../http-Bn3-am6C.mjs";
12
12
  import { i as rsaPrivateKey2, n as ed25519PrivateKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-CtZLJq76.mjs";
13
- import { t as doesActorOwnKey } from "../owner-CFgyZgkz.mjs";
14
- import { n as extractInboxes, r as sendActivity, t as SendActivityError } from "../send-pXXMu19o.mjs";
13
+ import { t as doesActorOwnKey } from "../owner-D9CjMxWb.mjs";
14
+ import { n as extractInboxes, r as sendActivity, t as SendActivityError } from "../send-IMhmEkun.mjs";
15
15
  import { createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
16
16
  import { Activity, Application, Endpoints, Group, Person, Service } from "@fedify/vocab";
17
+ import { UrlError } from "@fedify/vocab-runtime";
17
18
  //#region src/federation/send.test.ts
18
19
  test("extractInboxes()", () => {
19
20
  const recipients = [
@@ -415,5 +416,137 @@ test("sendActivity() records OpenTelemetry span events", async (t) => {
415
416
  esm_default.hardReset();
416
417
  });
417
418
  });
419
+ for (const signed of [false, true]) {
420
+ const keys = [{
421
+ privateKey: signed ? rsaPrivateKey2 : ed25519PrivateKey,
422
+ keyId: signed ? rsaPublicKey2.id : ed25519Multikey.id
423
+ }];
424
+ test(`sendActivity() validates destinations (signed: ${signed})`, async (t) => {
425
+ const activity = {
426
+ type: "Create",
427
+ id: "https://example.com/activity"
428
+ };
429
+ const publicInbox = "https://8.8.8.8/inbox";
430
+ const privateInbox = "http://127.0.0.1/inbox";
431
+ for (const target of [
432
+ privateInbox,
433
+ "http://169.254.169.254/",
434
+ "http://[::1]/"
435
+ ]) await t.step(`rejects ${target} before fetching`, async () => {
436
+ esm_default.mockGlobal().catch(202);
437
+ try {
438
+ await assertRejects(() => sendActivity({
439
+ activity,
440
+ keys,
441
+ inbox: new URL(target)
442
+ }), UrlError);
443
+ assertEquals(esm_default.callHistory.calls().length, 0);
444
+ } finally {
445
+ esm_default.hardReset();
446
+ }
447
+ });
448
+ for (const status of [
449
+ 301,
450
+ 302,
451
+ 303,
452
+ 307,
453
+ 308
454
+ ]) for (const allowPrivateAddress of [false, true]) await t.step(`${status} private redirect, opt-in: ${allowPrivateAddress}`, async () => {
455
+ esm_default.mockGlobal();
456
+ esm_default.route(publicInbox, {
457
+ status,
458
+ headers: { Location: privateInbox }
459
+ });
460
+ esm_default.route(privateInbox, 202);
461
+ try {
462
+ const send = () => sendActivity({
463
+ activity,
464
+ keys,
465
+ inbox: new URL(publicInbox),
466
+ allowPrivateAddress
467
+ });
468
+ if (allowPrivateAddress) {
469
+ await send();
470
+ const calls = esm_default.callHistory.calls(privateInbox);
471
+ assertEquals(calls.length, 1);
472
+ const request = calls[0].request;
473
+ const preservesBody = signed || status === 307 || status === 308;
474
+ assertEquals(request.method, preservesBody ? "POST" : "GET");
475
+ assertEquals(await request.clone().text(), preservesBody ? JSON.stringify(activity) : "");
476
+ } else {
477
+ await assertRejects(send, UrlError);
478
+ assertEquals(esm_default.callHistory.calls(privateInbox).length, 0);
479
+ }
480
+ } finally {
481
+ esm_default.hardReset();
482
+ }
483
+ });
484
+ await t.step("rejects a private destination after a public redirect", async () => {
485
+ esm_default.mockGlobal().route(publicInbox, {
486
+ status: 307,
487
+ headers: { Location: "/next" }
488
+ }).route("https://8.8.8.8/next", {
489
+ status: 308,
490
+ headers: { Location: privateInbox }
491
+ }).route(privateInbox, 202);
492
+ try {
493
+ await assertRejects(() => sendActivity({
494
+ activity,
495
+ keys,
496
+ inbox: new URL(publicInbox)
497
+ }), UrlError);
498
+ assertEquals(esm_default.callHistory.calls(privateInbox).length, 0);
499
+ } finally {
500
+ esm_default.hardReset();
501
+ }
502
+ });
503
+ await t.step("limits redirect loops", async () => {
504
+ esm_default.mockGlobal().route(publicInbox, {
505
+ status: 307,
506
+ headers: { Location: publicInbox }
507
+ });
508
+ try {
509
+ await assertRejects(() => sendActivity({
510
+ activity,
511
+ keys,
512
+ inbox: new URL(publicInbox)
513
+ }));
514
+ assert(esm_default.callHistory.calls().length <= 21);
515
+ } finally {
516
+ esm_default.hardReset();
517
+ }
518
+ });
519
+ await t.step("allows a direct private inbox with opt-in", async () => {
520
+ esm_default.mockGlobal().route(privateInbox, 202);
521
+ try {
522
+ await sendActivity({
523
+ activity,
524
+ keys,
525
+ inbox: new URL(privateInbox),
526
+ allowPrivateAddress: true
527
+ });
528
+ assertEquals(esm_default.callHistory.calls(privateInbox).length, 1);
529
+ } finally {
530
+ esm_default.hardReset();
531
+ }
532
+ });
533
+ await t.step("allows relative public redirects", async () => {
534
+ esm_default.mockGlobal().route(publicInbox, {
535
+ status: 307,
536
+ headers: { Location: "/next" }
537
+ }).route("https://8.8.8.8/next", 202);
538
+ try {
539
+ await sendActivity({
540
+ activity,
541
+ keys,
542
+ inbox: new URL(publicInbox)
543
+ });
544
+ assertEquals(esm_default.callHistory.calls("https://8.8.8.8/next").length, 1);
545
+ } finally {
546
+ esm_default.hardReset();
547
+ }
548
+ });
549
+ });
550
+ }
418
551
  //#endregion
419
552
  export {};
@@ -4,7 +4,7 @@ globalThis.addEventListener = () => {};
4
4
  import "../std__assert-Duiq_YC9.mjs";
5
5
  import { n as assertFalse } from "../assert_rejects-B-qJtC9Z.mjs";
6
6
  import { t as assert } from "../assert-ddO5KLpe.mjs";
7
- import { t as hasMalformedKnownTemporalLiteral } from "../temporal-B4rBDksp.mjs";
7
+ import { t as hasMalformedKnownTemporalLiteral } from "../temporal-BovRWwqL.mjs";
8
8
  import { test } from "@fedify/fixture";
9
9
  //#region src/federation/temporal.test.ts
10
10
  test("hasMalformedKnownTemporalLiteral() detects expanded proof timestamps", async () => {
@@ -5,7 +5,7 @@ import { n as createRequestContext } from "../context-Juj6bdHC.mjs";
5
5
  import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
6
6
  import "../std__assert-Duiq_YC9.mjs";
7
7
  import { t as MemoryKvStore } from "../kv-BrZHNugx.mjs";
8
- import { a as createFederation, o as handleWebFinger } from "../middleware-DpEJSmjy.mjs";
8
+ import { a as createFederation, o as handleWebFinger } from "../middleware-D3a1JsO1.mjs";
9
9
  import { test } from "@fedify/fixture";
10
10
  import { Image, Link, Person } from "@fedify/vocab";
11
11
  //#region src/federation/webfinger.test.ts
@@ -11,7 +11,7 @@ let byte_encodings_base64 = require("byte-encodings/base64");
11
11
  let structured_field_values = require("structured-field-values");
12
12
  //#region deno.json
13
13
  var name = "@fedify/fedify";
14
- var version = "2.0.28-dev.1974+d70e3148";
14
+ var version = "2.0.28-dev.1979+d0048bc7";
15
15
  //#endregion
16
16
  //#region src/sig/key.ts
17
17
  /**
@@ -1,8 +1,8 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { n as version, t as name } from "./deno-CGtm12Ft.mjs";
5
- import { a as validateCryptoKey, n as fetchKey } from "./key-rC9mW1U5.mjs";
4
+ import { n as version, t as name } from "./deno-D3gZ1DsB.mjs";
5
+ import { a as validateCryptoKey, n as fetchKey } from "./key-BQUnVMwc.mjs";
6
6
  import { CryptographicKey } from "@fedify/vocab";
7
7
  import { SpanStatusCode, trace } from "@opentelemetry/api";
8
8
  import { FetchError } from "@fedify/vocab-runtime";
@@ -10,7 +10,7 @@ import { decodeBase64, encodeBase64 } from "byte-encodings/base64";
10
10
  import { Item, decodeDict, encodeItem } from "structured-field-values";
11
11
  //#region deno.json
12
12
  var name = "@fedify/fedify";
13
- var version = "2.0.28-dev.1974+d70e3148";
13
+ var version = "2.0.28-dev.1979+d0048bc7";
14
14
  //#endregion
15
15
  //#region src/sig/key.ts
16
16
  /**
@@ -1,7 +1,7 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { n as version, t as name } from "./deno-CGtm12Ft.mjs";
4
+ import { n as version, t as name } from "./deno-D3gZ1DsB.mjs";
5
5
  import { Activity, getTypeId } from "@fedify/vocab";
6
6
  import { SpanKind, SpanStatusCode, context, propagation, trace } from "@opentelemetry/api";
7
7
  import { getLogger } from "@logtape/logtape";
@@ -1,7 +1,7 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { n as version, t as name } from "./deno-CGtm12Ft.mjs";
4
+ import { n as version, t as name } from "./deno-D3gZ1DsB.mjs";
5
5
  import { CryptographicKey, Object as Object$1, isActor } from "@fedify/vocab";
6
6
  import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
7
7
  import { getDocumentLoader } from "@fedify/vocab-runtime";
@@ -1,7 +1,7 @@
1
1
  const { Temporal } = require("@js-temporal/polyfill");
2
2
  const { URLPattern } = require("urlpattern-polyfill");
3
3
  require("./chunk-DDcVe30Y.cjs");
4
- const require_http = require("./http-BuaGj55w.cjs");
4
+ const require_http = require("./http-BLqv_3ue.cjs");
5
5
  let _logtape_logtape = require("@logtape/logtape");
6
6
  let es_toolkit = require("es-toolkit");
7
7
  let _fedify_vocab_runtime = require("@fedify/vocab-runtime");
@@ -1,6 +1,6 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
- import { c as validateCryptoKey, t as doubleKnock } from "./http-BP1pVF9m.js";
3
+ import { c as validateCryptoKey, t as doubleKnock } from "./http-Cx5dD1D_.js";
4
4
  import { getLogger } from "@logtape/logtape";
5
5
  import { curry } from "es-toolkit";
6
6
  import { UrlError, createActivityPubRequest, getRemoteDocument, logRequest, preloadedContexts, validatePublicUrl } from "@fedify/vocab-runtime";
@@ -1,8 +1,8 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { n as version, t as name } from "./deno-CGtm12Ft.mjs";
5
- import { a as validateCryptoKey, n as fetchKey } from "./key-rC9mW1U5.mjs";
4
+ import { n as version, t as name } from "./deno-D3gZ1DsB.mjs";
5
+ import { a as validateCryptoKey, n as fetchKey } from "./key-BQUnVMwc.mjs";
6
6
  import { Activity, CryptographicKey, Object as Object$1, getTypeId } from "@fedify/vocab";
7
7
  import { SpanStatusCode, trace } from "@opentelemetry/api";
8
8
  import { getDocumentLoader } from "@fedify/vocab-runtime";