@fedify/fedify 2.0.29-dev.2020 → 2.0.29-dev.2053

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 (53) hide show
  1. package/dist/{builder-CdfC1FiD.mjs → builder-BTLcYj0_.mjs} +3 -3
  2. package/dist/{client-glFHmpn4.mjs → client-BUqbea1d.mjs} +7 -3
  3. package/dist/compat/transformers.test.mjs +1 -1
  4. package/dist/{deno-D8gbgI06.mjs → deno-CWMtQavg.mjs} +1 -1
  5. package/dist/{docloader-BhXRMeOT.mjs → docloader-DAXHbX7c.mjs} +7 -3
  6. package/dist/federation/builder.test.mjs +1 -1
  7. package/dist/federation/handler.test.mjs +6 -6
  8. package/dist/federation/idempotency.test.mjs +2 -2
  9. package/dist/federation/inbox.test.mjs +1 -1
  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-AR6Hm4TD.cjs → http-BUqkGHZz.cjs} +1 -1
  17. package/dist/{http-nDWq9XYM.mjs → http-BnZCLYUd.mjs} +2 -2
  18. package/dist/{http-BeRkPuuQ.js → http-XSP_-nIi.js} +1 -1
  19. package/dist/{inbox-BqfSgkhF.mjs → inbox-z69aECvs.mjs} +1 -1
  20. package/dist/{key-Cn0wq4Oq.mjs → key-CrMU2ace.mjs} +1 -1
  21. package/dist/{kv-cache-DgVuEms9.js → kv-cache-CyRY6JzF.js} +6 -2
  22. package/dist/{kv-cache-DIA3ogD1.cjs → kv-cache-DOHipf3f.cjs} +6 -2
  23. package/dist/{ld-0LoGSFsj.mjs → ld-DXFVMAsq.mjs} +2 -2
  24. package/dist/{middleware-BJBRUh2Q.js → middleware-B5jmtIqV.js} +4 -4
  25. package/dist/{middleware-DOFRJqVE.mjs → middleware-BCBUZaP0.mjs} +12 -12
  26. package/dist/{middleware-Bejghxy0.cjs → middleware-CLwaV51B.cjs} +5 -5
  27. package/dist/{middleware-S9dl7fzo.mjs → middleware-CVR9Igfp.mjs} +1 -1
  28. package/dist/{middleware-D29ullZM.cjs → middleware-OMyEqwmh.cjs} +1 -1
  29. package/dist/mod.cjs +5 -5
  30. package/dist/mod.js +5 -5
  31. package/dist/nodeinfo/client.test.mjs +49 -1
  32. package/dist/nodeinfo/handler.test.mjs +1 -1
  33. package/dist/nodeinfo/mod.cjs +1 -1
  34. package/dist/nodeinfo/mod.js +1 -1
  35. package/dist/{owner-DC4FuFMy.mjs → owner-p75anVL6.mjs} +2 -2
  36. package/dist/{proof-DWVvXo8o.mjs → proof-BWddaj0D.mjs} +2 -2
  37. package/dist/{proof-CX5Tem-q.js → proof-DZdycuDY.js} +1 -1
  38. package/dist/{proof-vCJtGeC3.cjs → proof-DiT4icST.cjs} +1 -1
  39. package/dist/{send-Dm4Ohwd8.mjs → send-D3EyWjfu.mjs} +2 -2
  40. package/dist/sig/http.test.mjs +2 -2
  41. package/dist/sig/key.test.mjs +1 -1
  42. package/dist/sig/ld.test.mjs +2 -2
  43. package/dist/sig/mod.cjs +2 -2
  44. package/dist/sig/mod.js +2 -2
  45. package/dist/sig/owner.test.mjs +1 -1
  46. package/dist/sig/proof.test.mjs +1 -1
  47. package/dist/{temporal-8kdmCaOQ.mjs → temporal-DMlXGRqq.mjs} +1 -1
  48. package/dist/{types-DWs-qZaY.cjs → types-DRPjmHVV.cjs} +7 -3
  49. package/dist/{types-sXITXcWa.js → types-miAYfiGO.js} +7 -3
  50. package/dist/utils/docloader.test.mjs +56 -2
  51. package/dist/utils/mod.cjs +1 -1
  52. package/dist/utils/mod.js +1 -1
  53. 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-D8gbgI06.mjs";
6
- import { t as InboxListenerSet } from "./inbox-BqfSgkhF.mjs";
5
+ import { n as version, t as name } from "./deno-CWMtQavg.mjs";
6
+ import { t as InboxListenerSet } from "./inbox-z69aECvs.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-S9dl7fzo.mjs");
45
+ const { FederationImpl } = await import("./middleware-CVR9Igfp.mjs");
46
46
  const f = new FederationImpl(options);
47
47
  const trailingSlashInsensitiveValue = f.router.trailingSlashInsensitive;
48
48
  f.router = this.router.clone();
@@ -93,8 +93,8 @@ const DEFAULT_MAX_REDIRECTION = 5;
93
93
  * bounce the request to an internal address.
94
94
  * @param url The URL to fetch.
95
95
  * @param headers The request headers.
96
- * @returns The final response, or `null` if the URL is disallowed or there
97
- * are too many redirects.
96
+ * @returns The final response, or `null` if the URL is disallowed, its
97
+ * hostname cannot be resolved, or there are too many redirects.
98
98
  */
