@fedify/fedify 2.3.13 → 2.3.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{builder-BagNDcQw.mjs → builder-C6yXExXl.mjs} +2 -2
- package/dist/compat/transformers.test.mjs +1 -1
- package/dist/{deno-XpcjbHwj.mjs → deno-y3L4Oa94.mjs} +1 -1
- package/dist/{docloader-QDpF5t9M.mjs → docloader-yuyzZC9a.mjs} +5 -3
- package/dist/federation/builder.test.mjs +1 -1
- package/dist/federation/handler.test.mjs +5 -5
- package/dist/federation/idempotency.test.mjs +2 -2
- package/dist/federation/inbox.test.mjs +1 -1
- package/dist/federation/keycache.test.mjs +18 -7
- package/dist/federation/metrics.test.mjs +1 -1
- package/dist/federation/middleware.test.mjs +7 -7
- package/dist/federation/mod.cjs +1 -1
- package/dist/federation/mod.js +1 -1
- package/dist/federation/send.test.mjs +3 -3
- package/dist/federation/temporal.test.mjs +1 -1
- package/dist/federation/webfinger.test.mjs +1 -1
- package/dist/{http-BRrpIDS1.mjs → http-BCSf1KIY.mjs} +3 -3
- package/dist/{http-DwPnG87d.cjs → http-D77Wjrcg.cjs} +17 -3
- package/dist/{http-GHVGCeb5.js → http-DNM9KyIO.js} +17 -3
- package/dist/{inbox-BzOuCPLY.mjs → inbox-NObX26c9.mjs} +2 -2
- package/dist/{key-PdEu1lDF.mjs → key-APURZ0ky.mjs} +18 -4
- package/dist/{keycache-Dkc_sflV.mjs → keycache-BimEQucx.mjs} +1 -1
- package/dist/{kv-cache-poF6Tqnz.cjs → kv-cache-Bg4utAuv.cjs} +4 -2
- package/dist/{kv-cache-Clx3SwMp.mjs → kv-cache-C69dzgQi.mjs} +1 -1
- package/dist/{kv-cache-BmqdF048.js → kv-cache-LBCwHNLu.js} +4 -2
- package/dist/{ld-D6UlzNnG.mjs → ld-BoLqbDaL.mjs} +3 -3
- package/dist/{metrics-62qolVUY.mjs → metrics-DBSl8wEr.mjs} +1 -1
- package/dist/{middleware-DkrXqZO_.cjs → middleware-BQUQ0pPl.cjs} +4 -4
- package/dist/{middleware-xw9fBZoB.js → middleware-CRd1JmuL.js} +4 -4
- package/dist/{middleware-CfbFdEO-.mjs → middleware-CZ8tI1qL.mjs} +14 -14
- package/dist/{middleware-C3Q3CoR8.mjs → middleware-DAqo2eOY.mjs} +1 -1
- package/dist/mod.cjs +4 -4
- package/dist/mod.js +4 -4
- package/dist/nodeinfo/handler.test.mjs +1 -1
- package/dist/{owner-DWnLg-vk.mjs → owner-DjKvngeb.mjs} +2 -2
- package/dist/{proof-DF6CU-SU.cjs → proof-CWTnYhjS.cjs} +1 -1
- package/dist/{proof-mf6h7n4_.mjs → proof-D2oFOdNA.mjs} +3 -3
- package/dist/{proof-CUSzBztF.js → proof-s9sy44kx.js} +1 -1
- package/dist/{send-LJUzNpVF.mjs → send-xDK5UnL-.mjs} +3 -3
- package/dist/sig/http.test.mjs +3 -3
- package/dist/sig/key.test.mjs +197 -3
- package/dist/sig/ld.test.mjs +47 -2
- package/dist/sig/mod.cjs +2 -2
- package/dist/sig/mod.js +2 -2
- package/dist/sig/owner.test.mjs +46 -1
- package/dist/sig/proof.test.mjs +52 -1
- package/dist/{temporal-_3yIqdvy.mjs → temporal-C6icc5n9.mjs} +1 -1
- package/dist/utils/docloader.test.mjs +66 -2
- package/dist/utils/kv-cache.test.mjs +1 -1
- package/dist/utils/mod.cjs +1 -1
- package/dist/utils/mod.js +1 -1
- package/package.json +6 -6
|
@@ -5,9 +5,9 @@ import { t as esm_default } from "../esm-vrlUxr60.mjs";
|
|
|
5
5
|
import { t as assertEquals } from "../assert_equals-C-ZRDbaf.mjs";
|
|
6
6
|
import "../std__assert-BjJn2daJ.mjs";
|
|
7
7
|
import { t as assertRejects } from "../assert_rejects-D1HYAik3.mjs";
|
|
8
|
-
import { l as verifyRequest } from "../http-
|
|
8
|
+
import { l as verifyRequest } from "../http-BCSf1KIY.mjs";
|
|
9
9
|
import { i as rsaPrivateKey2 } from "../keys-BAK-tUlf.mjs";
|
|
10
|
-
import { t as getAuthenticatedDocumentLoader } from "../docloader-
|
|
10
|
+
import { t as getAuthenticatedDocumentLoader } from "../docloader-yuyzZC9a.mjs";
|
|
11
11
|
import { configure, reset } from "@logtape/logtape";
|
|
12
12
|
import { mockDocumentLoader, test } from "@fedify/fixture";
|
|
13
13
|
import { FetchError, UrlError } from "@fedify/vocab-runtime";
|
|
@@ -466,6 +466,70 @@ const unsupportedUrls = [
|
|
|
466
466
|
"file:///collection",
|
|
467
467
|
`data:application/ld+json,${encodeURIComponent(JSON.stringify({ id: "https://example.com/data" }))}`
|
|
468
468
|
];
|
|
469
|
+
function isCredentialUrlError(error) {
|
|
470
|
+
return error instanceof UrlError && error.reason === "disallowed" && error.message === "URLs with credentials are not allowed";
|
|
471
|
+
}
|
|
472
|
+
test("getAuthenticatedDocumentLoader() rejects URLs with credentials", async (t) => {
|
|
473
|
+
const identity = {
|
|
474
|
+
keyId: new URL("https://example.com/key2"),
|
|
475
|
+
privateKey: rsaPrivateKey2
|
|
476
|
+
};
|
|
477
|
+
const start = "https://8.8.8.8/start";
|
|
478
|
+
const target = "https://user:pass@8.8.8.8/document";
|
|
479
|
+
for (const allowPrivateAddress of [false, true]) {
|
|
480
|
+
const loader = getAuthenticatedDocumentLoader(identity, { allowPrivateAddress });
|
|
481
|
+
for (const path of [
|
|
482
|
+
"direct",
|
|
483
|
+
"redirect",
|
|
484
|
+
"Link",
|
|
485
|
+
"HTML"
|
|
486
|
+
]) await t.step(`${path}, allowPrivateAddress=${allowPrivateAddress}`, async () => {
|
|
487
|
+
await withFetchStub((request) => {
|
|
488
|
+
if (request.url !== start) return Response.json({});
|
|
489
|
+
if (path === "redirect") return Response.redirect(target, 302);
|
|
490
|
+
if (path === "HTML") return new Response(`<link rel="alternate" type="application/activity+json" href="${target}">`, { headers: { "Content-Type": "text/html" } });
|
|
491
|
+
return new Response("", { headers: {
|
|
492
|
+
"Content-Type": "text/plain",
|
|
493
|
+
Link: `<${target}>; rel="alternate"; type="application/activity+json"`
|
|
494
|
+
} });
|
|
495
|
+
}, async (fetched) => {
|
|
496
|
+
await rejects(loader(path === "direct" ? target : start), isCredentialUrlError);
|
|
497
|
+
deepStrictEqual(fetched.map((r) => r.url), path === "direct" ? [] : [start]);
|
|
498
|
+
});
|
|
499
|
+
});
|
|
500
|
+
for (const url of [
|
|
501
|
+
"https://user@8.8.8.8/document",
|
|
502
|
+
"https://:pass@8.8.8.8/document",
|
|
503
|
+
"https://%75ser:p%40ss@8.8.8.8/document",
|
|
504
|
+
"http://user:pass@8.8.8.8/document"
|
|
505
|
+
]) await t.step(`${url}, allowPrivateAddress=${allowPrivateAddress}`, async () => {
|
|
506
|
+
await withFetchStub(() => Response.json({}), async (fetched) => {
|
|
507
|
+
await rejects(loader(url), isCredentialUrlError);
|
|
508
|
+
deepStrictEqual(fetched, []);
|
|
509
|
+
});
|
|
510
|
+
});
|
|
511
|
+
for (const url of ["https://:@8.8.8.8/document", "https://8.8.8.8/@user?q=@pass"]) await t.step(`allows ${url}, allowPrivateAddress=${allowPrivateAddress}`, async () => {
|
|
512
|
+
await withFetchStub(() => Response.json({ done: true }), async (fetched) => {
|
|
513
|
+
deepStrictEqual((await loader(url)).document, { done: true });
|
|
514
|
+
deepStrictEqual(fetched.map((r) => r.url), [new URL(url).href]);
|
|
515
|
+
});
|
|
516
|
+
});
|
|
517
|
+
}
|
|
518
|
+
for (const firstSpec of ["rfc9421", "draft-cavage-http-signatures-12"]) await t.step(`redirect after fallback from ${firstSpec}`, async () => {
|
|
519
|
+
const loader = getAuthenticatedDocumentLoader(identity, {
|
|
520
|
+
allowPrivateAddress: true,
|
|
521
|
+
specDeterminer: {
|
|
522
|
+
determineSpec: () => firstSpec,
|
|
523
|
+
rememberSpec: () => {}
|
|
524
|
+
}
|
|
525
|
+
});
|
|
526
|
+
await withFetchStub((request) => request.url !== start ? Response.json({}) : request.headers.has("Signature-Input") === (firstSpec === "rfc9421") ? new Response(null, { status: 401 }) : Response.redirect(target, 302), async (fetched) => {
|
|
527
|
+
await rejects(loader(start), isCredentialUrlError);
|
|
528
|
+
deepStrictEqual(fetched.map((r) => r.url), [start, start]);
|
|
529
|
+
deepStrictEqual(fetched.map((r) => r.headers.has("Signature-Input")), [firstSpec === "rfc9421", firstSpec !== "rfc9421"]);
|
|
530
|
+
});
|
|
531
|
+
});
|
|
532
|
+
});
|
|
469
533
|
function isUnsupportedProtocolError(error, url) {
|
|
470
534
|
return error instanceof UrlError && error.message === `Unsupported protocol: ${new URL(url).protocol}` && error.reason === "disallowed";
|
|
471
535
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { n as kvCache, t as MockKvStore } from "../kv-cache-
|
|
4
|
+
import { n as kvCache, t as MockKvStore } from "../kv-cache-C69dzgQi.mjs";
|
|
5
5
|
import { deepStrictEqual, throws } from "node:assert";
|
|
6
6
|
import { createTestMeterProvider, mockDocumentLoader, test } from "@fedify/fixture";
|
|
7
7
|
import { preloadedContexts } from "@fedify/vocab-runtime";
|
package/dist/utils/mod.cjs
CHANGED
|
@@ -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-
|
|
4
|
+
const require_kv_cache = require("../kv-cache-Bg4utAuv.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-
|
|
3
|
+
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "../kv-cache-LBCwHNLu.js";
|
|
4
4
|
export { getAuthenticatedDocumentLoader, kvCache };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fedify/fedify",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.14",
|
|
4
4
|
"description": "An ActivityPub server framework",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ActivityPub",
|
|
@@ -152,10 +152,10 @@
|
|
|
152
152
|
"jsonld": "^9.0.0",
|
|
153
153
|
"structured-field-values": "^2.0.4",
|
|
154
154
|
"urlpattern-polyfill": "^10.1.0",
|
|
155
|
-
"@fedify/
|
|
156
|
-
"@fedify/
|
|
157
|
-
"@fedify/
|
|
158
|
-
"@fedify/
|
|
155
|
+
"@fedify/vocab-runtime": "2.3.14",
|
|
156
|
+
"@fedify/uri-template": "2.3.14",
|
|
157
|
+
"@fedify/webfinger": "2.3.14",
|
|
158
|
+
"@fedify/vocab": "2.3.14"
|
|
159
159
|
},
|
|
160
160
|
"devDependencies": {
|
|
161
161
|
"@std/assert": "npm:@jsr/std__assert@^0.226.0",
|
|
@@ -168,7 +168,7 @@
|
|
|
168
168
|
"typescript": "^6.0.0",
|
|
169
169
|
"wrangler": "^4.17.0",
|
|
170
170
|
"@fedify/fixture": "2.0.0",
|
|
171
|
-
"@fedify/vocab-tools": "^2.3.
|
|
171
|
+
"@fedify/vocab-tools": "^2.3.14"
|
|
172
172
|
},
|
|
173
173
|
"scripts": {
|
|
174
174
|
"build:self": "tsdown",
|