@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.
- package/dist/{builder-BJHi8-yt.mjs → builder-yrlWWSb2.mjs} +3 -3
- package/dist/compat/transformers.test.mjs +1 -1
- package/dist/{deno-DxxJ7DXK.mjs → deno-VKs2mmuk.mjs} +1 -1
- package/dist/{docloader-CINB2BX4.mjs → docloader-C_D_5OXh.mjs} +5 -3
- package/dist/federation/builder.test.mjs +1 -1
- package/dist/federation/handler.test.mjs +6 -6
- 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/middleware.test.mjs +6 -6
- 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-CWWgD1YT.mjs → http-5zy1STVq.mjs} +2 -2
- package/dist/{http-DaSZw9Op.js → http-C_lGOZVR.js} +17 -3
- package/dist/{http-qvfJE6bK.cjs → http-CuYc-XkP.cjs} +17 -3
- package/dist/{inbox-D1LSfOOd.mjs → inbox-3nhkGSMW.mjs} +1 -1
- package/dist/{key-Bs7PNRrg.mjs → key-wwpJQHM0.mjs} +17 -3
- package/dist/{keycache-D239uGT9.mjs → keycache-DBD6fzl1.mjs} +1 -1
- package/dist/{kv-cache-D95UjzfB.js → kv-cache-DgG5Sj35.js} +4 -2
- package/dist/{kv-cache-BKk8naEu.cjs → kv-cache-DhMHcykY.cjs} +4 -2
- package/dist/{ld-BlH5jQ7T.mjs → ld-BCjStgTd.mjs} +2 -2
- package/dist/{middleware-BGMXK3Xj.mjs → middleware-Bxav3na4.mjs} +1 -1
- package/dist/{middleware-C9GIRvU2.cjs → middleware-CHSunb_b.cjs} +5 -5
- package/dist/{middleware-D7b2kyYw.cjs → middleware-CSW_W0q6.cjs} +1 -1
- package/dist/{middleware-DOo95yst.mjs → middleware-CeIMgD2N.mjs} +12 -12
- package/dist/{middleware-BGl-31cO.js → middleware-hfX624bD.js} +4 -4
- package/dist/mod.cjs +4 -4
- package/dist/mod.js +4 -4
- package/dist/nodeinfo/handler.test.mjs +1 -1
- package/dist/{owner-9OeM4q1P.mjs → owner-adLePX_5.mjs} +2 -2
- package/dist/{proof-BkLdxRY-.js → proof-BAxqx8DQ.js} +1 -1
- package/dist/{proof-D7USj3fe.cjs → proof-CIg5BBtv.cjs} +1 -1
- package/dist/{proof-B-oGOuzf.mjs → proof-De7RbPGn.mjs} +2 -2
- package/dist/{send-Bjw1BCUr.mjs → send-KK7FluNF.mjs} +2 -2
- package/dist/sig/http.test.mjs +2 -2
- 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-Bf5PdJPv.mjs → temporal-D6Uf0KUy.mjs} +1 -1
- package/dist/utils/docloader.test.mjs +66 -2
- 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-DVILvP5e.mjs";
|
|
|
5
5
|
import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
|
|
6
6
|
import "../std__assert-DflMZha5.mjs";
|
|
7
7
|
import { t as assertRejects } from "../assert_rejects-WyYSTDDX.mjs";
|
|
8
|
-
import { l as verifyRequest } from "../http-
|
|
8
|
+
import { l as verifyRequest } from "../http-5zy1STVq.mjs";
|
|
9
9
|
import { i as rsaPrivateKey2 } from "../keys-CCxRJhWa.mjs";
|
|
10
|
-
import { t as getAuthenticatedDocumentLoader } from "../docloader-
|
|
10
|
+
import { t as getAuthenticatedDocumentLoader } from "../docloader-C_D_5OXh.mjs";
|
|
11
11
|
import { mockDocumentLoader, test } from "@fedify/fixture";
|
|
12
12
|
import { FetchError, UrlError } from "@fedify/vocab-runtime";
|
|
13
13
|
import { configure, reset } from "@logtape/logtape";
|
|
@@ -450,6 +450,70 @@ const unsupportedUrls = [
|
|
|
450
450
|
"file:///collection",
|
|
451
451
|
`data:application/ld+json,${encodeURIComponent(JSON.stringify({ id: "https://example.com/data" }))}`
|
|
452
452
|
];
|
|
453
|
+
function isCredentialUrlError(error) {
|
|
454
|
+
return error instanceof UrlError && error.reason === "disallowed" && error.message === "URLs with credentials are not allowed";
|
|
455
|
+
}
|
|
456
|
+
test("getAuthenticatedDocumentLoader() rejects URLs with credentials", async (t) => {
|
|
457
|
+
const identity = {
|
|
458
|
+
keyId: new URL("https://example.com/key2"),
|
|
459
|
+
privateKey: rsaPrivateKey2
|
|
460
|
+
};
|
|
461
|
+
const start = "https://8.8.8.8/start";
|
|
462
|
+
const target = "https://user:pass@8.8.8.8/document";
|
|
463
|
+
for (const allowPrivateAddress of [false, true]) {
|
|
464
|
+
const loader = getAuthenticatedDocumentLoader(identity, { allowPrivateAddress });
|
|
465
|
+
for (const path of [
|
|
466
|
+
"direct",
|
|
467
|
+
"redirect",
|
|
468
|
+
"Link",
|
|
469
|
+
"HTML"
|
|
470
|
+
]) await t.step(`${path}, allowPrivateAddress=${allowPrivateAddress}`, async () => {
|
|
471
|
+
await withFetchStub((request) => {
|
|
472
|
+
if (request.url !== start) return Response.json({});
|
|
473
|
+
if (path === "redirect") return Response.redirect(target, 302);
|
|
474
|
+
if (path === "HTML") return new Response(`<link rel="alternate" type="application/activity+json" href="${target}">`, { headers: { "Content-Type": "text/html" } });
|
|
475
|
+
return new Response("", { headers: {
|
|
476
|
+
"Content-Type": "text/plain",
|
|
477
|
+
Link: `<${target}>; rel="alternate"; type="application/activity+json"`
|
|
478
|
+
} });
|
|
479
|
+
}, async (fetched) => {
|
|
480
|
+
await rejects(loader(path === "direct" ? target : start), isCredentialUrlError);
|
|
481
|
+
deepStrictEqual(fetched.map((r) => r.url), path === "direct" ? [] : [start]);
|
|
482
|
+
});
|
|
483
|
+
});
|
|
484
|
+
for (const url of [
|
|
485
|
+
"https://user@8.8.8.8/document",
|
|
486
|
+
"https://:pass@8.8.8.8/document",
|
|
487
|
+
"https://%75ser:p%40ss@8.8.8.8/document",
|
|
488
|
+
"http://user:pass@8.8.8.8/document"
|
|
489
|
+
]) await t.step(`${url}, allowPrivateAddress=${allowPrivateAddress}`, async () => {
|
|
490
|
+
await withFetchStub(() => Response.json({}), async (fetched) => {
|
|
491
|
+
await rejects(loader(url), isCredentialUrlError);
|
|
492
|
+
deepStrictEqual(fetched, []);
|
|
493
|
+
});
|
|
494
|
+
});
|
|
495
|
+
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 () => {
|
|
496
|
+
await withFetchStub(() => Response.json({ done: true }), async (fetched) => {
|
|
497
|
+
deepStrictEqual((await loader(url)).document, { done: true });
|
|
498
|
+
deepStrictEqual(fetched.map((r) => r.url), [new URL(url).href]);
|
|
499
|
+
});
|
|
500
|
+
});
|
|
501
|
+
}
|
|
502
|
+
for (const firstSpec of ["rfc9421", "draft-cavage-http-signatures-12"]) await t.step(`redirect after fallback from ${firstSpec}`, async () => {
|
|
503
|
+
const loader = getAuthenticatedDocumentLoader(identity, {
|
|
504
|
+
allowPrivateAddress: true,
|
|
505
|
+
specDeterminer: {
|
|
506
|
+
determineSpec: () => firstSpec,
|
|
507
|
+
rememberSpec: () => {}
|
|
508
|
+
}
|
|
509
|
+
});
|
|
510
|
+
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) => {
|
|
511
|
+
await rejects(loader(start), isCredentialUrlError);
|
|
512
|
+
deepStrictEqual(fetched.map((r) => r.url), [start, start]);
|
|
513
|
+
deepStrictEqual(fetched.map((r) => r.headers.has("Signature-Input")), [firstSpec === "rfc9421", firstSpec !== "rfc9421"]);
|
|
514
|
+
});
|
|
515
|
+
});
|
|
516
|
+
});
|
|
453
517
|
function isUnsupportedProtocolError(error, url) {
|
|
454
518
|
return error instanceof UrlError && error.message === `Unsupported protocol: ${new URL(url).protocol}` && error.reason === "disallowed";
|
|
455
519
|
}
|
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-DhMHcykY.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-DgG5Sj35.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.
|
|
3
|
+
"version": "2.0.34-dev.2423+4999dc80",
|
|
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.
|
|
148
|
-
"@fedify/
|
|
149
|
-
"@fedify/
|
|
147
|
+
"@fedify/vocab-runtime": "2.0.34-dev.2423+4999dc80",
|
|
148
|
+
"@fedify/webfinger": "2.0.34-dev.2423+4999dc80",
|
|
149
|
+
"@fedify/vocab": "2.0.34-dev.2423+4999dc80"
|
|
150
150
|
},
|
|
151
151
|
"devDependencies": {
|
|
152
152
|
"@std/assert": "npm:@jsr/std__assert@^0.226.0",
|
|
@@ -158,8 +158,8 @@
|
|
|
158
158
|
"tsx": "^4.19.4",
|
|
159
159
|
"typescript": "^6.0.0",
|
|
160
160
|
"wrangler": "^4.17.0",
|
|
161
|
-
"@fedify/
|
|
162
|
-
"@fedify/
|
|
161
|
+
"@fedify/fixture": "2.0.0",
|
|
162
|
+
"@fedify/vocab-tools": "^2.0.34-dev.2423+4999dc80"
|
|
163
163
|
},
|
|
164
164
|
"scripts": {
|
|
165
165
|
"build:self": "tsdown",
|