99
99
  async function fetchPublicUrl(url, headers) {
100
100
  let current = url instanceof URL ? url : new URL(url);
@@ -104,7 +104,11 @@ async function fetchPublicUrl(url, headers) {
104
104
  await validatePublicUrl(current.href);
105
105
  } catch (e) {
106
106
  if (e instanceof UrlError) {
107
- logger.error("Refused to fetch a private or invalid URL {url}: {error}", {
107
+ if (e.reason === "dns") logger.error("DNS lookup failed for {url}: {error}", {
108
+ url: current.href,
109
+ error: e
110
+ });
111
+ else logger.error("Refused to fetch a private or invalid URL {url}: {error}", {
108
112
  url: current.href,
109
113
  error: e
110
114
  });
@@ -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-DOFRJqVE.mjs";
7
+ import { _ as autoIdAssigner, g as actorDehydrator, n as FederationImpl } from "../middleware-BCBUZaP0.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.29-dev.2020+b789935e";
6
+ var version = "2.0.29-dev.2053+58b638b4";
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-Cn0wq4Oq.mjs";
5
- import { n as doubleKnock } from "./http-nDWq9XYM.mjs";
4
+ import { o as validateCryptoKey } from "./key-CrMU2ace.mjs";
5
+ import { n as doubleKnock } from "./http-BnZCLYUd.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";
@@ -39,7 +39,11 @@ function getAuthenticatedDocumentLoader(identity, { allowPrivateAddress, userAge
39
39
  if (!allowPrivateAddress) try {
40
40
  await validatePublicUrl(url);
41
41
  } catch (error) {
42
- if (error instanceof UrlError) logger.error("Disallowed private URL: {url}", {
42
+ if (error instanceof UrlError) if (error.reason === "dns") logger.debug("DNS lookup failed for {url}", {
43
+ url,
44
+ error
45
+ });
46
+ else logger.error("Disallowed private URL: {url}", {
43
47
  url,
44
48
  error
45
49
  });
@@ -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-mI4Ix2EU.mjs";
8
- import { n as createFederationBuilder } from "../builder-CdfC1FiD.mjs";
8
+ import { n as createFederationBuilder } from "../builder-BTLcYj0_.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-Duiq_YC9.mjs";
7
7
  import { t as assertRejects } from "../assert_rejects-B-qJtC9Z.mjs";
8
8
  import { t as assert } from "../assert-BhQd8QHP.mjs";
9
- import { i as generateCryptoKeyPair } from "../key-Cn0wq4Oq.mjs";
10
- import { s as signRequest } from "../http-nDWq9XYM.mjs";
9
+ import { i as generateCryptoKeyPair } from "../key-CrMU2ace.mjs";
10
+ import { s as signRequest } from "../http-BnZCLYUd.mjs";
11
11
  import { a as rsaPrivateKey3, c as rsaPublicKey3, s as rsaPublicKey2 } from "../keys-CCxRJhWa.mjs";
12
- import { a as compactJsonLd, f as signJsonLd } from "../ld-0LoGSFsj.mjs";
13
- import { n as signObject } from "../proof-DWVvXo8o.mjs";
12
+ import { a as compactJsonLd, f as signJsonLd } from "../ld-DXFVMAsq.mjs";
13
+ import { n as signObject } from "../proof-BWddaj0D.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-DOFRJqVE.mjs";
16
- import { t as InboxListenerSet } from "../inbox-BqfSgkhF.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-BCBUZaP0.mjs";
16
+ import { t as InboxListenerSet } from "../inbox-z69aECvs.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-Duiq_YC9.mjs";
6
6
  import { n as ed25519PrivateKey, r as ed25519PublicKey, t as ed25519Multikey } from "../keys-CCxRJhWa.mjs";
7
- import { n as signObject } from "../proof-DWVvXo8o.mjs";
7
+ import { n as signObject } from "../proof-BWddaj0D.mjs";
8
8
  import { t as MemoryKvStore } from "../kv-mI4Ix2EU.mjs";
9
- import { a as createFederation } from "../middleware-DOFRJqVE.mjs";
9
+ import { a as createFederation } from "../middleware-BCBUZaP0.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-BqfSgkhF.mjs";
6
+ import { t as InboxListenerSet } from "../inbox-z69aECvs.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
@@ -9,14 +9,14 @@ import { n as assertFalse, t as assertRejects } from "../assert_rejects-B-qJtC9Z
9
9
  import { n as assertInstanceOf, t as assert } from "../assert-BhQd8QHP.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
- import { l as verifyRequest, s as signRequest } from "../http-nDWq9XYM.mjs";
12
+ import { l as verifyRequest, s as signRequest } from "../http-BnZCLYUd.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-BhXRMeOT.mjs";
15
- import { a as compactJsonLd, f as signJsonLd, m as verifyJsonLd, s as detachSignature } from "../ld-0LoGSFsj.mjs";
16
- import { t as doesActorOwnKey } from "../owner-DC4FuFMy.mjs";
17
- import { n as signObject, r as verifyObject } from "../proof-DWVvXo8o.mjs";
14
+ import { t as getAuthenticatedDocumentLoader } from "../docloader-DAXHbX7c.mjs";
15
+ import { a as compactJsonLd, f as signJsonLd, m as verifyJsonLd, s as detachSignature } from "../ld-DXFVMAsq.mjs";
16
+ import { t as doesActorOwnKey } from "../owner-p75anVL6.mjs";
17
+ import { n as signObject, r as verifyObject } from "../proof-BWddaj0D.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-DOFRJqVE.mjs";
19
+ import { a as createFederation, i as KvSpecDeterminer, n as FederationImpl, r as InboxContextImpl, t as ContextImpl } from "../middleware-BCBUZaP0.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-Bejghxy0.cjs");
5
+ const require_middleware = require("../middleware-CLwaV51B.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-BJBRUh2Q.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-B5jmtIqV.js";
4
4
  import { isEqual } from "es-toolkit";
5
5
  //#region src/federation/kv.ts
6
6
  /**
@@ -7,10 +7,10 @@ import "../std__assert-Duiq_YC9.mjs";
7
7
  import { n as assertFalse, t as assertRejects } from "../assert_rejects-B-qJtC9Z.mjs";
8
8
  import { n as assertInstanceOf, t as assert } from "../assert-BhQd8QHP.mjs";
9
9
  import { t as assertNotEquals } from "../assert_not_equals--wG9hV7u.mjs";
10
- import { l as verifyRequest } from "../http-nDWq9XYM.mjs";
10
+ import { l as verifyRequest } from "../http-BnZCLYUd.mjs";
11
11
  import { i as rsaPrivateKey2, n as ed25519PrivateKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-CCxRJhWa.mjs";
12
- import { t as doesActorOwnKey } from "../owner-DC4FuFMy.mjs";
13
- import { n as extractInboxes, r as sendActivity, t as SendActivityError } from "../send-Dm4Ohwd8.mjs";
12
+ import { t as doesActorOwnKey } from "../owner-p75anVL6.mjs";
13
+ import { n as extractInboxes, r as sendActivity, t as SendActivityError } from "../send-D3EyWjfu.mjs";
14
14
  import { createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
15
15
  import { Activity, Application, Endpoints, Group, Person, Service } from "@fedify/vocab";
16
16
  import { FetchError, UrlError } from "@fedify/vocab-runtime";
@@ -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-BhQd8QHP.mjs";
7
- import { t as hasMalformedKnownTemporalLiteral } from "../temporal-8kdmCaOQ.mjs";
7
+ import { t as hasMalformedKnownTemporalLiteral } from "../temporal-DMlXGRqq.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-mI4Ix2EU.mjs";
8
- import { a as createFederation, o as handleWebFinger } from "../middleware-DOFRJqVE.mjs";
8
+ import { a as createFederation, o as handleWebFinger } from "../middleware-BCBUZaP0.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.29-dev.2020+b789935e";
14
+ var version = "2.0.29-dev.2053+58b638b4";
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-D8gbgI06.mjs";
5
- import { o as validateCryptoKey, r as fetchKey } from "./key-Cn0wq4Oq.mjs";
4
+ import { n as version, t as name } from "./deno-CWMtQavg.mjs";
5
+ import { o as validateCryptoKey, r as fetchKey } from "./key-CrMU2ace.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.29-dev.2020+b789935e";
13
+ var version = "2.0.29-dev.2053+58b638b4";
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-D8gbgI06.mjs";
4
+ import { n as version, t as name } from "./deno-CWMtQavg.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-D8gbgI06.mjs";
4
+ import { n as version, t as name } from "./deno-CWMtQavg.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,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-BeRkPuuQ.js";
3
+ import { l as validateCryptoKey, t as doubleKnock } from "./http-XSP_-nIi.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";
@@ -37,7 +37,11 @@ function getAuthenticatedDocumentLoader(identity, { allowPrivateAddress, userAge
37
37
  if (!allowPrivateAddress) try {
38
38
  await validatePublicUrl(url);
39
39
  } catch (error) {
40
- if (error instanceof UrlError) logger$1.error("Disallowed private URL: {url}", {
40
+ if (error instanceof UrlError) if (error.reason === "dns") logger$1.debug("DNS lookup failed for {url}", {
41
+ url,
42
+ error
43
+ });
44
+ else logger$1.error("Disallowed private URL: {url}", {
41
45
  url,
42
46
  error
43
47
  });
@@ -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-AR6Hm4TD.cjs");
4
+ const require_http = require("./http-BUqkGHZz.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");
@@ -38,7 +38,11 @@ function getAuthenticatedDocumentLoader(identity, { allowPrivateAddress, userAge
38
38
  if (!allowPrivateAddress) try {
39
39
  await (0, _fedify_vocab_runtime.validatePublicUrl)(url);
40
40
  } catch (error) {
41
- if (error instanceof _fedify_vocab_runtime.UrlError) logger$1.error("Disallowed private URL: {url}", {
41
+ if (error instanceof _fedify_vocab_runtime.UrlError) if (error.reason === "dns") logger$1.debug("DNS lookup failed for {url}", {
42
+ url,
43
+ error
44
+ });
45
+ else logger$1.error("Disallowed private URL: {url}", {
42
46
  url,
43
47
  error
44
48
  });
@@ -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-D8gbgI06.mjs";
5
- import { o as validateCryptoKey, r as fetchKey } from "./key-Cn0wq4Oq.mjs";
4
+ import { n as version, t as name } from "./deno-CWMtQavg.mjs";
5
+ import { o as validateCryptoKey, r as fetchKey } from "./key-CrMU2ace.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";
@@ -2,10 +2,10 @@ import { Temporal } from "@js-temporal/polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
3
  import { t as __exportAll } from "./chunk-CRNNMoPX.js";
4
4
  import { r as getDefaultActivityTransformers } from "./transformers-BGMIq1cs.js";
5
- import { c as importJwk, d as name, f as version, i as exportJwk, l as validateCryptoKey, r as verifyRequest, t as doubleKnock } from "./http-BeRkPuuQ.js";
6
- import { a as MAX_BODY_SIZE, i as BodyTooLargeError, n as getNodeInfo, o as readBoundedText, t as nodeInfoToJson } from "./types-sXITXcWa.js";
7
- import { _ as signJsonLd, a as doesActorOwnKey, c as assertSafeJsonLd, f as detachSignature, g as isInvalidUrlTypeError, h as isClearlyMalformedContextReference, m as hasSignature, n as signObject, o as getKeyOwner, p as getNormalizationContextLoader, r as verifyObject, s as InvalidContextReferenceError, u as compactJsonLd, v as verifyCompactJsonLd, x as wrapContextLoaderForJsonLd } from "./proof-CX5Tem-q.js";
8
- import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-DgVuEms9.js";
5
+ import { c as importJwk, d as name, f as version, i as exportJwk, l as validateCryptoKey, r as verifyRequest, t as doubleKnock } from "./http-XSP_-nIi.js";
6
+ import { a as MAX_BODY_SIZE, i as BodyTooLargeError, n as getNodeInfo, o as readBoundedText, t as nodeInfoToJson } from "./types-miAYfiGO.js";
7
+ import { _ as signJsonLd, a as doesActorOwnKey, c as assertSafeJsonLd, f as detachSignature, g as isInvalidUrlTypeError, h as isClearlyMalformedContextReference, m as hasSignature, n as signObject, o as getKeyOwner, p as getNormalizationContextLoader, r as verifyObject, s as InvalidContextReferenceError, u as compactJsonLd, v as verifyCompactJsonLd, x as wrapContextLoaderForJsonLd } from "./proof-DZdycuDY.js";
8
+ import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-CyRY6JzF.js";
9
9
  import { getLogger, withContext } from "@logtape/logtape";
10
10
  import { Activity, Collection, CollectionPage, CryptographicKey, Link, Multikey, Object as Object$1, OrderedCollection, OrderedCollectionPage, getTypeId, lookupObject, traverseCollection } from "@fedify/vocab";
11
11
  import { SpanKind, SpanStatusCode, context, propagation, trace } from "@opentelemetry/api";
@@ -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-D8gbgI06.mjs";
6
- import { a as importJwk, o as validateCryptoKey, t as exportJwk } from "./key-Cn0wq4Oq.mjs";
7
- import { l as verifyRequest } from "./http-nDWq9XYM.mjs";
8
- import { t as getAuthenticatedDocumentLoader } from "./docloader-BhXRMeOT.mjs";
5
+ import { n as version, t as name } from "./deno-CWMtQavg.mjs";
6
+ import { a as importJwk, o as validateCryptoKey, t as exportJwk } from "./key-CrMU2ace.mjs";
7
+ import { l as verifyRequest } from "./http-BnZCLYUd.mjs";
8
+ import { t as getAuthenticatedDocumentLoader } from "./docloader-DAXHbX7c.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-0LoGSFsj.mjs";
11
- import { n as getKeyOwner, t as doesActorOwnKey } from "./owner-DC4FuFMy.mjs";
12
- import { n as signObject, r as verifyObject } from "./proof-DWVvXo8o.mjs";
13
- import { d as readBoundedText, l as BodyTooLargeError, t as getNodeInfo, u as MAX_BODY_SIZE } from "./client-glFHmpn4.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-DXFVMAsq.mjs";
11
+ import { n as getKeyOwner, t as doesActorOwnKey } from "./owner-p75anVL6.mjs";
12
+ import { n as signObject, r as verifyObject } from "./proof-BWddaj0D.mjs";
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 routeActivity } from "./inbox-BqfSgkhF.mjs";
16
- import { t as FederationBuilderImpl } from "./builder-CdfC1FiD.mjs";
15
+ import { n as routeActivity } from "./inbox-z69aECvs.mjs";
16
+ import { t as FederationBuilderImpl } from "./builder-BTLcYj0_.mjs";
17
17
  import { t as buildCollectionSynchronizationHeader } from "./collection-DI6YzYpd.mjs";
18
18
  import { t as KvKeyCache } from "./keycache-D239uGT9.mjs";
19
19
  import { t as acceptsJsonLd } from "./negotiation-TWEs6Cl8.mjs";
20
- import { t as hasMalformedKnownTemporalLiteral } from "./temporal-8kdmCaOQ.mjs";
20
+ import { t as hasMalformedKnownTemporalLiteral } from "./temporal-DMlXGRqq.mjs";
21
21
  import { t as createExponentialBackoffPolicy } from "./retry-Ddbq3AcK.mjs";
22
- import { n as extractInboxes, r as sendActivity, t as SendActivityError } from "./send-Dm4Ohwd8.mjs";
22
+ import { n as extractInboxes, r as sendActivity, t as SendActivityError } from "./send-D3EyWjfu.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";
@@ -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-AR6Hm4TD.cjs");
6
- const require_types = require("./types-DWs-qZaY.cjs");
7
- const require_proof = require("./proof-vCJtGeC3.cjs");
8
- const require_kv_cache = require("./kv-cache-DIA3ogD1.cjs");
5
+ const require_http = require("./http-BUqkGHZz.cjs");
6
+ const require_types = require("./types-DRPjmHVV.cjs");
7
+ const require_proof = require("./proof-DiT4icST.cjs");
8
+ const require_kv_cache = require("./kv-cache-DOHipf3f.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");
@@ -335,7 +335,7 @@ var FederationBuilderImpl = class {
335
335
  this.collectionTypeIds = {};
336
336
  }
337
337
  async build(options) {
338
- const { FederationImpl } = await Promise.resolve().then(() => require("./middleware-D29ullZM.cjs"));
338
+ const { FederationImpl } = await Promise.resolve().then(() => require("./middleware-OMyEqwmh.cjs"));
339
339
  const f = new FederationImpl(options);
340
340
  const trailingSlashInsensitiveValue = f.router.trailingSlashInsensitive;
341
341
  f.router = this.router.clone();
@@ -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-DOFRJqVE.mjs";
4
+ import { n as FederationImpl } from "./middleware-BCBUZaP0.mjs";
5
5
  export { FederationImpl };
@@ -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-Bejghxy0.cjs");
3
+ const require_middleware = require("./middleware-CLwaV51B.cjs");
4
4
  exports.FederationImpl = require_middleware.FederationImpl;
package/dist/mod.cjs CHANGED
@@ -4,11 +4,11 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
4
  require("./chunk-DDcVe30Y.cjs");
5
5
  const require_transformers = require("./transformers-NeAONrAq.cjs");
6
6
  require("./compat/mod.cjs");
7
- const require_http = require("./http-AR6Hm4TD.cjs");
8
- const require_middleware = require("./middleware-Bejghxy0.cjs");
9
- const require_types = require("./types-DWs-qZaY.cjs");
10
- const require_proof = require("./proof-vCJtGeC3.cjs");
11
- const require_kv_cache = require("./kv-cache-DIA3ogD1.cjs");
7
+ const require_http = require("./http-BUqkGHZz.cjs");
8
+ const require_middleware = require("./middleware-CLwaV51B.cjs");
9
+ const require_types = require("./types-DRPjmHVV.cjs");
10
+ const require_proof = require("./proof-DiT4icST.cjs");
11
+ const require_kv_cache = require("./kv-cache-DOHipf3f.cjs");
12
12
  const require_federation_mod = require("./federation/mod.cjs");
13
13
  require("./nodeinfo/mod.cjs");
14
14
  require("./runtime/mod.cjs");
package/dist/mod.js CHANGED
@@ -3,11 +3,11 @@ import { URLPattern } from "urlpattern-polyfill";
3
3
  import "./chunk-CRNNMoPX.js";
4
4
  import { n as autoIdAssigner, r as getDefaultActivityTransformers, t as actorDehydrator } from "./transformers-BGMIq1cs.js";
5
5
  import "./compat/mod.js";
6
- import { c as importJwk, i as exportJwk, n as signRequest, o as fetchKey, r as verifyRequest, s as generateCryptoKeyPair } from "./http-BeRkPuuQ.js";
7
- 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-BJBRUh2Q.js";
8
- import { n as getNodeInfo, r as parseNodeInfo, t as nodeInfoToJson } from "./types-sXITXcWa.js";
9
- import { _ as signJsonLd, a as doesActorOwnKey, b as verifySignature, d as createSignature, f as detachSignature, i as verifyProof, l as attachSignature, n as signObject, o as getKeyOwner, r as verifyObject, t as createProof, y as verifyJsonLd } from "./proof-CX5Tem-q.js";
10
- import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-DgVuEms9.js";
6
+ import { c as importJwk, i as exportJwk, n as signRequest, o as fetchKey, r as verifyRequest, s as generateCryptoKeyPair } from "./http-XSP_-nIi.js";
7
+ 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-B5jmtIqV.js";
8
+ import { n as getNodeInfo, r as parseNodeInfo, t as nodeInfoToJson } from "./types-miAYfiGO.js";
9
+ import { _ as signJsonLd, a as doesActorOwnKey, b as verifySignature, d as createSignature, f as detachSignature, i as verifyProof, l as attachSignature, n as signObject, o as getKeyOwner, r as verifyObject, t as createProof, y as verifyJsonLd } from "./proof-DZdycuDY.js";
10
+ import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-CyRY6JzF.js";
11
11
  import { InProcessMessageQueue, MemoryKvStore, ParallelMessageQueue } from "./federation/mod.js";
12
12
  import "./nodeinfo/mod.js";
13
13
  import "./runtime/mod.js";
@@ -4,8 +4,12 @@ globalThis.addEventListener = () => {};
4
4
  import { t as esm_default } from "../esm-DVILvP5e.mjs";
5
5
  import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
6
6
  import "../std__assert-Duiq_YC9.mjs";
7
- import { a as parseProtocol, c as parseUsage, i as parseOutboundService, n as parseInboundService, o as parseServices, r as parseNodeInfo, s as parseSoftware, t as getNodeInfo } from "../client-glFHmpn4.mjs";
7
+ import { n as assertInstanceOf } from "../assert-BhQd8QHP.mjs";
8
+ import { a as parseProtocol, c as parseUsage, i as parseOutboundService, n as parseInboundService, o as parseServices, r as parseNodeInfo, s as parseSoftware, t as getNodeInfo } from "../client-BUqbea1d.mjs";
8
9
  import { test } from "@fedify/fixture";
10
+ import { UrlError } from "@fedify/vocab-runtime";
11
+ import { configure, reset } from "@logtape/logtape";
12
+ import dns from "node:dns/promises";
9
13
  //#region src/nodeinfo/client.test.ts
10
14
  test("getNodeInfo()", async (t) => {
11
15
  esm_default.spyGlobal();
@@ -994,5 +998,49 @@ test("getNodeInfo() bounds both discovery and document responses", async () => {
994
998
  esm_default.hardReset();
995
999
  }
996
1000
  });
1001
+ test("getNodeInfo() logs DNS failures as such", { ignore: "Deno" in globalThis && (await Deno.permissions.query({ name: "net" })).state !== "granted" }, async (t) => {
1002
+ for (const result of [
1003
+ "throws",
1004
+ "empty",
1005
+ "private"
1006
+ ]) await t.step(result, async () => {
1007
+ const originalLookup = dns.lookup;
1008
+ dns.lookup = (() => result === "throws" ? Promise.reject(/* @__PURE__ */ new Error("Resolver unavailable")) : Promise.resolve(result === "empty" ? [] : [{
1009
+ address: "127.0.0.1",
1010
+ family: 4
1011
+ }]));
1012
+ const records = [];
1013
+ await configure({
1014
+ sinks: { buffer: (record) => records.push(record) },
1015
+ loggers: [{
1016
+ category: "fedify",
1017
+ sinks: ["buffer"],
1018
+ lowestLevel: "debug"
1019
+ }, {
1020
+ category: ["logtape", "meta"],
1021
+ sinks: []
1022
+ }],
1023
+ reset: true
1024
+ });
1025
+ try {
1026
+ assertEquals(await getNodeInfo("https://dns-failure.invalid/"), void 0);
1027
+ assertEquals(records.map((r) => [
1028
+ r.level,
1029
+ r.rawMessage,
1030
+ r.properties.url
1031
+ ]), [[
1032
+ "error",
1033
+ result === "private" ? "Refused to fetch a private or invalid URL {url}: {error}" : "DNS lookup failed for {url}: {error}",
1034
+ "https://dns-failure.invalid/.well-known/nodeinfo"
1035
+ ]]);
1036
+ const { error } = records[0].properties;
1037
+ assertInstanceOf(error, UrlError);
1038
+ assertEquals(error.reason, result === "private" ? "disallowed" : "dns");
1039
+ } finally {
1040
+ await reset();
1041
+ dns.lookup = originalLookup;
1042
+ }
1043
+ });
1044
+ });
997
1045
  //#endregion
998
1046
  export {};
@@ -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-mI4Ix2EU.mjs";
8
- import { a as createFederation, h as handleNodeInfoJrd, m as handleNodeInfo } from "../middleware-DOFRJqVE.mjs";
8
+ import { a as createFederation, h as handleNodeInfoJrd, m as handleNodeInfo } from "../middleware-BCBUZaP0.mjs";
9
9
  import { test } from "@fedify/fixture";
10
10
  //#region src/nodeinfo/handler.test.ts
11
11
  test("handleNodeInfo()", async () => {
@@ -1,7 +1,7 @@
1
1
  const { Temporal } = require("@js-temporal/polyfill");
2
2
  const { URLPattern } = require("urlpattern-polyfill");
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
- const require_types = require("../types-DWs-qZaY.cjs");
4
+ const require_types = require("../types-DRPjmHVV.cjs");
5
5
  exports.getNodeInfo = require_types.getNodeInfo;
6
6
  exports.nodeInfoToJson = require_types.nodeInfoToJson;
7
7
  exports.parseNodeInfo = require_types.parseNodeInfo;
@@ -1,4 +1,4 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
- import { n as getNodeInfo, r as parseNodeInfo, t as nodeInfoToJson } from "../types-sXITXcWa.js";
3
+ import { n as getNodeInfo, r as parseNodeInfo, t as nodeInfoToJson } from "../types-miAYfiGO.js";
4
4
  export { getNodeInfo, nodeInfoToJson, parseNodeInfo };
@@ -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-D8gbgI06.mjs";
5
- import { n as fetchActorDocument, s as verifyKeyOwnership, t as exportJwk } from "./key-Cn0wq4Oq.mjs";
4
+ import { n as version, t as name } from "./deno-CWMtQavg.mjs";
5
+ import { n as fetchActorDocument, s as verifyKeyOwnership, t as exportJwk } from "./key-CrMU2ace.mjs";
6
6
  import { CryptographicKey, Object as Object$1, isActor } from "@fedify/vocab";
7
7
  import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
8
8
  import { getDocumentLoader } from "@fedify/vocab-runtime";
@@ -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-D8gbgI06.mjs";
5
- import { o as validateCryptoKey, r as fetchKey } from "./key-Cn0wq4Oq.mjs";
4
+ import { n as version, t as name } from "./deno-CWMtQavg.mjs";
5
+ import { o as validateCryptoKey, r as fetchKey } from "./key-CrMU2ace.mjs";
6
6
  import { Activity, DataIntegrityProof, Multikey, getTypeId } from "@fedify/vocab";
7
7
  import { SpanStatusCode, trace } from "@opentelemetry/api";
8
8
  import { getLogger } from "@logtape/logtape";
@@ -1,6 +1,6 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
- import { a as fetchActorDocument, d as name, f as version, i as exportJwk, l as validateCryptoKey, o as fetchKey, u as verifyKeyOwnership } from "./http-BeRkPuuQ.js";
3
+ import { a as fetchActorDocument, d as name, f as version, i as exportJwk, l as validateCryptoKey, o as fetchKey, u as verifyKeyOwnership } from "./http-XSP_-nIi.js";
4
4
  import { getLogger } from "@logtape/logtape";
5
5
  import { Activity, CryptographicKey, DataIntegrityProof, Multikey, Object as Object$1, getTypeId, isActor } from "@fedify/vocab";
6
6
  import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
@@ -1,7 +1,7 @@
1
1
  const { Temporal } = require("@js-temporal/polyfill");
2
2
  const { URLPattern } = require("urlpattern-polyfill");
3
3
  const require_chunk = require("./chunk-DDcVe30Y.cjs");
4
- const require_http = require("./http-AR6Hm4TD.cjs");
4
+ const require_http = require("./http-BUqkGHZz.cjs");
5
5
  let _logtape_logtape = require("@logtape/logtape");
6
6
  let _fedify_vocab = require("@fedify/vocab");
7
7
  let _opentelemetry_api = require("@opentelemetry/api");
@@ -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-D8gbgI06.mjs";
5
- import { n as doubleKnock } from "./http-nDWq9XYM.mjs";
4
+ import { n as version, t as name } from "./deno-CWMtQavg.mjs";
5
+ import { n as doubleKnock } from "./http-BnZCLYUd.mjs";
6
6
  import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
7
7
  import { FetchError, UrlError, validatePublicUrl } from "@fedify/vocab-runtime";
8
8
  import { getLogger } from "@logtape/logtape";
@@ -7,8 +7,8 @@ import { a as assertExists, t as assertStringIncludes } from "../std__assert-Dui
7
7
  import { n as assertFalse, t as assertRejects } from "../assert_rejects-B-qJtC9Z.mjs";
8
8
  import { t as assert } from "../assert-BhQd8QHP.mjs";
9
9
  import { t as assertThrows } from "../assert_throws-4NwKEy2q.mjs";
10
- import { t as exportJwk } from "../key-Cn0wq4Oq.mjs";
11
- import { a as parseRfc9421Signature, c as timingSafeEqual, i as formatRfc9421SignatureParameters, l as verifyRequest, n as doubleKnock, o as parseRfc9421SignatureInput, r as formatRfc9421Signature, s as signRequest, t as createRfc9421SignatureBase } from "../http-nDWq9XYM.mjs";
10
+ import { t as exportJwk } from "../key-CrMU2ace.mjs";
11
+ import { a as parseRfc9421Signature, c as timingSafeEqual, i as formatRfc9421SignatureParameters, l as verifyRequest, n as doubleKnock, o as parseRfc9421SignatureInput, r as formatRfc9421Signature, s as signRequest, t as createRfc9421SignatureBase } from "../http-BnZCLYUd.mjs";
12
12
  import { i as rsaPrivateKey2, l as rsaPublicKey5, o as rsaPublicKey1, s as rsaPublicKey2 } from "../keys-CCxRJhWa.mjs";
13
13
  import { mockDocumentLoader, test } from "@fedify/fixture";
14
14
  import { FetchError, exportSpki } from "@fedify/vocab-runtime";
@@ -6,7 +6,7 @@ import "../std__assert-Duiq_YC9.mjs";
6
6
  import { t as assertRejects } from "../assert_rejects-B-qJtC9Z.mjs";
7
7
  import { t as assert } from "../assert-BhQd8QHP.mjs";
8
8
  import { t as assertThrows } from "../assert_throws-4NwKEy2q.mjs";
9
- import { a as importJwk, i as generateCryptoKeyPair, o as validateCryptoKey, r as fetchKey, t as exportJwk } from "../key-Cn0wq4Oq.mjs";
9
+ import { a as importJwk, i as generateCryptoKeyPair, o as validateCryptoKey, r as fetchKey, t as exportJwk } from "../key-CrMU2ace.mjs";
10
10
  import { c as rsaPublicKey3, i as rsaPrivateKey2, o as rsaPublicKey1, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-CCxRJhWa.mjs";
11
11
  import { mockDocumentLoader, test } from "@fedify/fixture";
12
12
  import { CryptographicKey, Multikey } from "@fedify/vocab";
@@ -5,9 +5,9 @@ import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
5
5
  import { n as assertFalse, t as assertRejects } from "../assert_rejects-B-qJtC9Z.mjs";
6
6
  import { n as assertInstanceOf, t as assert } from "../assert-BhQd8QHP.mjs";
7
7
  import { t as assertThrows } from "../assert_throws-4NwKEy2q.mjs";
8
- import { i as generateCryptoKeyPair } from "../key-Cn0wq4Oq.mjs";
8
+ import { i as generateCryptoKeyPair } from "../key-CrMU2ace.mjs";
9
9
  import { a as rsaPrivateKey3, c as rsaPublicKey3, i as rsaPrivateKey2, n as ed25519PrivateKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-CCxRJhWa.mjs";
10
- import { a as compactJsonLd, d as isInvalidUrlTypeError, f as signJsonLd, h as verifySignature, i as attachSignature, m as verifyJsonLd, n as UnsafeJsonLdError, o as createSignature, s as detachSignature } from "../ld-0LoGSFsj.mjs";
10
+ import { a as compactJsonLd, d as isInvalidUrlTypeError, f as signJsonLd, h as verifySignature, i as attachSignature, m as verifyJsonLd, n as UnsafeJsonLdError, o as createSignature, s as detachSignature } from "../ld-DXFVMAsq.mjs";
11
11
  import { mockDocumentLoader, test } from "@fedify/fixture";
12
12
  import { CryptographicKey } from "@fedify/vocab";
13
13
  import { encodeBase64 } from "byte-encodings/base64";
package/dist/sig/mod.cjs CHANGED
@@ -1,8 +1,8 @@
1
1
  const { Temporal } = require("@js-temporal/polyfill");
2
2
  const { URLPattern } = require("urlpattern-polyfill");
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
- const require_http = require("../http-AR6Hm4TD.cjs");
5
- const require_proof = require("../proof-vCJtGeC3.cjs");
4
+ const require_http = require("../http-BUqkGHZz.cjs");
5
+ const require_proof = require("../proof-DiT4icST.cjs");
6
6
  exports.attachSignature = require_proof.attachSignature;
7
7
  exports.createProof = require_proof.createProof;
8
8
  exports.createSignature = require_proof.createSignature;
package/dist/sig/mod.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
- import { c as importJwk, i as exportJwk, n as signRequest, o as fetchKey, r as verifyRequest, s as generateCryptoKeyPair } from "../http-BeRkPuuQ.js";
4
- import { _ as signJsonLd, a as doesActorOwnKey, b as verifySignature, d as createSignature, f as detachSignature, i as verifyProof, l as attachSignature, n as signObject, o as getKeyOwner, r as verifyObject, t as createProof, y as verifyJsonLd } from "../proof-CX5Tem-q.js";
3
+ import { c as importJwk, i as exportJwk, n as signRequest, o as fetchKey, r as verifyRequest, s as generateCryptoKeyPair } from "../http-XSP_-nIi.js";
4
+ import { _ as signJsonLd, a as doesActorOwnKey, b as verifySignature, d as createSignature, f as detachSignature, i as verifyProof, l as attachSignature, n as signObject, o as getKeyOwner, r as verifyObject, t as createProof, y as verifyJsonLd } from "../proof-DZdycuDY.js";
5
5
  export { attachSignature, createProof, createSignature, detachSignature, doesActorOwnKey, exportJwk, fetchKey, generateCryptoKeyPair, getKeyOwner, importJwk, signJsonLd, signObject, signRequest, verifyJsonLd, verifyObject, verifyProof, verifyRequest, verifySignature };
@@ -6,7 +6,7 @@ import "../std__assert-Duiq_YC9.mjs";
6
6
  import { n as assertFalse } from "../assert_rejects-B-qJtC9Z.mjs";
7
7
  import { t as assert } from "../assert-BhQd8QHP.mjs";
8
8
  import { o as rsaPublicKey1, s as rsaPublicKey2 } from "../keys-CCxRJhWa.mjs";
9
- import { n as getKeyOwner, t as doesActorOwnKey } from "../owner-DC4FuFMy.mjs";
9
+ import { n as getKeyOwner, t as doesActorOwnKey } from "../owner-p75anVL6.mjs";
10
10
  import { createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
11
11
  import { Create, CryptographicKey, lookupObject } from "@fedify/vocab";
12
12
  //#region src/sig/owner.test.ts
@@ -6,7 +6,7 @@ import "../std__assert-Duiq_YC9.mjs";
6
6
  import { t as assertRejects } from "../assert_rejects-B-qJtC9Z.mjs";
7
7
  import { n as assertInstanceOf } from "../assert-BhQd8QHP.mjs";
8
8
  import { i as rsaPrivateKey2, n as ed25519PrivateKey, r as ed25519PublicKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-CCxRJhWa.mjs";
9
- import { i as verifyProof, n as signObject, r as verifyObject, t as createProof } from "../proof-DWVvXo8o.mjs";
9
+ import { i as verifyProof, n as signObject, r as verifyObject, t as createProof } from "../proof-BWddaj0D.mjs";
10
10
  import { mockDocumentLoader, test } from "@fedify/fixture";
11
11
  import { Create, DataIntegrityProof, Multikey, Note, Place } from "@fedify/vocab";
12
12
  import { decodeMultibase, importMultibaseKey } from "@fedify/vocab-runtime";
@@ -1,7 +1,7 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { c as getNormalizationContextLoader } from "./ld-0LoGSFsj.mjs";
4
+ import { c as getNormalizationContextLoader } from "./ld-DXFVMAsq.mjs";
5
5
  import jsonld from "@fedify/vocab-runtime/jsonld";
6
6
  //#region src/federation/temporal.ts
7
7
  function isPlainObject(value) {
@@ -93,8 +93,8 @@ const DEFAULT_MAX_REDIRECTION = 5;
93
93
  * bounce the request to an internal address.
94
94
  * @param url The URL to fetch.
95
95
  * @param headers The request headers.
96
- * @returns The final response, or `null` if the URL is disallowed or there
97
- * are too many redirects.
96
+ * @returns The final response, or `null` if the URL is disallowed, its
97
+ * hostname cannot be resolved, or there are too many redirects.
98
98
  */
99
99
  async function fetchPublicUrl(url, headers) {
100
100
  let current = url instanceof URL ? url : new URL(url);
@@ -104,7 +104,11 @@ async function fetchPublicUrl(url, headers) {
104
104
  await (0, _fedify_vocab_runtime.validatePublicUrl)(current.href);
105
105
  } catch (e) {
106
106
  if (e instanceof _fedify_vocab_runtime.UrlError) {
107
- logger.error("Refused to fetch a private or invalid URL {url}: {error}", {
107
+ if (e.reason === "dns") logger.error("DNS lookup failed for {url}: {error}", {
108
+ url: current.href,
109
+ error: e
110
+ });
111
+ else logger.error("Refused to fetch a private or invalid URL {url}: {error}", {
108
112
  url: current.href,
109
113
  error: e
110
114
  });
@@ -92,8 +92,8 @@ const DEFAULT_MAX_REDIRECTION = 5;
92
92
  * bounce the request to an internal address.
93
93
  * @param url The URL to fetch.
94
94
  * @param headers The request headers.
95
- * @returns The final response, or `null` if the URL is disallowed or there
96
- * are too many redirects.
95
+ * @returns The final response, or `null` if the URL is disallowed, its
96
+ * hostname cannot be resolved, or there are too many redirects.
97
97
  */
98
98
  async function fetchPublicUrl(url, headers) {
99
99
  let current = url instanceof URL ? url : new URL(url);
@@ -103,7 +103,11 @@ async function fetchPublicUrl(url, headers) {
103
103
  await validatePublicUrl(current.href);
104
104
  } catch (e) {
105
105
  if (e instanceof UrlError) {
106
- logger.error("Refused to fetch a private or invalid URL {url}: {error}", {
106
+ if (e.reason === "dns") logger.error("DNS lookup failed for {url}: {error}", {
107
+ url: current.href,
108
+ error: e
109
+ });
110
+ else logger.error("Refused to fetch a private or invalid URL {url}: {error}", {
107
111
  url: current.href,
108
112
  error: e
109
113
  });
@@ -5,11 +5,13 @@ import { t as esm_default } from "../esm-DVILvP5e.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 assertRejects } from "../assert_rejects-B-qJtC9Z.mjs";
8
- import { l as verifyRequest } from "../http-nDWq9XYM.mjs";
8
+ import { l as verifyRequest } from "../http-BnZCLYUd.mjs";
9
9
  import { i as rsaPrivateKey2 } from "../keys-CCxRJhWa.mjs";
10
- import { t as getAuthenticatedDocumentLoader } from "../docloader-BhXRMeOT.mjs";
10
+ import { t as getAuthenticatedDocumentLoader } from "../docloader-DAXHbX7c.mjs";
11
11
  import { mockDocumentLoader, test } from "@fedify/fixture";
12
12
  import { FetchError, UrlError } from "@fedify/vocab-runtime";
13
+ import { configure, reset } from "@logtape/logtape";
14
+ import dns from "node:dns/promises";
13
15
  //#region src/utils/docloader.test.ts
14
16
  test("getAuthenticatedDocumentLoader()", async (t) => {
15
17
  esm_default.spyGlobal();
@@ -144,5 +146,57 @@ test("getAuthenticatedDocumentLoader() bounds JSON after redirects", async () =>
144
146
  esm_default.hardReset();
145
147
  }
146
148
  });
149
+ test("getAuthenticatedDocumentLoader() logs DNS failures as such", { ignore: "Deno" in globalThis && (await Deno.permissions.query({ name: "net" })).state !== "granted" }, async (t) => {
150
+ const loader = getAuthenticatedDocumentLoader({
151
+ keyId: new URL("https://example.com/key2"),
152
+ privateKey: rsaPrivateKey2
153
+ });
154
+ for (const result of [
155
+ "throws",
156
+ "empty",
157
+ "private"
158
+ ]) await t.step(result, async () => {
159
+ const originalLookup = dns.lookup;
160
+ dns.lookup = (() => result === "throws" ? Promise.reject(/* @__PURE__ */ new Error("Resolver unavailable")) : Promise.resolve(result === "empty" ? [] : [{
161
+ address: "127.0.0.1",
162
+ family: 4
163
+ }]));
164
+ const records = [];
165
+ await configure({
166
+ sinks: { buffer: (record) => records.push(record) },
167
+ loggers: [{
168
+ category: "fedify",
169
+ sinks: ["buffer"],
170
+ lowestLevel: "debug"
171
+ }, {
172
+ category: ["logtape", "meta"],
173
+ sinks: []
174
+ }],
175
+ reset: true
176
+ });
177
+ try {
178
+ const url = "https://dns-failure.invalid/object";
179
+ const error = await assertRejects(() => loader(url), UrlError);
180
+ assertEquals(error.reason, result === "private" ? "disallowed" : "dns");
181
+ assertEquals(records.map((r) => [
182
+ r.level,
183
+ r.rawMessage,
184
+ r.properties.url
185
+ ]), [result === "private" ? [
186
+ "error",
187
+ "Disallowed private URL: {url}",
188
+ url
189
+ ] : [
190
+ "debug",
191
+ "DNS lookup failed for {url}",
192
+ url
193
+ ]]);
194
+ assertEquals(records[0].properties.error, error);
195
+ } finally {
196
+ await reset();
197
+ dns.lookup = originalLookup;
198
+ }
199
+ });
200
+ });
147
201
  //#endregion
148
202
  export {};
@@ -1,6 +1,6 @@
1
1
  const { Temporal } = require("@js-temporal/polyfill");
2
2
  const { URLPattern } = require("urlpattern-polyfill");
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
- const require_kv_cache = require("../kv-cache-DIA3ogD1.cjs");
4
+ const require_kv_cache = require("../kv-cache-DOHipf3f.cjs");
5
5
  exports.getAuthenticatedDocumentLoader = require_kv_cache.getAuthenticatedDocumentLoader;
6
6
  exports.kvCache = require_kv_cache.kvCache;
package/dist/utils/mod.js CHANGED
@@ -1,4 +1,4 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
- import { n as getAuthenticatedDocumentLoader, t as kvCache } from "../kv-cache-DgVuEms9.js";
3
+ import { n as getAuthenticatedDocumentLoader, t as kvCache } from "../kv-cache-CyRY6JzF.js";
4
4
  export { getAuthenticatedDocumentLoader, kvCache };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fedify/fedify",
3
- "version": "2.0.29-dev.2020+b789935e",
3
+ "version": "2.0.29-dev.2053+58b638b4",
4
4
  "description": "An ActivityPub server framework",
5
5
  "keywords": [
6
6
  "ActivityPub",
@@ -144,9 +144,9 @@
144
144
  "uri-template-router": "^1.0.0",
145
145
  "url-template": "^3.1.1",
146
146
  "urlpattern-polyfill": "^10.1.0",
147
- "@fedify/vocab": "2.0.29-dev.2020+b789935e",
148
- "@fedify/webfinger": "2.0.29-dev.2020+b789935e",
149
- "@fedify/vocab-runtime": "2.0.29-dev.2020+b789935e"
147
+ "@fedify/vocab": "2.0.29-dev.2053+58b638b4",
148
+ "@fedify/vocab-runtime": "2.0.29-dev.2053+58b638b4",
149
+ "@fedify/webfinger": "2.0.29-dev.2053+58b638b4"
150
150
  },
151
151
  "devDependencies": {
152
152
  "@std/assert": "npm:@jsr/std__assert@^0.226.0",
@@ -159,7 +159,7 @@
159
159
  "typescript": "^6.0.0",
160
160
  "wrangler": "^4.17.0",
161
161
  "@fedify/fixture": "2.0.0",
162
- "@fedify/vocab-tools": "^2.0.29-dev.2020+b789935e"
162
+ "@fedify/vocab-tools": "^2.0.29-dev.2053+58b638b4"
163
163
  },
164
164
  "scripts": {
165
165
  "build:self": "tsdown",