@fedify/fedify 2.0.33 → 2.0.34-dev.2423

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 (49) hide show
  1. package/dist/{builder-BJHi8-yt.mjs → builder-yrlWWSb2.mjs} +3 -3
  2. package/dist/compat/transformers.test.mjs +1 -1
  3. package/dist/{deno-DxxJ7DXK.mjs → deno-VKs2mmuk.mjs} +1 -1
  4. package/dist/{docloader-CINB2BX4.mjs → docloader-C_D_5OXh.mjs} +5 -3
  5. package/dist/federation/builder.test.mjs +1 -1
  6. package/dist/federation/handler.test.mjs +6 -6
  7. package/dist/federation/idempotency.test.mjs +2 -2
  8. package/dist/federation/inbox.test.mjs +1 -1
  9. package/dist/federation/keycache.test.mjs +18 -7
  10. package/dist/federation/middleware.test.mjs +6 -6
  11. package/dist/federation/mod.cjs +1 -1
  12. package/dist/federation/mod.js +1 -1
  13. package/dist/federation/send.test.mjs +3 -3
  14. package/dist/federation/temporal.test.mjs +1 -1
  15. package/dist/federation/webfinger.test.mjs +1 -1
  16. package/dist/{http-CWWgD1YT.mjs → http-5zy1STVq.mjs} +2 -2
  17. package/dist/{http-DaSZw9Op.js → http-C_lGOZVR.js} +17 -3
  18. package/dist/{http-qvfJE6bK.cjs → http-CuYc-XkP.cjs} +17 -3
  19. package/dist/{inbox-D1LSfOOd.mjs → inbox-3nhkGSMW.mjs} +1 -1
  20. package/dist/{key-Bs7PNRrg.mjs → key-wwpJQHM0.mjs} +17 -3
  21. package/dist/{keycache-D239uGT9.mjs → keycache-DBD6fzl1.mjs} +1 -1
  22. package/dist/{kv-cache-D95UjzfB.js → kv-cache-DgG5Sj35.js} +4 -2
  23. package/dist/{kv-cache-BKk8naEu.cjs → kv-cache-DhMHcykY.cjs} +4 -2
  24. package/dist/{ld-BlH5jQ7T.mjs → ld-BCjStgTd.mjs} +2 -2
  25. package/dist/{middleware-BGMXK3Xj.mjs → middleware-Bxav3na4.mjs} +1 -1
  26. package/dist/{middleware-C9GIRvU2.cjs → middleware-CHSunb_b.cjs} +5 -5
  27. package/dist/{middleware-D7b2kyYw.cjs → middleware-CSW_W0q6.cjs} +1 -1
  28. package/dist/{middleware-DOo95yst.mjs → middleware-CeIMgD2N.mjs} +12 -12
  29. package/dist/{middleware-BGl-31cO.js → middleware-hfX624bD.js} +4 -4
  30. package/dist/mod.cjs +4 -4
  31. package/dist/mod.js +4 -4
  32. package/dist/nodeinfo/handler.test.mjs +1 -1
  33. package/dist/{owner-9OeM4q1P.mjs → owner-adLePX_5.mjs} +2 -2
  34. package/dist/{proof-BkLdxRY-.js → proof-BAxqx8DQ.js} +1 -1
  35. package/dist/{proof-D7USj3fe.cjs → proof-CIg5BBtv.cjs} +1 -1
  36. package/dist/{proof-B-oGOuzf.mjs → proof-De7RbPGn.mjs} +2 -2
  37. package/dist/{send-Bjw1BCUr.mjs → send-KK7FluNF.mjs} +2 -2
  38. package/dist/sig/http.test.mjs +2 -2
  39. package/dist/sig/key.test.mjs +197 -3
  40. package/dist/sig/ld.test.mjs +47 -2
  41. package/dist/sig/mod.cjs +2 -2
  42. package/dist/sig/mod.js +2 -2
  43. package/dist/sig/owner.test.mjs +46 -1
  44. package/dist/sig/proof.test.mjs +52 -1
  45. package/dist/{temporal-Bf5PdJPv.mjs → temporal-D6Uf0KUy.mjs} +1 -1
  46. package/dist/utils/docloader.test.mjs +66 -2
  47. package/dist/utils/mod.cjs +1 -1
  48. package/dist/utils/mod.js +1 -1
  49. package/package.json +6 -6
@@ -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-DxxJ7DXK.mjs";
6
- import { t as InboxListenerSet } from "./inbox-D1LSfOOd.mjs";
5
+ import { n as version, t as name } from "./deno-VKs2mmuk.mjs";
6
+ import { t as InboxListenerSet } from "./inbox-3nhkGSMW.mjs";
7
7
  import { getTypeId } from "@fedify/vocab";
