@fedify/fedify 2.4.2 → 2.4.4
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-9ovCSqLp.mjs → builder-DdY0E0w9.mjs} +2 -2
- package/dist/compat/transformers.test.mjs +1 -1
- package/dist/{compound-proof-G2J_bU0u.mjs → compound-proof-fxkyiXYM.mjs} +2 -2
- package/dist/{deno-BZ4z-lJJ.mjs → deno-CO1X_K_q.mjs} +1 -1
- package/dist/{docloader-DUXXI-7G.mjs → docloader-DFB_TNVp.mjs} +6 -2
- package/dist/federation/builder.test.mjs +1 -1
- package/dist/federation/compound-fanout.test.mjs +3 -3
- package/dist/federation/handler-compound-proof.test.mjs +5 -5
- package/dist/federation/handler.test.mjs +258 -5
- package/dist/federation/hashlink-media.test.mjs +2 -2
- package/dist/federation/idempotency.test.mjs +2 -2
- package/dist/federation/inbox-report.test.mjs +5 -5
- package/dist/federation/inbox.test.mjs +43 -0
- package/dist/federation/keycache.test.mjs +20 -9
- package/dist/federation/metrics.test.mjs +1 -1
- package/dist/federation/middleware.test.mjs +173 -11
- package/dist/federation/mod.cjs +1 -1
- package/dist/federation/mod.js +1 -1
- package/dist/federation/outgoing-proof.test.mjs +4 -4
- package/dist/federation/portable-actor.test.mjs +3 -3
- package/dist/federation/portable-chain.test.mjs +3 -3
- package/dist/federation/portable-collection.test.mjs +4 -4
- package/dist/federation/portable-delivery.test.mjs +2 -2
- package/dist/federation/portable-gateway-keys.test.mjs +5 -5
- package/dist/federation/portable-inbox.test.mjs +4 -4
- package/dist/federation/portable-parse-uri.test.mjs +1 -1
- package/dist/federation/portable-route-activity.test.mjs +2 -2
- package/dist/federation/portable.test.mjs +3 -3
- 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-DpT8bDM6.cjs → federation-Bf4FEork.cjs} +122 -21
- package/dist/{http-Qq7jR2rC.js → http-D_AGUmSq.js} +17 -3
- package/dist/{http-B5w_qcIg.mjs → http-DkLKT8Vp.mjs} +4 -4
- package/dist/{http-x1satM4y.cjs → http-g5f1D2tm.cjs} +17 -3
- package/dist/inbox-Di1-EKqa.mjs +188 -0
- package/dist/{keycache-D-MNltOk.mjs → keycache-N2opu4-3.mjs} +1 -1
- package/dist/{kv-cache-BgQMAKIg.mjs → kv-cache-BxfOpUP9.mjs} +1 -1
- package/dist/{kv-cache-B0SZfzFb.js → kv-cache-C0AsMZ4U.js} +5 -1
- package/dist/{kv-cache-D4throaQ.cjs → kv-cache-HsXADkl9.cjs} +5 -1
- package/dist/{ld-Dkkyk65e.mjs → ld-Cy86r-Ty.mjs} +18 -4
- package/dist/{metrics-CRv6_IBg.mjs → metrics-BguhdXt-.mjs} +1 -1
- package/dist/{middleware-BqefXH6B.js → middleware-BOBF7req.js} +122 -21
- package/dist/{middleware-DFtNaBcH.mjs → middleware-BYojyPi4.mjs} +1 -1
- package/dist/{middleware-C-swet0z.mjs → middleware-C_gtR3fV.mjs} +104 -180
- package/dist/mod.cjs +4 -4
- package/dist/mod.js +4 -4
- package/dist/nodeinfo/handler.test.mjs +1 -1
- package/dist/{owner-BHUhedVc.mjs → owner-Dc-Lg_Xn.mjs} +3 -3
- package/dist/{portable-collection-DL-1Wy1s.cjs → portable-collection-Bl2UkqcO.cjs} +1 -1
- package/dist/{portable-collection-CfIc190c.js → portable-collection-CjdP7fQ4.js} +1 -1
- package/dist/{portable-collection-DONEPTXV.mjs → portable-collection-DSKqMgvr.mjs} +2 -2
- package/dist/{portable-key-Cdw3vfl-.mjs → portable-key-ClXZ25LT.mjs} +1 -1
- package/dist/{proof-DuSE1ABD.mjs → proof-kJtQ49gr.mjs} +3 -3
- package/dist/{send-D9oTjA6A.mjs → send-D6hcL5qf.mjs} +3 -3
- package/dist/sig/compound-proof-discovery.test.mjs +1 -1
- package/dist/sig/compound-proof-producer.test.mjs +1 -1
- package/dist/sig/compound-proof-verification.test.mjs +2 -2
- package/dist/sig/compound-proof.test.mjs +2 -2
- package/dist/sig/http.test.mjs +3 -3
- package/dist/sig/key.test.mjs +196 -1
- package/dist/sig/ld.test.mjs +46 -1
- package/dist/sig/mitra-receive-interop.test.mjs +4 -4
- package/dist/sig/mitra-send-interop.test.mjs +3 -3
- 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/portable-collection.test.mjs +1 -1
- package/dist/sig/portable-interop.test.mjs +3 -3
- package/dist/sig/portable-key.test.mjs +6 -6
- package/dist/sig/proof.test.mjs +54 -3
- package/dist/sig/tootik-request-interop.test.mjs +4 -4
- package/dist/sig/tootik-send-interop.test.mjs +3 -3
- package/dist/sig/verification.test.mjs +3 -3
- package/dist/{temporal-iyAxBq0I.mjs → temporal-C8WqyM34.mjs} +1 -1
- package/dist/testing/kv.test.mjs +1 -1
- package/dist/utils/docloader.test.mjs +176 -37
- 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
|
@@ -2,10 +2,10 @@ import { Temporal } from "temporal-polyfill";
|
|
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
|
3
3
|
import { t as __exportAll } from "./rolldown-runtime-BC-Eo5Mj.js";
|
|
4
4
|
import { r as getDefaultActivityTransformers } from "./transformers-DAtXl_Kc.js";
|
|
5
|
-
import { $ as instrumentDocumentLoader, A as hasSignature, At as isPortableUri, C as InvalidContextReferenceError, Ct as getGatewayKeyBase, Dt as isCompatibleKeyId, E as compactJsonLd, Et as hasPortableActor, F as verifyCompactJsonLd, G as validateCryptoKey, M as isClearlyMalformedContextReference, N as isInvalidUrlTypeError, Nt as name, O as detachSignature, Ot as isPortableId, P as signJsonLd, Pt as version, Q as getRemoteHost, R as wrapContextLoaderForJsonLd, S as normalizeOutgoingActivityJsonLd, St as getCanonicalPortableId, Tt as getRawCanonicalPortableId, W as importJwk, X as getDurationMs, Z as getFederationMetrics, _ as verifyObject, at as recordCollectionTotalItems, b as verifyPortableObjectProofWithRoot, bt as verificationObservation, c as verifyRequestDetailed, ct as recordInboxActivity, d as InvalidPortableObjectIdError, dt as recordWebFingerHandle, et as isAbortError, f as classifyFep2277CoreType, ft as registerQueueDepthGauge, g as verifyMapLocalProof, h as signObject, i as selectRequestSignature, it as recordCollectionRequest, j as hasSignatureLike, jt as isSameObjectId, k as getNormalizationContextLoader, kt as isPortableKeyId, lt as recordOutboxActivity, m as hasProofLike, mt as formatAcceptSignature, n as listRequestSignatures, nt as recordCollectionDispatchDuration, o as validateMaxSignatures, pt as preloadedOnlyDocumentLoader, q as MAX_PORTABLE_KEY_TTL, r as parseRfc9421SignatureInput, rt as recordCollectionPageItems, s as verifyRequest, st as recordFanoutRecipients, t as doubleKnock, tt as recordCircuitBreakerStateChange, ut as recordOutboxEnqueue, v as verifyPortableObjectProof, vt as observeAttempt, w as assertSafeJsonLd, wt as getPortableDid, xt as getAuthenticationOrigin, y as verifyPortableObjectProofPolicy, yt as snapshotKey, z as exportJwk } from "./http-
|
|
5
|
+
import { $ as instrumentDocumentLoader, A as hasSignature, At as isPortableUri, C as InvalidContextReferenceError, Ct as getGatewayKeyBase, Dt as isCompatibleKeyId, E as compactJsonLd, Et as hasPortableActor, F as verifyCompactJsonLd, G as validateCryptoKey, M as isClearlyMalformedContextReference, N as isInvalidUrlTypeError, Nt as name, O as detachSignature, Ot as isPortableId, P as signJsonLd, Pt as version, Q as getRemoteHost, R as wrapContextLoaderForJsonLd, S as normalizeOutgoingActivityJsonLd, St as getCanonicalPortableId, Tt as getRawCanonicalPortableId, W as importJwk, X as getDurationMs, Z as getFederationMetrics, _ as verifyObject, at as recordCollectionTotalItems, b as verifyPortableObjectProofWithRoot, bt as verificationObservation, c as verifyRequestDetailed, ct as recordInboxActivity, d as InvalidPortableObjectIdError, dt as recordWebFingerHandle, et as isAbortError, f as classifyFep2277CoreType, ft as registerQueueDepthGauge, g as verifyMapLocalProof, h as signObject, i as selectRequestSignature, it as recordCollectionRequest, j as hasSignatureLike, jt as isSameObjectId, k as getNormalizationContextLoader, kt as isPortableKeyId, lt as recordOutboxActivity, m as hasProofLike, mt as formatAcceptSignature, n as listRequestSignatures, nt as recordCollectionDispatchDuration, o as validateMaxSignatures, pt as preloadedOnlyDocumentLoader, q as MAX_PORTABLE_KEY_TTL, r as parseRfc9421SignatureInput, rt as recordCollectionPageItems, s as verifyRequest, st as recordFanoutRecipients, t as doubleKnock, tt as recordCircuitBreakerStateChange, ut as recordOutboxEnqueue, v as verifyPortableObjectProof, vt as observeAttempt, w as assertSafeJsonLd, wt as getPortableDid, xt as getAuthenticationOrigin, y as verifyPortableObjectProofPolicy, yt as snapshotKey, z as exportJwk } from "./http-D_AGUmSq.js";
|
|
6
6
|
import { a as MAX_BODY_SIZE, i as BodyTooLargeError, n as getNodeInfo, o as readBoundedText, t as nodeInfoToJson } from "./types-_S2_MeLF.js";
|
|
7
|
-
import { n as doesActorOwnKey, r as getKeyOwner, t as verifyPortableObject } from "./portable-collection-
|
|
8
|
-
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-
|
|
7
|
+
import { n as doesActorOwnKey, r as getKeyOwner, t as verifyPortableObject } from "./portable-collection-CjdP7fQ4.js";
|
|
8
|
+
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-C0AsMZ4U.js";
|
|
9
9
|
import { getLogger, withContext } from "@logtape/logtape";
|
|
10
10
|
import { Router, RouterError, assertPath } from "@fedify/uri-template";
|
|
11
11
|
import { Activity, Collection, CollectionPage, CryptographicKey, Link, Multikey, Object as Object$1, OrderedCollection, OrderedCollectionPage, PUBLIC_COLLECTION, Tombstone, getTypeId, isActor, lookupObject, traverseCollection } from "@fedify/vocab";
|
|
@@ -2777,12 +2777,41 @@ async function isInAudience(object, actor, options = {}) {
|
|
|
2777
2777
|
}
|
|
2778
2778
|
//#endregion
|
|
2779
2779
|
//#region src/federation/inbox.ts
|
|
2780
|
+
/**
|
|
2781
|
+
* Checks whether an activity's ID and all of its actor IDs have the same
|
|
2782
|
+
* [FEP-fe34] origin. Activities without an ID have no origin to authenticate.
|
|
2783
|
+
*
|
|
2784
|
+
* Origins are compared by `getAuthenticationOrigin()`, so a portable activity
|
|
2785
|
+
* and its portable actors, including compatible identifiers on any gateway,
|
|
2786
|
+
* are compared by their DIDs. An ID that has no supported origin, such as an
|
|
2787
|
+
* opaque URN, never matches.
|
|
2788
|
+
*
|
|
2789
|
+
* The caller is responsible for rejecting a missing primary actor ID before
|
|
2790
|
+
* relying on this check.
|
|
2791
|
+
*
|
|
2792
|
+
* [FEP-fe34]: https://w3id.org/fep/fe34
|
|
2793
|
+
* @internal
|
|
2794
|
+
*/
|
|
2795
|
+
function actorsHaveSameOrigin(activity) {
|
|
2796
|
+
if (activity.id == null) return true;
|
|
2797
|
+
const origin = getAuthenticationOrigin(activity.id);
|
|
2798
|
+
return origin != null && activity.actorIds.every((actor) => getAuthenticationOrigin(actor) === origin);
|
|
2799
|
+
}
|
|
2780
2800
|
async function routeActivity({ context: ctx, json, originalJson, normalizedActivity, ldSignatureVerified, activity, recipient, inboxListeners, inboxContextFactory, listenerInboxContextFactory, inboxErrorHandler, kv, kvPrefixes, queue, span, meterProvider, tracerProvider, idempotencyStrategy }) {
|
|
2781
2801
|
const logger = getLogger([
|
|
2782
2802
|
"fedify",
|
|
2783
2803
|
"federation",
|
|
2784
2804
|
"inbox"
|
|
2785
2805
|
]);
|
|
2806
|
+
if (activity.actorId == null) {
|
|
2807
|
+
logger.error("Missing actor.", { activity: json });
|
|
2808
|
+
span.setStatus({
|
|
2809
|
+
code: SpanStatusCode.ERROR,
|
|
2810
|
+
message: "Missing actor."
|
|
2811
|
+
});
|
|
2812
|
+
recordInboxActivity(meterProvider, "rejected", getTypeId(activity).href);
|
|
2813
|
+
return "missingActor";
|
|
2814
|
+
}
|
|
2786
2815
|
let cacheKey = null;
|
|
2787
2816
|
if (activity.id != null) {
|
|
2788
2817
|
const inboxContext = inboxContextFactory(recipient, json, activity.id?.href, getTypeId(activity).href);
|
|
@@ -2818,15 +2847,6 @@ async function routeActivity({ context: ctx, json, originalJson, normalizedActiv
|
|
|
2818
2847
|
return "alreadyProcessed";
|
|
2819
2848
|
}
|
|
2820
2849
|
}
|
|
2821
|
-
if (activity.actorId == null) {
|
|
2822
|
-
logger.error("Missing actor.", { activity: json });
|
|
2823
|
-
span.setStatus({
|
|
2824
|
-
code: SpanStatusCode.ERROR,
|
|
2825
|
-
message: "Missing actor."
|
|
2826
|
-
});
|
|
2827
|
-
recordInboxActivity(meterProvider, "rejected", getTypeId(activity).href);
|
|
2828
|
-
return "missingActor";
|
|
2829
|
-
}
|
|
2830
2850
|
span.setAttribute("activitypub.actor.id", activity.actorId.href);
|
|
2831
2851
|
if (queue != null) {
|
|
2832
2852
|
const carrier = {};
|
|
@@ -2935,7 +2955,7 @@ async function routeActivity({ context: ctx, json, originalJson, normalizedActiv
|
|
|
2935
2955
|
}
|
|
2936
2956
|
//#endregion
|
|
2937
2957
|
//#region src/federation/keycache.ts
|
|
2938
|
-
const KEY_CACHE_GENERATION = "
|
|
2958
|
+
const KEY_CACHE_GENERATION = "3";
|
|
2939
2959
|
const COMPATIBLE_KEY_SEGMENT = "__compatible";
|
|
2940
2960
|
const MAX_OWNER_BYTES = 32 * 1024;
|
|
2941
2961
|
function isCompatibleKeyEntry(value) {
|
|
@@ -4740,13 +4760,13 @@ function recordCollectionMetrics(meterProvider, base, result, options = {}) {
|
|
|
4740
4760
|
* @param parameters The parameters for handling the collection.
|
|
4741
4761
|
* @returns A promise that resolves to an HTTP response.
|
|
4742
4762
|
*/
|
|
4743
|
-
async function handleCollection(request, { name: name$
|
|
4744
|
-
const spanName = name$
|
|
4763
|
+
async function handleCollection(request, { name: name$1, identifier, uriGetter, filter, filterPredicate, context, collectionCallbacks, portable, tracerProvider, meterProvider, onUnauthorized, onNotFound }) {
|
|
4764
|
+
const spanName = name$1.trim().replace(/\s+/g, "_");
|
|
4745
4765
|
tracerProvider = tracerProvider ?? trace.getTracerProvider();
|
|
4746
4766
|
const tracer = tracerProvider.getTracer(name, version);
|
|
4747
4767
|
const cursor = new URL(request.url).searchParams.get("cursor");
|
|
4748
4768
|
const metricBase = {
|
|
4749
|
-
kind: getCollectionMetricKind(name$
|
|
4769
|
+
kind: getCollectionMetricKind(name$1),
|
|
4750
4770
|
page: cursor != null,
|
|
4751
4771
|
dispatcher: "built_in"
|
|
4752
4772
|
};
|
|
@@ -4792,7 +4812,7 @@ async function handleCollection(request, { name: name$2, identifier, uriGetter,
|
|
|
4792
4812
|
span.setStatus({ code: SpanStatusCode.ERROR });
|
|
4793
4813
|
return await onNotFound(request);
|
|
4794
4814
|
}
|
|
4795
|
-
const items = filterCollectionItems(page.items, name$
|
|
4815
|
+
const items = filterCollectionItems(page.items, name$1, filterPredicate);
|
|
4796
4816
|
itemCount = items.length;
|
|
4797
4817
|
span.setAttribute("fedify.collection.items", itemCount);
|
|
4798
4818
|
return items;
|
|
@@ -4834,7 +4854,7 @@ async function handleCollection(request, { name: name$2, identifier, uriGetter,
|
|
|
4834
4854
|
} else {
|
|
4835
4855
|
const uri = new URL(portable == null ? baseUri : pageBase);
|
|
4836
4856
|
uri.searchParams.set("cursor", cursor);
|
|
4837
|
-
const pageOrResponse = await tracer.startActiveSpan(`activitypub.dispatch_collection_page ${name$
|
|
4857
|
+
const pageOrResponse = await tracer.startActiveSpan(`activitypub.dispatch_collection_page ${name$1}`, {
|
|
4838
4858
|
kind: SpanKind.SERVER,
|
|
4839
4859
|
attributes: {
|
|
4840
4860
|
"activitypub.collection.id": uri.href,
|
|
@@ -4850,7 +4870,7 @@ async function handleCollection(request, { name: name$2, identifier, uriGetter,
|
|
|
4850
4870
|
span.setStatus({ code: SpanStatusCode.ERROR });
|
|
4851
4871
|
return await onNotFound(request);
|
|
4852
4872
|
}
|
|
4853
|
-
const items = filterCollectionItems(page.items, name$
|
|
4873
|
+
const items = filterCollectionItems(page.items, name$1, filterPredicate);
|
|
4854
4874
|
itemCount = items.length;
|
|
4855
4875
|
span.setAttribute("fedify.collection.items", itemCount);
|
|
4856
4876
|
return {
|
|
@@ -5999,11 +6019,49 @@ async function handleInboxInternal(request, parameters, span) {
|
|
|
5999
6019
|
return await getFailedSignatureResponse(inboxChallengePolicy, kv, kvPrefixes);
|
|
6000
6020
|
}
|
|
6001
6021
|
}
|
|
6022
|
+
if (!skipSignatureVerification && activity.id != null && !actorsHaveSameOrigin(activity)) {
|
|
6023
|
+
observation.authentication = {
|
|
6024
|
+
status: "rejected",
|
|
6025
|
+
reason: { type: "verificationFailed" }
|
|
6026
|
+
};
|
|
6027
|
+
logger.error("The activity ({activityId}) and its actors do not have the same origin.", {
|
|
6028
|
+
activity: json,
|
|
6029
|
+
recipient,
|
|
6030
|
+
activityId: activity.id.href,
|
|
6031
|
+
actorIds: activity.actorIds.map((actor) => actor.href)
|
|
6032
|
+
});
|
|
6033
|
+
span.setStatus({
|
|
6034
|
+
code: SpanStatusCode.ERROR,
|
|
6035
|
+
message: `The activity (${activity.id.href}) and its actors do not have the same origin.`
|
|
6036
|
+
});
|
|
6037
|
+
return new Response("The activity and its actors do not have the same origin.", {
|
|
6038
|
+
status: 401,
|
|
6039
|
+
headers: { "Content-Type": "text/plain; charset=utf-8" }
|
|
6040
|
+
});
|
|
6041
|
+
}
|
|
6002
6042
|
observation.authentication = skipSignatureVerification ? { status: "skipped" } : {
|
|
6003
6043
|
status: "verified",
|
|
6004
6044
|
attempts: observation.verification.attempts.filter((attempt) => attempt.status === "verified")
|
|
6005
6045
|
};
|
|
6006
6046
|
observation.stage = "dispatch";
|
|
6047
|
+
if (activity.actorId == null) {
|
|
6048
|
+
observation.result = {
|
|
6049
|
+
disposition: "rejected",
|
|
6050
|
+
reason: "missingActor"
|
|
6051
|
+
};
|
|
6052
|
+
logger.error("Missing actor.", {
|
|
6053
|
+
activity: json,
|
|
6054
|
+
recipient
|
|
6055
|
+
});
|
|
6056
|
+
span.setStatus({
|
|
6057
|
+
code: SpanStatusCode.ERROR,
|
|
6058
|
+
message: "Missing actor."
|
|
6059
|
+
});
|
|
6060
|
+
return new Response("Missing actor.", {
|
|
6061
|
+
status: 400,
|
|
6062
|
+
headers: { "Content-Type": "text/plain; charset=utf-8" }
|
|
6063
|
+
});
|
|
6064
|
+
}
|
|
6007
6065
|
const routeResult = await routeActivity({
|
|
6008
6066
|
context: ctx,
|
|
6009
6067
|
json,
|
|
@@ -6224,8 +6282,8 @@ var CustomCollectionHandler = class {
|
|
|
6224
6282
|
* @param CollectionPage The CollectionPage constructor.
|
|
6225
6283
|
* @param filterPredicate Optional filter predicate for items.
|
|
6226
6284
|
*/
|
|
6227
|
-
constructor(name$
|
|
6228
|
-
this.name = name$
|
|
6285
|
+
constructor(name$2, values, context, callbacks, tracerProvider = trace.getTracerProvider(), meterProvider, Collection, CollectionPage, filterPredicate, portable) {
|
|
6286
|
+
this.name = name$2;
|
|
6229
6287
|
this.values = values;
|
|
6230
6288
|
this.context = context;
|
|
6231
6289
|
this.callbacks = callbacks;
|
|
@@ -9260,6 +9318,35 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
9260
9318
|
span.setAttribute("activitypub.activity.id", activity.id.href);
|
|
9261
9319
|
listenerSpan.setAttribute("activitypub.activity.id", activity.id.href);
|
|
9262
9320
|
}
|
|
9321
|
+
if (activity.actorId == null) {
|
|
9322
|
+
logger.error("Missing actor in queued incoming activity.", {
|
|
9323
|
+
activityId: activity.id?.href,
|
|
9324
|
+
activity: message.activity,
|
|
9325
|
+
recipient: message.identifier
|
|
9326
|
+
});
|
|
9327
|
+
listenerSpan.setStatus({
|
|
9328
|
+
code: SpanStatusCode.ERROR,
|
|
9329
|
+
message: "Missing actor."
|
|
9330
|
+
});
|
|
9331
|
+
recordInboxActivity(this.meterProvider, "rejected", activityType);
|
|
9332
|
+
listenerSpan.end();
|
|
9333
|
+
return;
|
|
9334
|
+
}
|
|
9335
|
+
if (!this.skipSignatureVerification && activity.id != null && !actorsHaveSameOrigin(activity)) {
|
|
9336
|
+
logger.error("The queued activity ({activityId}) and its actors do not have the same origin.", {
|
|
9337
|
+
activityId: activity.id.href,
|
|
9338
|
+
actorIds: activity.actorIds.map((actor) => actor.href),
|
|
9339
|
+
activity: message.activity,
|
|
9340
|
+
recipient: message.identifier
|
|
9341
|
+
});
|
|
9342
|
+
listenerSpan.setStatus({
|
|
9343
|
+
code: SpanStatusCode.ERROR,
|
|
9344
|
+
message: `The activity (${activity.id.href}) and its actors do not have the same origin.`
|
|
9345
|
+
});
|
|
9346
|
+
recordInboxActivity(this.meterProvider, "rejected", activityType);
|
|
9347
|
+
listenerSpan.end();
|
|
9348
|
+
return;
|
|
9349
|
+
}
|
|
9263
9350
|
cacheKey = activity.id == null ? null : [
|
|
9264
9351
|
...this.kvPrefixes.activityIdempotence,
|
|
9265
9352
|
context.origin,
|
|
@@ -11336,6 +11423,20 @@ var ContextImpl = class ContextImpl {
|
|
|
11336
11423
|
recipient,
|
|
11337
11424
|
activity: json
|
|
11338
11425
|
});
|
|
11426
|
+
if (activity.actorId == null) {
|
|
11427
|
+
logger.debug("Activity is missing an actor; unable to verify.", {
|
|
11428
|
+
recipient,
|
|
11429
|
+
activity: json
|
|
11430
|
+
});
|
|
11431
|
+
return false;
|
|
11432
|
+
}
|
|
11433
|
+
if (activity.id != null && !actorsHaveSameOrigin(activity)) {
|
|
11434
|
+
logger.debug("Activity has actors from different origins; unable to verify.", {
|
|
11435
|
+
recipient,
|
|
11436
|
+
activity: json
|
|
11437
|
+
});
|
|
11438
|
+
return false;
|
|
11439
|
+
}
|
|
11339
11440
|
const routeResult = await routeActivity({
|
|
11340
11441
|
context: this,
|
|
11341
11442
|
json,
|
|
@@ -4,27 +4,28 @@ globalThis.addEventListener = () => {};
|
|
|
4
4
|
import { d as isPortableUri, f as isSameObjectId, i as getPortableDid, l as isPortableId, n as getCanonicalPortableId, o as hasPortableActor, r as getGatewayKeyBase, s as isCompatibleKeyId, t as getAuthenticationOrigin, u as isPortableKeyId } from "./portable-key-id-Ca30-hOa.mjs";
|
|
5
5
|
import { n as isPubliclyAddressedNode, t as isInAudience } from "./audience-CHQ-FlLD.mjs";
|
|
6
6
|
import { a as verificationObservation, r as snapshotKey, t as observeAttempt } from "./verification-Dpfcw8ml.mjs";
|
|
7
|
-
import { n as version, t as name } from "./deno-
|
|
8
|
-
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-
|
|
7
|
+
import { n as version, t as name } from "./deno-CO1X_K_q.mjs";
|
|
8
|
+
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-BguhdXt-.mjs";
|
|
9
9
|
import { t as formatAcceptSignature } from "./accept-CPVqki78.mjs";
|
|
10
|
-
import { T as validateCryptoKey, _ 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, w as importJwk, y as exportJwk } from "./ld-
|
|
10
|
+
import { T as validateCryptoKey, _ 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, w as importJwk, y as exportJwk } from "./ld-Cy86r-Ty.mjs";
|
|
11
11
|
import { r as normalizeOutgoingActivityJsonLd } from "./outgoing-jsonld-4IJqPYos.mjs";
|
|
12
|
-
import { a as signObject, c as verifyPortableObjectProof, i as hasProofLike, s as verifyObject, t as InvalidPortableObjectIdError, u as verifyPortableObjectProofWithRoot } from "./proof-
|
|
13
|
-
import { a as listRequestSignatures, c as selectRequestSignature, d as validateMaxSignatures, f as verifyRequest, p as verifyRequestDetailed, s as parseRfc9421SignatureInput } from "./http-
|
|
14
|
-
import { t as getAuthenticatedDocumentLoader } from "./docloader-
|
|
15
|
-
import { n as kvCache } from "./kv-cache-
|
|
12
|
+
import { a as signObject, c as verifyPortableObjectProof, i as hasProofLike, s as verifyObject, t as InvalidPortableObjectIdError, u as verifyPortableObjectProofWithRoot } from "./proof-kJtQ49gr.mjs";
|
|
13
|
+
import { a as listRequestSignatures, c as selectRequestSignature, d as validateMaxSignatures, f as verifyRequest, p as verifyRequestDetailed, s as parseRfc9421SignatureInput } from "./http-DkLKT8Vp.mjs";
|
|
14
|
+
import { t as getAuthenticatedDocumentLoader } from "./docloader-DFB_TNVp.mjs";
|
|
15
|
+
import { n as kvCache } from "./kv-cache-BxfOpUP9.mjs";
|
|
16
16
|
import { d as readBoundedText, l as BodyTooLargeError, t as getNodeInfo, u as MAX_BODY_SIZE } from "./client-CEnNz8O7.mjs";
|
|
17
17
|
import { t as nodeInfoToJson } from "./types-DE_LV1JB.mjs";
|
|
18
|
-
import { n as getKeyOwner, t as doesActorOwnKey } from "./owner-
|
|
19
|
-
import { t as verifyPortableObject } from "./portable-collection-
|
|
20
|
-
import { a as getOrderingDestination, i as sendActivityThroughGateways, n as extractInboxes, r as sendActivity, t as SendActivityError } from "./send-
|
|
21
|
-
import { n as FederationBuilderImpl, t as ACTOR_ALIAS_PREFIX } from "./builder-
|
|
18
|
+
import { n as getKeyOwner, t as doesActorOwnKey } from "./owner-Dc-Lg_Xn.mjs";
|
|
19
|
+
import { t as verifyPortableObject } from "./portable-collection-DSKqMgvr.mjs";
|
|
20
|
+
import { a as getOrderingDestination, i as sendActivityThroughGateways, n as extractInboxes, r as sendActivity, t as SendActivityError } from "./send-D6hcL5qf.mjs";
|
|
21
|
+
import { n as FederationBuilderImpl, t as ACTOR_ALIAS_PREFIX } from "./builder-DdY0E0w9.mjs";
|
|
22
22
|
import { t as CircuitBreaker } from "./circuit-breaker-XJ53md4S.mjs";
|
|
23
23
|
import { t as buildCollectionSynchronizationHeader } from "./collection-CnnP1UAv.mjs";
|
|
24
|
-
import { a as inspectCompoundPortableObjectApplicability, c as verifyServedPortableObjects, i as findUnsupportedCompoundProofShape, o as verifyCompoundPortableObjectProofs, r as findEmbeddedProofWithoutContext, t as containsCompoundPortableObject } from "./compound-proof-
|
|
25
|
-
import { t as
|
|
24
|
+
import { a as inspectCompoundPortableObjectApplicability, c as verifyServedPortableObjects, i as findUnsupportedCompoundProofShape, o as verifyCompoundPortableObjectProofs, r as findEmbeddedProofWithoutContext, t as containsCompoundPortableObject } from "./compound-proof-fxkyiXYM.mjs";
|
|
25
|
+
import { n as routeActivity, t as actorsHaveSameOrigin } from "./inbox-Di1-EKqa.mjs";
|
|
26
|
+
import { t as KvKeyCache } from "./keycache-N2opu4-3.mjs";
|
|
26
27
|
import { t as acceptsJsonLd } from "./negotiation-CCocWT_N.mjs";
|
|
27
|
-
import { t as hasMalformedKnownTemporalLiteral } from "./temporal-
|
|
28
|
+
import { t as hasMalformedKnownTemporalLiteral } from "./temporal-C8WqyM34.mjs";
|
|
28
29
|
import { t as createExponentialBackoffPolicy } from "./retry-zX5xw5e0.mjs";
|
|
29
30
|
import { t as TaskCodec } from "./codec-C6rTrpIp.mjs";
|
|
30
31
|
import { getLogger, withContext } from "@logtape/logtape";
|
|
@@ -638,164 +639,6 @@ function visitJsonMaps(json, visit) {
|
|
|
638
639
|
}
|
|
639
640
|
}
|
|
640
641
|
//#endregion
|
|
641
|
-
//#region src/federation/inbox.ts
|
|
642
|
-
async function routeActivity({ context: ctx, json, originalJson, normalizedActivity, ldSignatureVerified, activity, recipient, inboxListeners, inboxContextFactory, listenerInboxContextFactory, inboxErrorHandler, kv, kvPrefixes, queue, span, meterProvider, tracerProvider, idempotencyStrategy }) {
|
|
643
|
-
const logger = getLogger([
|
|
644
|
-
"fedify",
|
|
645
|
-
"federation",
|
|
646
|
-
"inbox"
|
|
647
|
-
]);
|
|
648
|
-
let cacheKey = null;
|
|
649
|
-
if (activity.id != null) {
|
|
650
|
-
const inboxContext = inboxContextFactory(recipient, json, activity.id?.href, getTypeId(activity).href);
|
|
651
|
-
const strategy = idempotencyStrategy ?? "per-inbox";
|
|
652
|
-
let keyString;
|
|
653
|
-
if (typeof strategy === "function") keyString = await strategy(inboxContext, activity);
|
|
654
|
-
else switch (strategy) {
|
|
655
|
-
case "global":
|
|
656
|
-
keyString = activity.id.href;
|
|
657
|
-
break;
|
|
658
|
-
case "per-origin":
|
|
659
|
-
keyString = `${ctx.origin}\n${activity.id.href}`;
|
|
660
|
-
break;
|
|
661
|
-
case "per-inbox":
|
|
662
|
-
keyString = `${ctx.origin}\n${activity.id.href}\n${recipient == null ? "sharedInbox" : `inbox\n${recipient}`}`;
|
|
663
|
-
break;
|
|
664
|
-
default: keyString = `${ctx.origin}\n${activity.id.href}`;
|
|
665
|
-
}
|
|
666
|
-
if (keyString != null) cacheKey = [...kvPrefixes.activityIdempotence, keyString];
|
|
667
|
-
}
|
|
668
|
-
if (cacheKey != null) {
|
|
669
|
-
if (await kv.get(cacheKey) === true) {
|
|
670
|
-
logger.debug("Activity {activityId} has already been processed.", {
|
|
671
|
-
activityId: activity.id?.href,
|
|
672
|
-
activity: json,
|
|
673
|
-
recipient
|
|
674
|
-
});
|
|
675
|
-
span.setStatus({
|
|
676
|
-
code: SpanStatusCode.UNSET,
|
|
677
|
-
message: `Activity ${activity.id?.href} has already been processed.`
|
|
678
|
-
});
|
|
679
|
-
recordInboxActivity(meterProvider, "rejected", getTypeId(activity).href);
|
|
680
|
-
return "alreadyProcessed";
|
|
681
|
-
}
|
|
682
|
-
}
|
|
683
|
-
if (activity.actorId == null) {
|
|
684
|
-
logger.error("Missing actor.", { activity: json });
|
|
685
|
-
span.setStatus({
|
|
686
|
-
code: SpanStatusCode.ERROR,
|
|
687
|
-
message: "Missing actor."
|
|
688
|
-
});
|
|
689
|
-
recordInboxActivity(meterProvider, "rejected", getTypeId(activity).href);
|
|
690
|
-
return "missingActor";
|
|
691
|
-
}
|
|
692
|
-
span.setAttribute("activitypub.actor.id", activity.actorId.href);
|
|
693
|
-
if (queue != null) {
|
|
694
|
-
const carrier = {};
|
|
695
|
-
propagation.inject(context.active(), carrier);
|
|
696
|
-
try {
|
|
697
|
-
await queue.enqueue({
|
|
698
|
-
type: "inbox",
|
|
699
|
-
id: crypto.randomUUID(),
|
|
700
|
-
baseUrl: ctx.origin,
|
|
701
|
-
activity: originalJson ?? json,
|
|
702
|
-
...normalizedActivity == null ? {} : { normalizedActivity },
|
|
703
|
-
...ldSignatureVerified == null ? {} : { ldSignatureVerified },
|
|
704
|
-
identifier: recipient,
|
|
705
|
-
attempt: 0,
|
|
706
|
-
started: (/* @__PURE__ */ new Date()).toISOString(),
|
|
707
|
-
traceContext: carrier
|
|
708
|
-
});
|
|
709
|
-
} catch (error) {
|
|
710
|
-
logger.error("Failed to enqueue the incoming activity {activityId}:\n{error}", {
|
|
711
|
-
error,
|
|
712
|
-
activityId: activity.id?.href,
|
|
713
|
-
activity: json,
|
|
714
|
-
recipient
|
|
715
|
-
});
|
|
716
|
-
span.setStatus({
|
|
717
|
-
code: SpanStatusCode.ERROR,
|
|
718
|
-
message: `Failed to enqueue the incoming activity ${activity.id?.href}.`
|
|
719
|
-
});
|
|
720
|
-
throw error;
|
|
721
|
-
}
|
|
722
|
-
getFederationMetrics(meterProvider).recordQueueTaskEnqueued({
|
|
723
|
-
role: "inbox",
|
|
724
|
-
queue,
|
|
725
|
-
activityType: getTypeId(activity).href
|
|
726
|
-
}, 0);
|
|
727
|
-
recordInboxActivity(meterProvider, "queued", getTypeId(activity).href);
|
|
728
|
-
logger.info("Activity {activityId} is enqueued.", {
|
|
729
|
-
activityId: activity.id?.href,
|
|
730
|
-
activity: json,
|
|
731
|
-
recipient
|
|
732
|
-
});
|
|
733
|
-
return "enqueued";
|
|
734
|
-
}
|
|
735
|
-
tracerProvider = tracerProvider ?? trace.getTracerProvider();
|
|
736
|
-
return await tracerProvider.getTracer(name, version).startActiveSpan("activitypub.dispatch_inbox_listener", { kind: SpanKind.INTERNAL }, async (span) => {
|
|
737
|
-
const dispatched = inboxListeners?.dispatchWithClass(activity);
|
|
738
|
-
if (dispatched == null) {
|
|
739
|
-
logger.error("Unsupported activity type:\n{activity}", {
|
|
740
|
-
activity: json,
|
|
741
|
-
recipient
|
|
742
|
-
});
|
|
743
|
-
span.setStatus({
|
|
744
|
-
code: SpanStatusCode.UNSET,
|
|
745
|
-
message: `Unsupported activity type: ${getTypeId(activity).href}`
|
|
746
|
-
});
|
|
747
|
-
recordInboxActivity(meterProvider, "rejected", getTypeId(activity).href);
|
|
748
|
-
span.end();
|
|
749
|
-
return "unsupportedActivity";
|
|
750
|
-
}
|
|
751
|
-
const { class: cls, listener } = dispatched;
|
|
752
|
-
span.updateName(`activitypub.dispatch_inbox_listener ${cls.name}`);
|
|
753
|
-
try {
|
|
754
|
-
const activityType = getTypeId(activity).href;
|
|
755
|
-
const started = performance.now();
|
|
756
|
-
try {
|
|
757
|
-
const contextFactory = listenerInboxContextFactory ?? inboxContextFactory;
|
|
758
|
-
await listener(contextFactory(recipient, contextFactory === inboxContextFactory ? json : originalJson ?? json, activity.id?.href, activityType), activity);
|
|
759
|
-
} finally {
|
|
760
|
-
getFederationMetrics(meterProvider).recordInboxProcessingDuration(activityType, getDurationMs(started));
|
|
761
|
-
}
|
|
762
|
-
} catch (error) {
|
|
763
|
-
try {
|
|
764
|
-
await inboxErrorHandler?.(ctx, error);
|
|
765
|
-
} catch (error) {
|
|
766
|
-
logger.error("An unexpected error occurred in inbox error handler:\n{error}", {
|
|
767
|
-
error,
|
|
768
|
-
activityId: activity.id?.href,
|
|
769
|
-
activity: json,
|
|
770
|
-
recipient
|
|
771
|
-
});
|
|
772
|
-
}
|
|
773
|
-
logger.error("Failed to process the incoming activity {activityId}:\n{error}", {
|
|
774
|
-
error,
|
|
775
|
-
activityId: activity.id?.href,
|
|
776
|
-
activity: json,
|
|
777
|
-
recipient
|
|
778
|
-
});
|
|
779
|
-
span.setStatus({
|
|
780
|
-
code: SpanStatusCode.ERROR,
|
|
781
|
-
message: String(error)
|
|
782
|
-
});
|
|
783
|
-
recordInboxActivity(meterProvider, "rejected", getTypeId(activity).href);
|
|
784
|
-
span.end();
|
|
785
|
-
return "error";
|
|
786
|
-
}
|
|
787
|
-
recordInboxActivity(meterProvider, "processed", getTypeId(activity).href);
|
|
788
|
-
if (cacheKey != null) await kv.set(cacheKey, true, { ttl: Temporal.Duration.from({ days: 1 }) });
|
|
789
|
-
logger.info("Activity {activityId} has been processed.", {
|
|
790
|
-
activityId: activity.id?.href,
|
|
791
|
-
activity: json,
|
|
792
|
-
recipient
|
|
793
|
-
});
|
|
794
|
-
span.end();
|
|
795
|
-
return "success";
|
|
796
|
-
});
|
|
797
|
-
}
|
|
798
|
-
//#endregion
|
|
799
642
|
//#region src/federation/portable.ts
|
|
800
643
|
/**
|
|
801
644
|
* The media type that FEP-ef61 gateways must use for portable objects.
|
|
@@ -1725,13 +1568,13 @@ function recordCollectionMetrics(meterProvider, base, result, options = {}) {
|
|
|
1725
1568
|
* @param parameters The parameters for handling the collection.
|
|
1726
1569
|
* @returns A promise that resolves to an HTTP response.
|
|
1727
1570
|
*/
|
|
1728
|
-
async function handleCollection(request, { name: name$
|
|
1729
|
-
const spanName = name$
|
|
1571
|
+
async function handleCollection(request, { name: name$1, identifier, uriGetter, filter, filterPredicate, context, collectionCallbacks, portable, tracerProvider, meterProvider, onUnauthorized, onNotFound }) {
|
|
1572
|
+
const spanName = name$1.trim().replace(/\s+/g, "_");
|
|
1730
1573
|
tracerProvider = tracerProvider ?? trace.getTracerProvider();
|
|
1731
1574
|
const tracer = tracerProvider.getTracer(name, version);
|
|
1732
1575
|
const cursor = new URL(request.url).searchParams.get("cursor");
|
|
1733
1576
|
const metricBase = {
|
|
1734
|
-
kind: getCollectionMetricKind(name$
|
|
1577
|
+
kind: getCollectionMetricKind(name$1),
|
|
1735
1578
|
page: cursor != null,
|
|
1736
1579
|
dispatcher: "built_in"
|
|
1737
1580
|
};
|
|
@@ -1777,7 +1620,7 @@ async function handleCollection(request, { name: name$2, identifier, uriGetter,
|
|
|
1777
1620
|
span.setStatus({ code: SpanStatusCode.ERROR });
|
|
1778
1621
|
return await onNotFound(request);
|
|
1779
1622
|
}
|
|
1780
|
-
const items = filterCollectionItems(page.items, name$
|
|
1623
|
+
const items = filterCollectionItems(page.items, name$1, filterPredicate);
|
|
1781
1624
|
itemCount = items.length;
|
|
1782
1625
|
span.setAttribute("fedify.collection.items", itemCount);
|
|
1783
1626
|
return items;
|
|
@@ -1819,7 +1662,7 @@ async function handleCollection(request, { name: name$2, identifier, uriGetter,
|
|
|
1819
1662
|
} else {
|
|
1820
1663
|
const uri = new URL(portable == null ? baseUri : pageBase);
|
|
1821
1664
|
uri.searchParams.set("cursor", cursor);
|
|
1822
|
-
const pageOrResponse = await tracer.startActiveSpan(`activitypub.dispatch_collection_page ${name$
|
|
1665
|
+
const pageOrResponse = await tracer.startActiveSpan(`activitypub.dispatch_collection_page ${name$1}`, {
|
|
1823
1666
|
kind: SpanKind.SERVER,
|
|
1824
1667
|
attributes: {
|
|
1825
1668
|
"activitypub.collection.id": uri.href,
|
|
@@ -1835,7 +1678,7 @@ async function handleCollection(request, { name: name$2, identifier, uriGetter,
|
|
|
1835
1678
|
span.setStatus({ code: SpanStatusCode.ERROR });
|
|
1836
1679
|
return await onNotFound(request);
|
|
1837
1680
|
}
|
|
1838
|
-
const items = filterCollectionItems(page.items, name$
|
|
1681
|
+
const items = filterCollectionItems(page.items, name$1, filterPredicate);
|
|
1839
1682
|
itemCount = items.length;
|
|
1840
1683
|
span.setAttribute("fedify.collection.items", itemCount);
|
|
1841
1684
|
return {
|
|
@@ -2984,11 +2827,49 @@ async function handleInboxInternal(request, parameters, span) {
|
|
|
2984
2827
|
return await getFailedSignatureResponse(inboxChallengePolicy, kv, kvPrefixes);
|
|
2985
2828
|
}
|
|
2986
2829
|
}
|
|
2830
|
+
if (!skipSignatureVerification && activity.id != null && !actorsHaveSameOrigin(activity)) {
|
|
2831
|
+
observation.authentication = {
|
|
2832
|
+
status: "rejected",
|
|
2833
|
+
reason: { type: "verificationFailed" }
|
|
2834
|
+
};
|
|
2835
|
+
logger.error("The activity ({activityId}) and its actors do not have the same origin.", {
|
|
2836
|
+
activity: json,
|
|
2837
|
+
recipient,
|
|
2838
|
+
activityId: activity.id.href,
|
|
2839
|
+
actorIds: activity.actorIds.map((actor) => actor.href)
|
|
2840
|
+
});
|
|
2841
|
+
span.setStatus({
|
|
2842
|
+
code: SpanStatusCode.ERROR,
|
|
2843
|
+
message: `The activity (${activity.id.href}) and its actors do not have the same origin.`
|
|
2844
|
+
});
|
|
2845
|
+
return new Response("The activity and its actors do not have the same origin.", {
|
|
2846
|
+
status: 401,
|
|
2847
|
+
headers: { "Content-Type": "text/plain; charset=utf-8" }
|
|
2848
|
+
});
|
|
2849
|
+
}
|
|
2987
2850
|
observation.authentication = skipSignatureVerification ? { status: "skipped" } : {
|
|
2988
2851
|
status: "verified",
|
|
2989
2852
|
attempts: observation.verification.attempts.filter((attempt) => attempt.status === "verified")
|
|
2990
2853
|
};
|
|
2991
2854
|
observation.stage = "dispatch";
|
|
2855
|
+
if (activity.actorId == null) {
|
|
2856
|
+
observation.result = {
|
|
2857
|
+
disposition: "rejected",
|
|
2858
|
+
reason: "missingActor"
|
|
2859
|
+
};
|
|
2860
|
+
logger.error("Missing actor.", {
|
|
2861
|
+
activity: json,
|
|
2862
|
+
recipient
|
|
2863
|
+
});
|
|
2864
|
+
span.setStatus({
|
|
2865
|
+
code: SpanStatusCode.ERROR,
|
|
2866
|
+
message: "Missing actor."
|
|
2867
|
+
});
|
|
2868
|
+
return new Response("Missing actor.", {
|
|
2869
|
+
status: 400,
|
|
2870
|
+
headers: { "Content-Type": "text/plain; charset=utf-8" }
|
|
2871
|
+
});
|
|
2872
|
+
}
|
|
2992
2873
|
const routeResult = await routeActivity({
|
|
2993
2874
|
context: ctx,
|
|
2994
2875
|
json,
|
|
@@ -3209,8 +3090,8 @@ var CustomCollectionHandler = class {
|
|
|
3209
3090
|
* @param CollectionPage The CollectionPage constructor.
|
|
3210
3091
|
* @param filterPredicate Optional filter predicate for items.
|
|
3211
3092
|
*/
|
|
3212
|
-
constructor(name$
|
|
3213
|
-
this.name = name$
|
|
3093
|
+
constructor(name$2, values, context, callbacks, tracerProvider = trace.getTracerProvider(), meterProvider, Collection, CollectionPage, filterPredicate, portable) {
|
|
3094
|
+
this.name = name$2;
|
|
3214
3095
|
this.values = values;
|
|
3215
3096
|
this.context = context;
|
|
3216
3097
|
this.callbacks = callbacks;
|
|
@@ -5836,6 +5717,35 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
5836
5717
|
span.setAttribute("activitypub.activity.id", activity.id.href);
|
|
5837
5718
|
listenerSpan.setAttribute("activitypub.activity.id", activity.id.href);
|
|
5838
5719
|
}
|
|
5720
|
+
if (activity.actorId == null) {
|
|
5721
|
+
logger.error("Missing actor in queued incoming activity.", {
|
|
5722
|
+
activityId: activity.id?.href,
|
|
5723
|
+
activity: message.activity,
|
|
5724
|
+
recipient: message.identifier
|
|
5725
|
+
});
|
|
5726
|
+
listenerSpan.setStatus({
|
|
5727
|
+
code: SpanStatusCode.ERROR,
|
|
5728
|
+
message: "Missing actor."
|
|
5729
|
+
});
|
|
5730
|
+
recordInboxActivity(this.meterProvider, "rejected", activityType);
|
|
5731
|
+
listenerSpan.end();
|
|
5732
|
+
return;
|
|
5733
|
+
}
|
|
5734
|
+
if (!this.skipSignatureVerification && activity.id != null && !actorsHaveSameOrigin(activity)) {
|
|
5735
|
+
logger.error("The queued activity ({activityId}) and its actors do not have the same origin.", {
|
|
5736
|
+
activityId: activity.id.href,
|
|
5737
|
+
actorIds: activity.actorIds.map((actor) => actor.href),
|
|
5738
|
+
activity: message.activity,
|
|
5739
|
+
recipient: message.identifier
|
|
5740
|
+
});
|
|
5741
|
+
listenerSpan.setStatus({
|
|
5742
|
+
code: SpanStatusCode.ERROR,
|
|
5743
|
+
message: `The activity (${activity.id.href}) and its actors do not have the same origin.`
|
|
5744
|
+
});
|
|
5745
|
+
recordInboxActivity(this.meterProvider, "rejected", activityType);
|
|
5746
|
+
listenerSpan.end();
|
|
5747
|
+
return;
|
|
5748
|
+
}
|
|
5839
5749
|
cacheKey = activity.id == null ? null : [
|
|
5840
5750
|
...this.kvPrefixes.activityIdempotence,
|
|
5841
5751
|
context.origin,
|
|
@@ -7912,6 +7822,20 @@ var ContextImpl = class ContextImpl {
|
|
|
7912
7822
|
recipient,
|
|
7913
7823
|
activity: json
|
|
7914
7824
|
});
|
|
7825
|
+
if (activity.actorId == null) {
|
|
7826
|
+
logger.debug("Activity is missing an actor; unable to verify.", {
|
|
7827
|
+
recipient,
|
|
7828
|
+
activity: json
|
|
7829
|
+
});
|
|
7830
|
+
return false;
|
|
7831
|
+
}
|
|
7832
|
+
if (activity.id != null && !actorsHaveSameOrigin(activity)) {
|
|
7833
|
+
logger.debug("Activity has actors from different origins; unable to verify.", {
|
|
7834
|
+
recipient,
|
|
7835
|
+
activity: json
|
|
7836
|
+
});
|
|
7837
|
+
return false;
|
|
7838
|
+
}
|
|
7915
7839
|
const routeResult = await routeActivity({
|
|
7916
7840
|
context: this,
|
|
7917
7841
|
json,
|
package/dist/mod.cjs
CHANGED
|
@@ -3,11 +3,11 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
require("./rolldown-runtime-Dmm3t92W.cjs");
|
|
4
4
|
const require_transformers = require("./transformers-BalCrSsr.cjs");
|
|
5
5
|
require("./compat/mod.cjs");
|
|
6
|
-
const require_http = require("./http-
|
|
7
|
-
const require_federation = require("./federation-
|
|
6
|
+
const require_http = require("./http-g5f1D2tm.cjs");
|
|
7
|
+
const require_federation = require("./federation-Bf4FEork.cjs");
|
|
8
8
|
const require_types = require("./types-poIao40f.cjs");
|
|
9
|
-
const require_portable_collection = require("./portable-collection-
|
|
10
|
-
const require_kv_cache = require("./kv-cache-
|
|
9
|
+
const require_portable_collection = require("./portable-collection-Bl2UkqcO.cjs");
|
|
10
|
+
const require_kv_cache = require("./kv-cache-HsXADkl9.cjs");
|
|
11
11
|
require("./nodeinfo/mod.cjs");
|
|
12
12
|
require("./runtime/mod.cjs");
|
|
13
13
|
require("./sig/mod.cjs");
|
package/dist/mod.js
CHANGED
|
@@ -3,11 +3,11 @@ import { URLPattern } from "urlpattern-polyfill";
|
|
|
3
3
|
import "./rolldown-runtime-BC-Eo5Mj.js";
|
|
4
4
|
import { n as autoIdAssigner, r as getDefaultActivityTransformers, t as actorDehydrator } from "./transformers-DAtXl_Kc.js";
|
|
5
5
|
import "./compat/mod.js";
|
|
6
|
-
import { D as createSignature, H as fetchKeyDetailed, I as verifyJsonLd, L as verifySignature, O as detachSignature, P as signJsonLd, T as attachSignature, U as generateCryptoKeyPair, V as fetchKey, W as importJwk, _ as verifyObject, _t as validateAcceptSignature, a as signRequest, c as verifyRequestDetailed, gt as parseAcceptSignature, h as signObject, ht as fulfillAcceptSignature, j as hasSignatureLike, m as hasProofLike, mt as formatAcceptSignature, p as createProof, s as verifyRequest, v as verifyPortableObjectProof, x as verifyProof, z as exportJwk } from "./http-
|
|
7
|
-
import { a as respondWithObjectIfAcceptable, c as digest, d as parseCircuitBreakerKvState, f as createFederationBuilder, i as respondWithObject, l as CircuitBreaker, n as handleWebFinger, o as SendActivityError, r as createExponentialBackoffPolicy, s as buildCollectionSynchronizationHeader, t as createFederation, u as normalizeCircuitBreakerOptions } from "./middleware-
|
|
6
|
+
import { D as createSignature, H as fetchKeyDetailed, I as verifyJsonLd, L as verifySignature, O as detachSignature, P as signJsonLd, T as attachSignature, U as generateCryptoKeyPair, V as fetchKey, W as importJwk, _ as verifyObject, _t as validateAcceptSignature, a as signRequest, c as verifyRequestDetailed, gt as parseAcceptSignature, h as signObject, ht as fulfillAcceptSignature, j as hasSignatureLike, m as hasProofLike, mt as formatAcceptSignature, p as createProof, s as verifyRequest, v as verifyPortableObjectProof, x as verifyProof, z as exportJwk } from "./http-D_AGUmSq.js";
|
|
7
|
+
import { a as respondWithObjectIfAcceptable, c as digest, d as parseCircuitBreakerKvState, f as createFederationBuilder, i as respondWithObject, l as CircuitBreaker, n as handleWebFinger, o as SendActivityError, r as createExponentialBackoffPolicy, s as buildCollectionSynchronizationHeader, t as createFederation, u as normalizeCircuitBreakerOptions } from "./middleware-BOBF7req.js";
|
|
8
8
|
import { n as getNodeInfo, r as parseNodeInfo, t as nodeInfoToJson } from "./types-_S2_MeLF.js";
|
|
9
|
-
import { n as doesActorOwnKey, r as getKeyOwner, t as verifyPortableObject } from "./portable-collection-
|
|
10
|
-
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-
|
|
9
|
+
import { n as doesActorOwnKey, r as getKeyOwner, t as verifyPortableObject } from "./portable-collection-CjdP7fQ4.js";
|
|
10
|
+
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-C0AsMZ4U.js";
|
|
11
11
|
import { InProcessMessageQueue, MemoryKvStore, ParallelMessageQueue, Router, RouterError } from "./federation/mod.js";
|
|
12
12
|
import "./nodeinfo/mod.js";
|
|
13
13
|
import "./runtime/mod.js";
|