@fedify/vocab 2.1.30 → 2.1.31

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.
@@ -1,7 +1,7 @@
1
1
  import "@js-temporal/polyfill";
2
2
  globalThis.addEventListener = () => {};
3
- import { T as __exportAll, _ as Person, g as Organization, i as Application, u as Group, x as Service } from "./vocab-BdFWN1ns.mjs";
4
- import { n as version, r as esm_default, t as name } from "./deno-C-AmqlF6.mjs";
3
+ import { T as __exportAll, _ as Person, g as Organization, i as Application, u as Group, x as Service } from "./vocab-De7fFc2M.mjs";
4
+ import { n as version, r as esm_default, t as name } from "./deno-B6BABxfi.mjs";
5
5
  import { t as getTypeId } from "./type-Cf-vxmre.mjs";
6
6
  import { test } from "@fedify/fixture";
7
7
  import { deepStrictEqual, ok, rejects, strictEqual, throws } from "node:assert/strict";
@@ -1,6 +1,6 @@
1
1
  import "@js-temporal/polyfill";
2
2
  globalThis.addEventListener = () => {};
3
- import { E as __toESM, w as __commonJSMin } from "./vocab-BdFWN1ns.mjs";
3
+ import { E as __toESM, w as __commonJSMin } from "./vocab-De7fFc2M.mjs";
4
4
  //#region ../../node_modules/.pnpm/glob-to-regexp@0.4.1/node_modules/glob-to-regexp/index.js
5
5
  var require_glob_to_regexp = /* @__PURE__ */ __commonJSMin(((exports, module) => {
6
6
  module.exports = function(glob, opts) {
@@ -1204,6 +1204,6 @@ var esm_default = new class FetchMock {
1204
1204
  //#endregion
1205
1205
  //#region deno.json
1206
1206
  var name = "@fedify/vocab";
1207
- var version = "2.1.30";
1207
+ var version = "2.1.31";
1208
1208
  //#endregion
1209
1209
  export { version as n, esm_default as r, name as t };
@@ -1,7 +1,7 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  globalThis.addEventListener = () => {};
3
- import { _ as Person, a as Collection, m as Object$1, p as Note } from "./vocab-BdFWN1ns.mjs";
4
- import { n as version, r as esm_default, t as name } from "./deno-C-AmqlF6.mjs";
3
+ import { _ as Person, a as Collection, m as Object$1, p as Note } from "./vocab-De7fFc2M.mjs";
4
+ import { n as version, r as esm_default, t as name } from "./deno-B6BABxfi.mjs";
5
5
  import { t as getTypeId } from "./type-Cf-vxmre.mjs";
6
6
  import { t as assertInstanceOf } from "./utils-CE8Dk5hm.mjs";
7
7
  import { createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
@@ -220,6 +220,7 @@ async function* traverseCollection(collection, options = {}) {
220
220
  }
221
221
  //#endregion
222
222
  //#region src/lookup.test.ts
223
+ const allowPrivateAddress = { allowPrivateAddress: true };
223
224
  test("lookupObject()", {
224
225
  sanitizeResources: false,
225
226
  sanitizeOps: false
@@ -247,7 +248,8 @@ test("lookupObject()", {
247
248
  });
248
249
  const options = {
249
250
  documentLoader: mockDocumentLoader,
250
- contextLoader: mockDocumentLoader
251
+ contextLoader: mockDocumentLoader,
252
+ ...allowPrivateAddress
251
253
  };
252
254
  await t.step("actor", async () => {
253
255
  const person = await lookupObject("@johndoe@example.com", options);
@@ -538,15 +540,18 @@ test("FEP-fe34: lookupObject() cross-origin security", {
538
540
  throw new Error(`Unexpected URL: ${url}`);
539
541
  };
540
542
  deepStrictEqual(await lookupObject("@user@example.com", {
543
+ ...allowPrivateAddress,
541
544
  documentLoader: webfingerDocumentLoader,
542
545
  contextLoader: mockDocumentLoader
543
546
  }), null);
544
547
  await rejects(() => lookupObject("@user@example.com", {
548
+ ...allowPrivateAddress,
545
549
  documentLoader: webfingerDocumentLoader,
546
550
  contextLoader: mockDocumentLoader,
547
551
  crossOrigin: "throw"
548
552
  }), Error, "The object's @id (https://malicious.com/fake-actor) has a different origin than the document URL (https://different-origin.com/actor)");
549
553
  const result2 = await lookupObject("@user@example.com", {
554
+ ...allowPrivateAddress,
550
555
  documentLoader: webfingerDocumentLoader,
551
556
  contextLoader: mockDocumentLoader,
552
557
  crossOrigin: "trust"
@@ -617,11 +622,20 @@ test("FEP-fe34: lookupObject() cross-origin security", {
617
622
  const errorDocumentLoader = async (_url) => {
618
623
  throw new Error("Network error");
619
624
  };
620
- deepStrictEqual(await lookupObject("https://example.com/note", {
621
- documentLoader: errorDocumentLoader,
622
- contextLoader: mockDocumentLoader,
623
- crossOrigin: "throw"
624
- }), null);
625
+ esm_default.spyGlobal();
626
+ esm_default.get("begin:https://example.com/.well-known/webfinger", 404);
627
+ let result;
628
+ try {
629
+ result = await lookupObject("https://example.com/note", {
630
+ ...allowPrivateAddress,
631
+ documentLoader: errorDocumentLoader,
632
+ contextLoader: mockDocumentLoader,
633
+ crossOrigin: "throw"
634
+ });
635
+ } finally {
636
+ esm_default.hardReset();
637
+ }
638
+ deepStrictEqual(result, null);
625
639
  });
626
640
  await t.step("malformed JSON handling with cross-origin policy", async () => {
627
641
  const malformedJsonDocumentLoader = async (url) => {
@@ -1,6 +1,6 @@
1
1
  import "@js-temporal/polyfill";
2
2
  globalThis.addEventListener = () => {};
3
- import { _ as Person } from "./vocab-BdFWN1ns.mjs";
3
+ import { _ as Person } from "./vocab-De7fFc2M.mjs";
4
4
  import { t as getTypeId } from "./type-Cf-vxmre.mjs";
5
5
  import { test } from "@fedify/fixture";
6
6
  import { deepStrictEqual } from "node:assert/strict";