8
8
  import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
9
9
  import { getLogger } from "@logtape/logtape";
@@ -43,7 +43,7 @@ var FederationBuilderImpl = class {
43
43
  this.collectionTypeIds = {};
44
44
  }
45
45
  async build(options) {
46
- const { FederationImpl } = await import("./middleware-BGMXK3Xj.mjs");
46
+ const { FederationImpl } = await import("./middleware-Bxav3na4.mjs");
47
47
  const f = new FederationImpl(options);
48
48
  const trailingSlashInsensitiveValue = f.router.trailingSlashInsensitive;
49
49
  f.router = this.router.clone();
@@ -4,7 +4,7 @@ globalThis.addEventListener = () => {};
4
4
  import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
5
5
  import { n as assertInstanceOf, t as assert } from "../assert-BhQd8QHP.mjs";
6
6
  import { t as MemoryKvStore } from "../kv-mI4Ix2EU.mjs";
7
- import { _ as autoIdAssigner, g as actorDehydrator, n as FederationImpl } from "../middleware-DOo95yst.mjs";
7
+ import { _ as autoIdAssigner, g as actorDehydrator, n as FederationImpl } from "../middleware-CeIMgD2N.mjs";
8
8
  import { test } from "@fedify/fixture";
9
9
  import { Follow, Person } from "@fedify/vocab";
10
10
  //#region src/compat/transformers.test.ts
@@ -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.33";
6
+ var version = "2.0.34-dev.2423+4999dc80";
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 { o as validateCryptoKey } from "./key-Bs7PNRrg.mjs";
5
- import { n as doubleKnock } from "./http-CWWgD1YT.mjs";
4
+ import { o as validateCryptoKey } from "./key-wwpJQHM0.mjs";
5
+ import { n as doubleKnock } from "./http-5zy1STVq.mjs";
6
6
  import { curry } from "es-toolkit";
7
7
  import { FetchError, UrlError, createActivityPubRequest, getRemoteDocument, logRequest, validatePublicUrl } from "@fedify/vocab-runtime";
8
8
  import { getLogger } from "@logtape/logtape";
@@ -58,8 +58,10 @@ function getAuthenticatedDocumentLoader(identity, { allowPrivateAddress, userAge
58
58
  });
59
59
  }
