@fedify/fedify 2.4.0-dev.1988 → 2.4.0-dev.1995
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-Cts78G9N.mjs → builder-D0DxgOV5.mjs} +2 -2
- package/dist/compat/transformers.test.mjs +1 -1
- package/dist/compound-proof-CJnWc6c-.mjs +495 -0
- package/dist/{deno-BgMEefEr.mjs → deno-CABhzCb_.mjs} +1 -1
- package/dist/{docloader-DEYs99FZ.mjs → docloader-BbGSL0Xq.mjs} +2 -2
- package/dist/federation/builder.test.mjs +1 -1
- package/dist/federation/handler-compound-proof.test.d.mts +2 -0
- package/dist/federation/handler-compound-proof.test.mjs +152 -0
- package/dist/federation/handler.test.mjs +5 -5
- package/dist/federation/idempotency.test.mjs +2 -2
- 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/tasks/enqueue.test.mjs +1 -1
- package/dist/federation/tasks/tasks.test.mjs +2 -2
- package/dist/federation/temporal.test.mjs +1 -1
- package/dist/federation/webfinger.test.mjs +1 -1
- package/dist/{federation-DzPUG_AP.cjs → federation-DCEHQk4G.cjs} +542 -43
- package/dist/{http-CgwqtxAy.js → http-9WyuldYh.js} +2 -2
- package/dist/{http-Z3anvCd-.cjs → http-CRFns-UE.cjs} +2 -2
- package/dist/{http-CtidZS_t.mjs → http-D9urSO2D.mjs} +3 -3
- package/dist/{key-Cwbg5ggV.mjs → key-Ccs8cnd7.mjs} +2 -2
- package/dist/{kv-cache-BM2-w-Wq.cjs → kv-cache-DXT9vmIg.cjs} +1 -1
- package/dist/{kv-cache-CykuL0ya.js → kv-cache-DtmXhPXG.js} +1 -1
- package/dist/{kv-cache-DHiR8yTf.mjs → kv-cache-lKyFn_Dn.mjs} +1 -1
- package/dist/{ld-CzhdWyTt.mjs → ld-qup__MAW.mjs} +3 -3
- package/dist/map-local-context-conflict-DOYEEJ3u.mjs +204 -0
- package/dist/map-local-create-note-B0SeXJms.mjs +214 -0
- package/dist/{metrics-CrqsHP0l.mjs → metrics-CISXCvB1.mjs} +1 -1
- package/dist/{middleware-DCpiAsZi.mjs → middleware-CzvJvPHK.mjs} +52 -20
- package/dist/{middleware-CZpYxSKD.mjs → middleware-DkrU2WhY.mjs} +1 -1
- package/dist/{middleware-CeCj5caM.js → middleware-DsfWajaD.js} +511 -12
- package/dist/mod.cjs +19 -19
- package/dist/mod.js +4 -4
- package/dist/nodeinfo/handler.test.mjs +1 -1
- package/dist/{proof-CUghqhAf.js → owner-BIPEZGiU.js} +1239 -1139
- package/dist/{owner-BqVXJLW8.mjs → owner-CRoq8Spb.mjs} +2 -2
- package/dist/{proof-DHu5zI0Z.cjs → owner-CVA7L9MA.cjs} +1252 -1140
- package/dist/{proof-DL8Iid3a.mjs → proof-BDxNVZ3E.mjs} +176 -76
- package/dist/{send-6jS4xFsX.mjs → send-BzM5GLyn.mjs} +3 -3
- package/dist/sig/compound-proof-discovery.test.d.mts +2 -0
- package/dist/sig/compound-proof-discovery.test.mjs +331 -0
- package/dist/sig/compound-proof-verification.test.d.mts +2 -0
- package/dist/sig/compound-proof-verification.test.mjs +465 -0
- package/dist/sig/compound-proof.test.d.mts +2 -0
- package/dist/sig/compound-proof.test.mjs +324 -0
- package/dist/sig/http.test.mjs +2 -2
- package/dist/sig/key.test.mjs +1 -1
- package/dist/sig/ld.test.mjs +2 -2
- package/dist/sig/mod.cjs +17 -17
- package/dist/sig/mod.js +2 -2
- package/dist/sig/owner.test.mjs +1 -1
- package/dist/sig/proof.test.mjs +1 -1
- package/dist/{temporal-DcyzeytP.mjs → temporal-Dv6Qv-8k.mjs} +1 -1
- package/dist/testing/kv.test.mjs +1 -1
- package/dist/utils/docloader.test.mjs +2 -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
|
@@ -1,26 +1,27 @@
|
|
|
1
1
|
import { Temporal } from "temporal-polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { n as version, t as name } from "./deno-
|
|
5
|
-
import { a as instrumentDocumentLoader, b as recordWebFingerHandle, c as recordCircuitBreakerStateChange, d as recordCollectionRequest, f as recordCollectionTotalItems, g as recordInboxActivity, h as recordFanoutRecipients, i as getRemoteHost, l as recordCollectionDispatchDuration, n as getDurationMs, o as isAbortError, r as getFederationMetrics, u as recordCollectionPageItems, v as recordOutboxActivity, x as registerQueueDepthGauge, y as recordOutboxEnqueue } from "./metrics-
|
|
4
|
+
import { n as version, t as name } from "./deno-CABhzCb_.mjs";
|
|
5
|
+
import { a as instrumentDocumentLoader, b as recordWebFingerHandle, c as recordCircuitBreakerStateChange, d as recordCollectionRequest, f as recordCollectionTotalItems, g as recordInboxActivity, h as recordFanoutRecipients, i as getRemoteHost, l as recordCollectionDispatchDuration, n as getDurationMs, o as isAbortError, r as getFederationMetrics, u as recordCollectionPageItems, v as recordOutboxActivity, x as registerQueueDepthGauge, y as recordOutboxEnqueue } from "./metrics-CISXCvB1.mjs";
|
|
6
6
|
import { t as formatAcceptSignature } from "./accept-CPVqki78.mjs";
|
|
7
|
-
import { o as importJwk, s as validateCryptoKey, t as exportJwk } from "./key-
|
|
8
|
-
import { l as verifyRequest, o as parseRfc9421SignatureInput, u as verifyRequestDetailed } from "./http-
|
|
9
|
-
import { t as getAuthenticatedDocumentLoader } from "./docloader-
|
|
10
|
-
import { n as kvCache } from "./kv-cache-
|
|
7
|
+
import { o as importJwk, s as validateCryptoKey, t as exportJwk } from "./key-Ccs8cnd7.mjs";
|
|
8
|
+
import { l as verifyRequest, o as parseRfc9421SignatureInput, u as verifyRequestDetailed } from "./http-D9urSO2D.mjs";
|
|
9
|
+
import { t as getAuthenticatedDocumentLoader } from "./docloader-BbGSL0Xq.mjs";
|
|
10
|
+
import { n as kvCache } from "./kv-cache-lKyFn_Dn.mjs";
|
|
11
11
|
import { r as normalizeOutgoingActivityJsonLd } from "./outgoing-jsonld-B5Ne7JoL.mjs";
|
|
12
12
|
import { d as readBoundedText, l as BodyTooLargeError, t as getNodeInfo, u as MAX_BODY_SIZE } from "./client-DpnpgjyX.mjs";
|
|
13
13
|
import { t as nodeInfoToJson } from "./types-DE_LV1JB.mjs";
|
|
14
|
-
import { _ as wrapContextLoaderForJsonLd, a as compactJsonLd, c as getNormalizationContextLoader, d as isClearlyMalformedContextReference, f as isInvalidUrlTypeError, l as hasSignature, m as verifyCompactJsonLd, p as signJsonLd, r as assertSafeJsonLd, s as detachSignature, t as InvalidContextReferenceError, u as hasSignatureLike } from "./ld-
|
|
15
|
-
import { n as getKeyOwner, t as doesActorOwnKey } from "./owner-
|
|
16
|
-
import {
|
|
17
|
-
import { n as extractInboxes, r as sendActivity, t as SendActivityError } from "./send-
|
|
18
|
-
import { n as FederationBuilderImpl, t as ACTOR_ALIAS_PREFIX } from "./builder-
|
|
14
|
+
import { _ as wrapContextLoaderForJsonLd, a as compactJsonLd, c as getNormalizationContextLoader, d as isClearlyMalformedContextReference, f as isInvalidUrlTypeError, l as hasSignature, m as verifyCompactJsonLd, p as signJsonLd, r as assertSafeJsonLd, s as detachSignature, t as InvalidContextReferenceError, u as hasSignatureLike } from "./ld-qup__MAW.mjs";
|
|
15
|
+
import { n as getKeyOwner, t as doesActorOwnKey } from "./owner-CRoq8Spb.mjs";
|
|
16
|
+
import { a as verifyObject, n as hasProofLike, r as signObject } from "./proof-BDxNVZ3E.mjs";
|
|
17
|
+
import { n as extractInboxes, r as sendActivity, t as SendActivityError } from "./send-BzM5GLyn.mjs";
|
|
18
|
+
import { n as FederationBuilderImpl, t as ACTOR_ALIAS_PREFIX } from "./builder-D0DxgOV5.mjs";
|
|
19
19
|
import { t as CircuitBreaker } from "./circuit-breaker-C5NqoLBJ.mjs";
|
|
20
20
|
import { t as buildCollectionSynchronizationHeader } from "./collection-CnnP1UAv.mjs";
|
|
21
|
+
import { n as inspectCompoundPortableObjectApplicability, r as verifyCompoundPortableObjectProofs } from "./compound-proof-CJnWc6c-.mjs";
|
|
21
22
|
import { t as KvKeyCache } from "./keycache-BUDHB5rY.mjs";
|
|
22
23
|
import { t as acceptsJsonLd } from "./negotiation-CCocWT_N.mjs";
|
|
23
|
-
import { t as hasMalformedKnownTemporalLiteral } from "./temporal-
|
|
24
|
+
import { t as hasMalformedKnownTemporalLiteral } from "./temporal-Dv6Qv-8k.mjs";
|
|
24
25
|
import { t as createExponentialBackoffPolicy } from "./retry-zX5xw5e0.mjs";
|
|
25
26
|
import { t as TaskCodec } from "./codec-C6rTrpIp.mjs";
|
|
26
27
|
import { getLogger, withContext } from "@logtape/logtape";
|
|
@@ -513,6 +514,12 @@ async function routeActivity({ context: ctx, json, originalJson, normalizedActiv
|
|
|
513
514
|
//#endregion
|
|
514
515
|
//#region src/federation/handler.ts
|
|
515
516
|
const rawInboxContextFactorySymbol = Symbol("fedify.rawInboxContextFactory");
|
|
517
|
+
const INBOX_COMPOUND_PROOF_LIMITS = {
|
|
518
|
+
maxDepth: 64,
|
|
519
|
+
maxMaps: 1e4,
|
|
520
|
+
maxProofs: 32,
|
|
521
|
+
maxBytes: 10 * 1024 * 1024
|
|
522
|
+
};
|
|
516
523
|
function isRemoteContextLoadingFailure$1(error) {
|
|
517
524
|
return error instanceof Error && typeof error.details === "object" && error.details != null && error.details.code === "loading remote context failed";
|
|
518
525
|
}
|
|
@@ -637,13 +644,13 @@ function recordCollectionMetrics(meterProvider, base, result, options = {}) {
|
|
|
637
644
|
* @param parameters The parameters for handling the collection.
|
|
638
645
|
* @returns A promise that resolves to an HTTP response.
|
|
639
646
|
*/
|
|
640
|
-
async function handleCollection(request, { name: name$
|
|
641
|
-
const spanName = name$
|
|
647
|
+
async function handleCollection(request, { name: name$1, identifier, uriGetter, filter, filterPredicate, context, collectionCallbacks, tracerProvider, meterProvider, onUnauthorized, onNotFound }) {
|
|
648
|
+
const spanName = name$1.trim().replace(/\s+/g, "_");
|
|
642
649
|
tracerProvider = tracerProvider ?? trace.getTracerProvider();
|
|
643
650
|
const tracer = tracerProvider.getTracer(name, version);
|
|
644
651
|
const cursor = new URL(request.url).searchParams.get("cursor");
|
|
645
652
|
const metricBase = {
|
|
646
|
-
kind: getCollectionMetricKind(name$
|
|
653
|
+
kind: getCollectionMetricKind(name$1),
|
|
647
654
|
page: cursor != null,
|
|
648
655
|
dispatcher: "built_in"
|
|
649
656
|
};
|
|
@@ -684,7 +691,7 @@ async function handleCollection(request, { name: name$2, identifier, uriGetter,
|
|
|
684
691
|
span.setStatus({ code: SpanStatusCode.ERROR });
|
|
685
692
|
return await onNotFound(request);
|
|
686
693
|
}
|
|
687
|
-
const items = filterCollectionItems(page.items, name$
|
|
694
|
+
const items = filterCollectionItems(page.items, name$1, filterPredicate);
|
|
688
695
|
itemCount = items.length;
|
|
689
696
|
span.setAttribute("fedify.collection.items", itemCount);
|
|
690
697
|
return items;
|
|
@@ -724,7 +731,7 @@ async function handleCollection(request, { name: name$2, identifier, uriGetter,
|
|
|
724
731
|
} else {
|
|
725
732
|
const uri = new URL(baseUri);
|
|
726
733
|
uri.searchParams.set("cursor", cursor);
|
|
727
|
-
const pageOrResponse = await tracer.startActiveSpan(`activitypub.dispatch_collection_page ${name$
|
|
734
|
+
const pageOrResponse = await tracer.startActiveSpan(`activitypub.dispatch_collection_page ${name$1}`, {
|
|
728
735
|
kind: SpanKind.SERVER,
|
|
729
736
|
attributes: {
|
|
730
737
|
"activitypub.collection.id": uri.href,
|
|
@@ -740,7 +747,7 @@ async function handleCollection(request, { name: name$2, identifier, uriGetter,
|
|
|
740
747
|
span.setStatus({ code: SpanStatusCode.ERROR });
|
|
741
748
|
return await onNotFound(request);
|
|
742
749
|
}
|
|
743
|
-
const items = filterCollectionItems(page.items, name$
|
|
750
|
+
const items = filterCollectionItems(page.items, name$1, filterPredicate);
|
|
744
751
|
itemCount = items.length;
|
|
745
752
|
span.setAttribute("fedify.collection.items", itemCount);
|
|
746
753
|
return {
|
|
@@ -1634,6 +1641,31 @@ async function handleInboxInternal(request, parameters, span) {
|
|
|
1634
1641
|
headers: { "Content-Type": "text/plain; charset=utf-8" }
|
|
1635
1642
|
});
|
|
1636
1643
|
}
|
|
1644
|
+
if (!skipSignatureVerification) {
|
|
1645
|
+
if (inspectCompoundPortableObjectApplicability(json, INBOX_COMPOUND_PROOF_LIMITS) !== "absent") {
|
|
1646
|
+
const compoundProof = await verifyCompoundPortableObjectProofs(json, INBOX_COMPOUND_PROOF_LIMITS, {
|
|
1647
|
+
documentLoader: ctx.documentLoader,
|
|
1648
|
+
keyCache,
|
|
1649
|
+
meterProvider,
|
|
1650
|
+
tracerProvider
|
|
1651
|
+
});
|
|
1652
|
+
if (compoundProof.status !== "ok" || !compoundProof.verified) {
|
|
1653
|
+
logger.error("Failed to verify compound portable Object Integrity Proofs.", {
|
|
1654
|
+
recipient,
|
|
1655
|
+
activity: json,
|
|
1656
|
+
reason: compoundProof.status === "unsupported" ? compoundProof.reason.type : "invalidProof"
|
|
1657
|
+
});
|
|
1658
|
+
span.setStatus({
|
|
1659
|
+
code: SpanStatusCode.ERROR,
|
|
1660
|
+
message: "Failed to verify compound portable Object Integrity Proofs."
|
|
1661
|
+
});
|
|
1662
|
+
return new Response("Failed to verify compound portable Object Integrity Proofs.", {
|
|
1663
|
+
status: 401,
|
|
1664
|
+
headers: { "Content-Type": "text/plain; charset=utf-8" }
|
|
1665
|
+
});
|
|
1666
|
+
}
|
|
1667
|
+
}
|
|
1668
|
+
}
|
|
1637
1669
|
if (pendingNonceLabel != null) {
|
|
1638
1670
|
if (!await verifySignatureNonce(request, kv, kvPrefixes.acceptSignatureNonce, pendingNonceLabel)) {
|
|
1639
1671
|
getFederationMetrics(parameters.meterProvider).recordSignatureVerificationFailure("invalidNonce", httpSigKey?.id == null ? void 0 : getRemoteHost(httpSigKey.id));
|
|
@@ -1808,8 +1840,8 @@ var CustomCollectionHandler = class {
|
|
|
1808
1840
|
* @param CollectionPage The CollectionPage constructor.
|
|
1809
1841
|
* @param filterPredicate Optional filter predicate for items.
|
|
1810
1842
|
*/
|
|
1811
|
-
constructor(name$
|
|
1812
|
-
this.name = name$
|
|
1843
|
+
constructor(name$2, values, context, callbacks, tracerProvider = trace.getTracerProvider(), meterProvider, Collection, CollectionPage, filterPredicate) {
|
|
1844
|
+
this.name = name$2;
|
|
1813
1845
|
this.values = values;
|
|
1814
1846
|
this.context = context;
|
|
1815
1847
|
this.callbacks = callbacks;
|