60
60
  async function validateUrl(url) {
61
- const protocol = new URL(url).protocol;
61
+ const parsedUrl = new URL(url);
62
+ const protocol = parsedUrl.protocol;
62
63
  if (protocol !== "http:" && protocol !== "https:") throw new UrlError(`Unsupported protocol: ${protocol}`);
64
+ if (parsedUrl.username !== "" || parsedUrl.password !== "") throw new UrlError("URLs with credentials are not allowed");
63
65
  if (!allowPrivateAddress) try {
64
66
  await validatePublicUrl(url);
65
67
  } catch (error) {
@@ -5,7 +5,7 @@ import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
5
5
  import { i as assertExists, n as assertStrictEquals } from "../std__assert-DflMZha5.mjs";
6
6
  import { t as assertThrows } from "../assert_throws-D4DNWrux.mjs";
7
7
  import { t as MemoryKvStore } from "../kv-mI4Ix2EU.mjs";
8
- import { n as createFederationBuilder } from "../builder-BJHi8-yt.mjs";
8
+ import { n as createFederationBuilder } from "../builder-yrlWWSb2.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,14 +6,14 @@ import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
6
6
  import "../std__assert-DflMZha5.mjs";
7
7
  import { t as assert } from "../assert-BhQd8QHP.mjs";
8
8
  import { t as assertRejects } from "../assert_rejects-WyYSTDDX.mjs";
9
- import { i as generateCryptoKeyPair } from "../key-Bs7PNRrg.mjs";
10
- import { s as signRequest } from "../http-CWWgD1YT.mjs";
9
+ import { i as generateCryptoKeyPair } from "../key-wwpJQHM0.mjs";
10
+ import { s as signRequest } from "../http-5zy1STVq.mjs";
11
11
  import { a as rsaPrivateKey3, c as rsaPublicKey3, n as ed25519PrivateKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-CCxRJhWa.mjs";
12
- import { a as compactJsonLd, f as signJsonLd } from "../ld-BlH5jQ7T.mjs";
13
- import { n as signObject } from "../proof-B-oGOuzf.mjs";
12
+ import { a as compactJsonLd, f as signJsonLd } from "../ld-BCjStgTd.mjs";
13
+ import { n as signObject } from "../proof-De7RbPGn.mjs";
14
14
  import { t as MemoryKvStore } from "../kv-mI4Ix2EU.mjs";
15
- 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-DOo95yst.mjs";
16
- import { t as InboxListenerSet } from "../inbox-D1LSfOOd.mjs";
15
+ 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-CeIMgD2N.mjs";
16
+ import { t as InboxListenerSet } from "../inbox-3nhkGSMW.mjs";
17
17
  import { createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
18
18
  import { Create, CryptographicKey, Multikey, Note, Person } from "@fedify/vocab";
19
19
  //#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-DflMZha5.mjs";
6
6
  import { n as ed25519PrivateKey, r as ed25519PublicKey, t as ed25519Multikey } from "../keys-CCxRJhWa.mjs";
7
- import { n as signObject } from "../proof-B-oGOuzf.mjs";
7
+ import { n as signObject } from "../proof-De7RbPGn.mjs";
8
8
  import { t as MemoryKvStore } from "../kv-mI4Ix2EU.mjs";
9
- import { a as createFederation } from "../middleware-DOo95yst.mjs";
9
+ import { a as createFederation } from "../middleware-CeIMgD2N.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 { r as assertFalse, t as assertThrows } from "../assert_throws-D4DNWrux.mjs";
6
- import { n as actorsHaveSameOrigin, t as InboxListenerSet } from "../inbox-D1LSfOOd.mjs";
6
+ import { n as actorsHaveSameOrigin, t as InboxListenerSet } from "../inbox-3nhkGSMW.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
@@ -4,7 +4,7 @@ globalThis.addEventListener = () => {};
4
4
  import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
5
5
  import { n as assertInstanceOf, t as assert } from "../assert-BhQd8QHP.mjs";
6
6
  import { t as MemoryKvStore } from "../kv-mI4Ix2EU.mjs";
7
- import { t as KvKeyCache } from "../keycache-D239uGT9.mjs";
7
+ import { t as KvKeyCache } from "../keycache-DBD6fzl1.mjs";
8
8
  import { test } from "@fedify/fixture";
9
9
  import { CryptographicKey, Multikey } from "@fedify/vocab";
10
10
  //#region src/federation/keycache.test.ts
@@ -14,7 +14,7 @@ test("KvKeyCache.set()", async () => {
14
14
  await cache.set(new URL("https://example.com/key"), new CryptographicKey({ id: new URL("https://example.com/key") }));
15
15
  assertEquals(await kv.get([
16
16
  "pk",
17
- "2",
17
+ "3",
18
18
  "https://example.com/key"
19
19
  ]), {
20
20
  "@context": "https://w3id.org/security/v1",
@@ -24,7 +24,7 @@ test("KvKeyCache.set()", async () => {
24
24
  await cache.set(new URL("https://example.com/key2"), new Multikey({ id: new URL("https://example.com/key2") }));
25
25
  assertEquals(await kv.get([
26
26
  "pk",
27
- "2",
27
+ "3",
28
28
  "https://example.com/key2"
29
29
  ]), {
30
30
  "@context": "https://w3id.org/security/multikey/v1",
@@ -35,7 +35,7 @@ test("KvKeyCache.set()", async () => {
35
35
  assert(cache.nullKeys.has("https://example.com/null"));
36
36
  assertEquals(await kv.get([
37
37
  "pk",
38
- "2",
38
+ "3",
39
39
  "https://example.com/null"
40
40
  ]), { _fedify: "key-unavailable" });
41
41
  });
@@ -44,7 +44,7 @@ test("KvKeyCache.get()", async () => {
44
44
  const cache = new KvKeyCache(kv, ["pk"]);
45
45
  await kv.set([
46
46
  "pk",
47
- "2",
47
+ "3",
48
48
  "https://example.com/key"
49
49
  ], {
50
50
  "@context": "https://w3id.org/security/v1",
@@ -56,7 +56,7 @@ test("KvKeyCache.get()", async () => {
56
56
  assertEquals(cryptoKey?.id?.href, "https://example.com/key");
57
57
  await kv.set([
58
58
  "pk",
59
- "2",
59
+ "3",
60
60
  "https://example.com/key2"
61
61
  ], {
62
62
  "@context": "https://w3id.org/security/multikey/v1",
@@ -70,7 +70,7 @@ test("KvKeyCache.get()", async () => {
70
70
  assertEquals(await cache.get(new URL("https://example.com/null")), null);
71
71
  await kv.set([
72
72
  "pk",
73
- "2",
73
+ "3",
74
74
  "https://example.com/null2"
75
75
  ], { _fedify: "key-unavailable" });
76
76
  assertEquals(await new KvKeyCache(kv, ["pk"]).get(new URL("https://example.com/null2")), null);
@@ -85,6 +85,17 @@ test("KvKeyCache.get() ignores entries from an earlier generation", async () =>
85
85
  type: "CryptographicKey"
86
86
  });
87
87
  assertEquals(await cache.get(new URL("https://example.com/key")), void 0);
88
+ await kv.set([
89
+ "pk",
90
+ "2",
91
+ "https://example.com/key2"
92
+ ], {
93
+ "@context": "https://w3id.org/security/v1",
94
+ id: "https://example.com/key2",
95
+ owner: "https://example.com/impersonated",
96
+ type: "CryptographicKey"
97
+ });
98
+ assertEquals(await cache.get(new URL("https://example.com/key2")), void 0);
88
99
  });
89
100
  //#endregion
90
101
  export {};
@@ -9,14 +9,14 @@ import { r as assertFalse, t as assertThrows } from "../assert_throws-D4DNWrux.m
9
9
  import { n as assertInstanceOf, t as assert } from "../assert-BhQd8QHP.mjs";
10
10
  import { t as assertNotEquals } from "../assert_not_equals-BkxW5QJI.mjs";
11
11
  import { t as assertRejects } from "../assert_rejects-WyYSTDDX.mjs";
12
- import { l as verifyRequest, s as signRequest } from "../http-CWWgD1YT.mjs";
12
+ import { l as verifyRequest, s as signRequest } from "../http-5zy1STVq.mjs";
13
13
  import { a as rsaPrivateKey3, c as rsaPublicKey3, i as rsaPrivateKey2, n as ed25519PrivateKey, r as ed25519PublicKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-CCxRJhWa.mjs";
14
- import { t as getAuthenticatedDocumentLoader } from "../docloader-CINB2BX4.mjs";
15
- import { a as compactJsonLd, f as signJsonLd, m as verifyJsonLd, s as detachSignature } from "../ld-BlH5jQ7T.mjs";
16
- import { t as doesActorOwnKey } from "../owner-9OeM4q1P.mjs";
17
- import { n as signObject, r as verifyObject } from "../proof-B-oGOuzf.mjs";
14
+ import { t as getAuthenticatedDocumentLoader } from "../docloader-C_D_5OXh.mjs";
15
+ import { a as compactJsonLd, f as signJsonLd, m as verifyJsonLd, s as detachSignature } from "../ld-BCjStgTd.mjs";
16
+ import { t as doesActorOwnKey } from "../owner-adLePX_5.mjs";
17
+ import { n as signObject, r as verifyObject } from "../proof-De7RbPGn.mjs";
18
18
  import { t as MemoryKvStore } from "../kv-mI4Ix2EU.mjs";
19
- import { a as createFederation, i as KvSpecDeterminer, n as FederationImpl, r as InboxContextImpl, t as ContextImpl } from "../middleware-DOo95yst.mjs";
19
+ import { a as createFederation, i as KvSpecDeterminer, n as FederationImpl, r as InboxContextImpl, t as ContextImpl } from "../middleware-CeIMgD2N.mjs";
20
20
  import { mockDocumentLoader, test } from "@fedify/fixture";
21
21
  import * as vocab from "@fedify/vocab";
22
22
  import { Create, Offer, Person, getTypeId, lookupObject } from "@fedify/vocab";
@@ -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-C9GIRvU2.cjs");
5
+ const require_middleware = require("../middleware-CHSunb_b.cjs");
6
6
  let es_toolkit = require("es-toolkit");
7
7
  //#region src/federation/kv.ts
8
8
  /**
@@ -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-BGl-31cO.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-hfX624bD.js";
4
4
  import { isEqual } from "es-toolkit";
5
5
  //#region src/federation/kv.ts
6
6
  /**
@@ -8,10 +8,10 @@ import { r as assertFalse } from "../assert_throws-D4DNWrux.mjs";
8
8
  import { n as assertInstanceOf, t as assert } from "../assert-BhQd8QHP.mjs";
9
9
  import { t as assertNotEquals } from "../assert_not_equals-BkxW5QJI.mjs";
10
10
  import { t as assertRejects } from "../assert_rejects-WyYSTDDX.mjs";
11
- import { l as verifyRequest } from "../http-CWWgD1YT.mjs";
11
+ import { l as verifyRequest } from "../http-5zy1STVq.mjs";
12
12
  import { i as rsaPrivateKey2, n as ed25519PrivateKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-CCxRJhWa.mjs";
13
- import { t as doesActorOwnKey } from "../owner-9OeM4q1P.mjs";
14
- import { n as extractInboxes, r as sendActivity, t as SendActivityError } from "../send-Bjw1BCUr.mjs";
13
+ import { t as doesActorOwnKey } from "../owner-adLePX_5.mjs";
14
+ import { n as extractInboxes, r as sendActivity, t as SendActivityError } from "../send-KK7FluNF.mjs";
15
15
  import { createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
16
16
  import { Activity, Application, Endpoints, Group, Person, Service } from "@fedify/vocab";
17
17
  import { FetchError, UrlError } from "@fedify/vocab-runtime";
@@ -4,7 +4,7 @@ globalThis.addEventListener = () => {};
4
4
  import "../std__assert-DflMZha5.mjs";
5
5
  import { r as assertFalse } from "../assert_throws-D4DNWrux.mjs";
6
6
  import { t as assert } from "../assert-BhQd8QHP.mjs";
7
- import { t as hasMalformedKnownTemporalLiteral } from "../temporal-Bf5PdJPv.mjs";
7
+ import { t as hasMalformedKnownTemporalLiteral } from "../temporal-D6Uf0KUy.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-DflMZha5.mjs";
7
7
  import { t as MemoryKvStore } from "../kv-mI4Ix2EU.mjs";
8
- import { a as createFederation, o as handleWebFinger } from "../middleware-DOo95yst.mjs";
8
+ import { a as createFederation, o as handleWebFinger } from "../middleware-CeIMgD2N.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
@@ -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-DxxJ7DXK.mjs";
5
- import { o as validateCryptoKey, r as fetchKey } from "./key-Bs7PNRrg.mjs";
4
+ import { n as version, t as name } from "./deno-VKs2mmuk.mjs";
5
+ import { o as validateCryptoKey, r as fetchKey } from "./key-wwpJQHM0.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.33";
13
+ var version = "2.0.34-dev.2423+4999dc80";
14
14
  //#endregion
15
15
  //#region src/sig/key.ts
16
16
  /** Classifies decoding failures without hiding unexpected loader errors. */
@@ -135,16 +135,23 @@ async function importJwk(jwk, type) {
135
135
  /**
136
136
  * Fetches the document that the given actor URI dereferences to, and returns
137
137
  * the actor only if the host that served the document is authoritative for
138
- * the id the document claims.
138
+ * the id the document claims, and that id is the actor that was asked for.
139
139
  *
140
140
  * Only the origin that serves an actor id can speak for it. Without that
141
141
  * rule any host could serve a document describing somebody else's actor—and
142
142
  * listing its own keys as that actor's.
143
143
  *
144
+ * The returned actor always has exactly the requested `actorId` as its `id`.
145
+ * A document loader follows redirects and alternate document links, so the
146
+ * document an actor id leads to may describe a different actor altogether,
147
+ * on the same origin or on another; accepting it would attribute that other
148
+ * actor's keys to the requested one. See GHSA-8863-8468-7hq7.
149
+ *
144
150
  * @param actorId The URI of the actor to fetch.
145
151
  * @param options Options for fetching the document.
146
152
  * @returns The actor, or `null` if the document cannot be fetched, is not an
147
- * actor, or belongs to another origin.
153
+ * actor, belongs to another origin, or describes an actor other
154
+ * than the requested one.
148
155
  * @internal
149
156
  */
150
157
  async function fetchActorDocument(actorId, options = {}) {
@@ -195,6 +202,13 @@ async function fetchActorDocument(actorId, options = {}) {
195
202
  });
196
203
  return null;
197
204
  }
205
+ if (object.id.href !== actorId.href) {
206
+ logger.debug("The document fetched for the actor {actorId} is the actor {documentActorId} instead; refusing to treat it as the requested actor's document.", {
207
+ actorId: actorId.href,
208
+ documentActorId: object.id.href
209
+ });
210
+ return null;
211
+ }
198
212
  return object;
199
213
  }
200
214
  /**
@@ -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.33";
14
+ var version = "2.0.34-dev.2423+4999dc80";
15
15
  //#endregion
16
16
  //#region src/sig/key.ts
17
17
  /** Classifies decoding failures without hiding unexpected loader errors. */
@@ -136,16 +136,23 @@ async function importJwk(jwk, type) {
136
136
  /**
137
137
  * Fetches the document that the given actor URI dereferences to, and returns
138
138
  * the actor only if the host that served the document is authoritative for
139
- * the id the document claims.
139
+ * the id the document claims, and that id is the actor that was asked for.
140
140
  *
141
141
  * Only the origin that serves an actor id can speak for it. Without that
142
142
  * rule any host could serve a document describing somebody else's actor—and
143
143
  * listing its own keys as that actor's.
144
144
  *
145
+ * The returned actor always has exactly the requested `actorId` as its `id`.
146
+ * A document loader follows redirects and alternate document links, so the
147
+ * document an actor id leads to may describe a different actor altogether,
148
+ * on the same origin or on another; accepting it would attribute that other
149
+ * actor's keys to the requested one. See GHSA-8863-8468-7hq7.
150
+ *
145
151
  * @param actorId The URI of the actor to fetch.
146
152
  * @param options Options for fetching the document.
147
153
  * @returns The actor, or `null` if the document cannot be fetched, is not an
148
- * actor, or belongs to another origin.
154
+ * actor, belongs to another origin, or describes an actor other
155
+ * than the requested one.
149
156
  * @internal
150
157
  */
151
158
  async function fetchActorDocument(actorId, options = {}) {
@@ -196,6 +203,13 @@ async function fetchActorDocument(actorId, options = {}) {
196
203
  });
197
204
  return null;
198
205
  }
206
+ if (object.id.href !== actorId.href) {
207
+ logger.debug("The document fetched for the actor {actorId} is the actor {documentActorId} instead; refusing to treat it as the requested actor's document.", {
208
+ actorId: actorId.href,
209
+ documentActorId: object.id.href
210
+ });
211
+ return null;
212
+ }
199
213
  return object;
200
214
  }
201
215
  /**
@@ -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-DxxJ7DXK.mjs";
4
+ import { n as version, t as name } from "./deno-VKs2mmuk.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-DxxJ7DXK.mjs";
4
+ import { n as version, t as name } from "./deno-VKs2mmuk.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 { FetchError, UrlError, getDocumentLoader } from "@fedify/vocab-runtime";
@@ -129,16 +129,23 @@ async function importJwk(jwk, type) {
129
129
  /**
130
130
  * Fetches the document that the given actor URI dereferences to, and returns
131
131
  * the actor only if the host that served the document is authoritative for
132
- * the id the document claims.
132
+ * the id the document claims, and that id is the actor that was asked for.
133
133
  *
134
134
  * Only the origin that serves an actor id can speak for it. Without that
135
135
  * rule any host could serve a document describing somebody else's actor—and
136
136
  * listing its own keys as that actor's.
137
137
  *
138
+ * The returned actor always has exactly the requested `actorId` as its `id`.
139
+ * A document loader follows redirects and alternate document links, so the
140
+ * document an actor id leads to may describe a different actor altogether,
141
+ * on the same origin or on another; accepting it would attribute that other
142
+ * actor's keys to the requested one. See GHSA-8863-8468-7hq7.
143
+ *
138
144
  * @param actorId The URI of the actor to fetch.
139
145
  * @param options Options for fetching the document.
140
146
  * @returns The actor, or `null` if the document cannot be fetched, is not an
141
- * actor, or belongs to another origin.
147
+ * actor, belongs to another origin, or describes an actor other
148
+ * than the requested one.
142
149
  * @internal
143
150
  */
144
151
  async function fetchActorDocument(actorId, options = {}) {
@@ -189,6 +196,13 @@ async function fetchActorDocument(actorId, options = {}) {
189
196
  });
190
197
  return null;
191
198
  }
199
+ if (object.id.href !== actorId.href) {
200
+ logger.debug("The document fetched for the actor {actorId} is the actor {documentActorId} instead; refusing to treat it as the requested actor's document.", {
201
+ actorId: actorId.href,
202
+ documentActorId: object.id.href
203
+ });
204
+ return null;
205
+ }
192
206
  return object;
193
207
  }
194
208
  /**
@@ -5,7 +5,7 @@ import { CryptographicKey, Multikey } from "@fedify/vocab";
5
5
  //#region src/federation/keycache.ts
6
6
  const NULL_KEY_CACHE_VALUE = { _fedify: "key-unavailable" };
7
7
  const NULL_KEY_CACHE_TTL = Temporal.Duration.from({ minutes: 5 });
8
- const KEY_CACHE_GENERATION = "2";
8
+ const KEY_CACHE_GENERATION = "3";
9
9
  function isNullKeyCacheValue(value) {
10
10
  return typeof value === "object" && value != null && "_fedify" in value && value._fedify === NULL_KEY_CACHE_VALUE._fedify;
11
11
  }
@@ -1,6 +1,6 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
- import { l as validateCryptoKey, t as doubleKnock } from "./http-DaSZw9Op.js";
3
+ import { l as validateCryptoKey, t as doubleKnock } from "./http-C_lGOZVR.js";
4
4
  import { getLogger } from "@logtape/logtape";
5
5
  import { curry } from "es-toolkit";
6
6
  import { FetchError, UrlError, createActivityPubRequest, getRemoteDocument, logRequest, preloadedContexts, validatePublicUrl } from "@fedify/vocab-runtime";
@@ -56,8 +56,10 @@ function getAuthenticatedDocumentLoader(identity, { allowPrivateAddress, userAge
56
56
  });
57
57
  }
58
58
  async function validateUrl(url) {
59
- const protocol = new URL(url).protocol;
59
+ const parsedUrl = new URL(url);
60
+ const protocol = parsedUrl.protocol;
60
61
  if (protocol !== "http:" && protocol !== "https:") throw new UrlError(`Unsupported protocol: ${protocol}`);
62
+ if (parsedUrl.username !== "" || parsedUrl.password !== "") throw new UrlError("URLs with credentials are not allowed");
61
63
  if (!allowPrivateAddress) try {
62
64
  await validatePublicUrl(url);
63
65
  } catch (error) {
@@ -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-qvfJE6bK.cjs");
4
+ const require_http = require("./http-CuYc-XkP.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");
@@ -57,8 +57,10 @@ function getAuthenticatedDocumentLoader(identity, { allowPrivateAddress, userAge
57
57
  });
58
58
  }
59
59
  async function validateUrl(url) {
60
- const protocol = new URL(url).protocol;
60
+ const parsedUrl = new URL(url);
61
+ const protocol = parsedUrl.protocol;
61
62
  if (protocol !== "http:" && protocol !== "https:") throw new _fedify_vocab_runtime.UrlError(`Unsupported protocol: ${protocol}`);
63
+ if (parsedUrl.username !== "" || parsedUrl.password !== "") throw new _fedify_vocab_runtime.UrlError("URLs with credentials are not allowed");
62
64
  if (!allowPrivateAddress) try {
63
65
  await (0, _fedify_vocab_runtime.validatePublicUrl)(url);
64
66
  } catch (error) {
@@ -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-DxxJ7DXK.mjs";
5
- import { o as validateCryptoKey, r as fetchKey } from "./key-Bs7PNRrg.mjs";
4
+ import { n as version, t as name } from "./deno-VKs2mmuk.mjs";
5
+ import { o as validateCryptoKey, r as fetchKey } from "./key-wwpJQHM0.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";
@@ -1,5 +1,5 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { n as FederationImpl } from "./middleware-DOo95yst.mjs";
4
+ import { n as FederationImpl } from "./middleware-CeIMgD2N.mjs";
5
5
  export { FederationImpl };
@@ -2,10 +2,10 @@ const { Temporal } = require("@js-temporal/polyfill");
2
2
  const { URLPattern } = require("urlpattern-polyfill");
3
3
  const require_chunk = require("./chunk-DDcVe30Y.cjs");
4
4
  const require_transformers = require("./transformers-NeAONrAq.cjs");
5
- const require_http = require("./http-qvfJE6bK.cjs");
5
+ const require_http = require("./http-CuYc-XkP.cjs");
6
6
  const require_types = require("./types-DRPjmHVV.cjs");
7
- const require_proof = require("./proof-D7USj3fe.cjs");
8
- const require_kv_cache = require("./kv-cache-BKk8naEu.cjs");
7
+ const require_proof = require("./proof-CIg5BBtv.cjs");
8
+ const require_kv_cache = require("./kv-cache-DhMHcykY.cjs");
9
9
  let _logtape_logtape = require("@logtape/logtape");
10
10
  let _fedify_vocab = require("@fedify/vocab");
11
11
  let _opentelemetry_api = require("@opentelemetry/api");
@@ -349,7 +349,7 @@ var FederationBuilderImpl = class {
349
349
  this.collectionTypeIds = {};
350
350
  }
351
351
  async build(options) {
352
- const { FederationImpl } = await Promise.resolve().then(() => require("./middleware-D7b2kyYw.cjs"));
352
+ const { FederationImpl } = await Promise.resolve().then(() => require("./middleware-CSW_W0q6.cjs"));
353
353
  const f = new FederationImpl(options);
354
354
  const trailingSlashInsensitiveValue = f.router.trailingSlashInsensitive;
355
355
  f.router = this.router.clone();
@@ -879,7 +879,7 @@ async function buildCollectionSynchronizationHeader(collectionId, actorIds) {
879
879
  //#region src/federation/keycache.ts
880
880
  const NULL_KEY_CACHE_VALUE = { _fedify: "key-unavailable" };
881
881
  const NULL_KEY_CACHE_TTL = Temporal.Duration.from({ minutes: 5 });
882
- const KEY_CACHE_GENERATION = "2";
882
+ const KEY_CACHE_GENERATION = "3";
883
883
  function isNullKeyCacheValue(value) {
884
884
  return typeof value === "object" && value != null && "_fedify" in value && value._fedify === NULL_KEY_CACHE_VALUE._fedify;
885
885
  }
@@ -1,4 +1,4 @@
1
1
  const { Temporal } = require("@js-temporal/polyfill");
2
2
  const { URLPattern } = require("urlpattern-polyfill");
3
- const require_middleware = require("./middleware-C9GIRvU2.cjs");
3
+ const require_middleware = require("./middleware-CHSunb_b.cjs");
4
4
  exports.FederationImpl = require_middleware.FederationImpl;
@@ -2,24 +2,24 @@ import { Temporal } from "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
4
  import { n as RouterError } from "./router-CrMLXoOr.mjs";
5
- import { n as version, t as name } from "./deno-DxxJ7DXK.mjs";
6
- import { a as importJwk, o as validateCryptoKey, t as exportJwk } from "./key-Bs7PNRrg.mjs";
7
- import { l as verifyRequest } from "./http-CWWgD1YT.mjs";
8
- import { t as getAuthenticatedDocumentLoader } from "./docloader-CINB2BX4.mjs";
5
+ import { n as version, t as name } from "./deno-VKs2mmuk.mjs";
6
+ import { a as importJwk, o as validateCryptoKey, t as exportJwk } from "./key-wwpJQHM0.mjs";
7
+ import { l as verifyRequest } from "./http-5zy1STVq.mjs";
8
+ import { t as getAuthenticatedDocumentLoader } from "./docloader-C_D_5OXh.mjs";
9
9
  import { n as kvCache } from "./kv-cache-BrjuJue8.mjs";
10
- import { a as compactJsonLd, c as getNormalizationContextLoader, d as isInvalidUrlTypeError, f as signJsonLd, g as wrapContextLoaderForJsonLd, l as hasSignature, p as verifyCompactJsonLd, r as assertSafeJsonLd, s as detachSignature, t as InvalidContextReferenceError, u as isClearlyMalformedContextReference } from "./ld-BlH5jQ7T.mjs";
11
- import { n as getKeyOwner, t as doesActorOwnKey } from "./owner-9OeM4q1P.mjs";
12
- import { n as signObject, r as verifyObject } from "./proof-B-oGOuzf.mjs";
10
+ import { a as compactJsonLd, c as getNormalizationContextLoader, d as isInvalidUrlTypeError, f as signJsonLd, g as wrapContextLoaderForJsonLd, l as hasSignature, p as verifyCompactJsonLd, r as assertSafeJsonLd, s as detachSignature, t as InvalidContextReferenceError, u as isClearlyMalformedContextReference } from "./ld-BCjStgTd.mjs";
11
+ import { n as getKeyOwner, t as doesActorOwnKey } from "./owner-adLePX_5.mjs";
12
+ import { n as signObject, r as verifyObject } from "./proof-De7RbPGn.mjs";
13
13
  import { d as readBoundedText, l as BodyTooLargeError, t as getNodeInfo, u as MAX_BODY_SIZE } from "./client-BUqbea1d.mjs";
14
14
  import { t as nodeInfoToJson } from "./types-MNlFfxjv.mjs";
15
- import { n as actorsHaveSameOrigin, r as routeActivity } from "./inbox-D1LSfOOd.mjs";
16
- import { t as FederationBuilderImpl } from "./builder-BJHi8-yt.mjs";
15
+ import { n as actorsHaveSameOrigin, r as routeActivity } from "./inbox-3nhkGSMW.mjs";
16
+ import { t as FederationBuilderImpl } from "./builder-yrlWWSb2.mjs";
17
17
  import { t as buildCollectionSynchronizationHeader } from "./collection-DI6YzYpd.mjs";
18
- import { t as KvKeyCache } from "./keycache-D239uGT9.mjs";
18
+ import { t as KvKeyCache } from "./keycache-DBD6fzl1.mjs";
19
19
  import { t as acceptsJsonLd } from "./negotiation-TWEs6Cl8.mjs";
20
- import { t as hasMalformedKnownTemporalLiteral } from "./temporal-Bf5PdJPv.mjs";
20
+ import { t as hasMalformedKnownTemporalLiteral } from "./temporal-D6Uf0KUy.mjs";
21
21
  import { t as createExponentialBackoffPolicy } from "./retry-Ddbq3AcK.mjs";
22
- import { n as extractInboxes, r as sendActivity, t as SendActivityError } from "./send-Bjw1BCUr.mjs";
22
+ import { n as extractInboxes, r as sendActivity, t as SendActivityError } from "./send-KK7FluNF.mjs";
23
23
  import { Activity, Collection, CollectionPage, CryptographicKey, Link, Multikey, Object as Object$1, OrderedCollection, OrderedCollectionPage, getTypeId, lookupObject, traverseCollection } from "@fedify/vocab";
24
24
  import { lookupWebFinger } from "@fedify/webfinger";
25
25
  import { SpanKind, SpanStatusCode, context, propagation, trace } from "@opentelemetry/api";