@fedify/fedify 2.0.33-dev.2413 → 2.0.33-dev.2414
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/{assert_rejects-B-qJtC9Z.mjs → assert_rejects-WyYSTDDX.mjs} +2 -20
- package/dist/{assert_throws-4NwKEy2q.mjs → assert_throws-D4DNWrux.mjs} +19 -1
- package/dist/{builder-DEj2UtTo.mjs → builder-oPN-KAgG.mjs} +3 -3
- package/dist/compat/transformers.test.mjs +1 -1
- package/dist/{deno-1poG3nVL.mjs → deno-v7kfTDw9.mjs} +1 -1
- package/dist/{docloader-DHhMJMBx.mjs → docloader-C40rdqSR.mjs} +2 -2
- package/dist/federation/builder.test.mjs +3 -3
- package/dist/federation/collection.test.mjs +1 -1
- package/dist/federation/handler.test.mjs +258 -9
- package/dist/federation/idempotency.test.mjs +3 -3
- package/dist/federation/inbox.test.mjs +25 -2
- package/dist/federation/kv.test.mjs +1 -1
- package/dist/federation/middleware.test.mjs +128 -10
- package/dist/federation/mod.cjs +1 -1
- package/dist/federation/mod.js +1 -1
- package/dist/federation/mq.test.mjs +2 -2
- package/dist/federation/negotiation.test.mjs +2 -2
- package/dist/federation/retry.test.mjs +1 -1
- package/dist/federation/router.test.mjs +2 -3
- package/dist/federation/send.test.mjs +7 -6
- package/dist/federation/temporal.test.mjs +3 -3
- package/dist/federation/webfinger.test.mjs +2 -2
- package/dist/{http-C8SYUIha.mjs → http-BRdkmpRl.mjs} +2 -2
- package/dist/{http-0H3c-FW0.cjs → http-CytEl2_x.cjs} +1 -1
- package/dist/{http-DaS2vnNk.js → http-i02DDItX.js} +1 -1
- package/dist/{inbox-DvbsFXWB.mjs → inbox-Bj-VABWa.mjs} +23 -10
- package/dist/{key-CDuFq0mQ.mjs → key-qe6uT5ER.mjs} +1 -1
- package/dist/{kv-cache-BNiY7ea-.cjs → kv-cache-CCCwr3Y2.cjs} +1 -1
- package/dist/{kv-cache-B7T3rhpo.js → kv-cache-DT2Fk4wy.js} +1 -1
- package/dist/{ld-5AEMxXBH.mjs → ld-gf5riP2W.mjs} +2 -2
- package/dist/{middleware-CKBMWB3q.cjs → middleware-BDniN395.cjs} +1 -1
- package/dist/{middleware-DlYK6kvo.cjs → middleware-C_ybJNaa.cjs} +103 -33
- package/dist/{middleware-NUR07Wjx.mjs → middleware-GCF6LA-a.mjs} +1 -1
- package/dist/{middleware-Cm5Kx7Nr.mjs → middleware-a9um4sWr.mjs} +89 -32
- package/dist/{middleware-B4GK0_I-.js → middleware-rrNFt8Ia.js} +102 -32
- package/dist/mod.cjs +4 -4
- package/dist/mod.js +4 -4
- package/dist/nodeinfo/client.test.mjs +1 -1
- package/dist/nodeinfo/handler.test.mjs +2 -2
- package/dist/nodeinfo/types.test.mjs +2 -2
- package/dist/otel/exporter.test.mjs +1 -1
- package/dist/{owner-BUnSHtD3.mjs → owner-DRXYR3jY.mjs} +2 -2
- package/dist/{proof-Bg4dnzAo.cjs → proof-BS0ckB77.cjs} +1 -1
- package/dist/{proof-nfrx8WZI.mjs → proof-DYP1abqL.mjs} +2 -2
- package/dist/{proof-BPWRZzc2.js → proof-PVc8vCvO.js} +1 -1
- package/dist/{send-BVjpjEY-.mjs → send-CVlj4zuA.mjs} +2 -2
- package/dist/sig/http.test.mjs +5 -5
- package/dist/sig/key.test.mjs +5 -5
- package/dist/sig/ld.test.mjs +4 -4
- package/dist/sig/mod.cjs +2 -2
- package/dist/sig/mod.js +2 -2
- package/dist/sig/owner.test.mjs +3 -3
- package/dist/sig/proof.test.mjs +3 -3
- package/dist/{std__assert-BUOJXi-Z.mjs → std__assert-DflMZha5.mjs} +2 -2
- package/dist/{temporal-D58JcKAc.mjs → temporal-BwiXwu1s.mjs} +1 -1
- package/dist/utils/docloader.test.mjs +4 -4
- package/dist/utils/mod.cjs +1 -1
- package/dist/utils/mod.js +1 -1
- package/package.json +5 -5
- /package/dist/{assert_not_equals--wG9hV7u.mjs → assert_not_equals-BkxW5QJI.mjs} +0 -0
|
@@ -2,8 +2,8 @@ import { Temporal } from "@js-temporal/polyfill";
|
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
4
|
import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
|
|
5
|
-
import { r as assertGreaterOrEqual } from "../std__assert-
|
|
6
|
-
import {
|
|
5
|
+
import { r as assertGreaterOrEqual } from "../std__assert-DflMZha5.mjs";
|
|
6
|
+
import { r as assertFalse } from "../assert_throws-D4DNWrux.mjs";
|
|
7
7
|
import { t as assert } from "../assert-BhQd8QHP.mjs";
|
|
8
8
|
import { test } from "@fedify/fixture";
|
|
9
9
|
import { delay } from "es-toolkit";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "@js-temporal/polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import "../std__assert-
|
|
5
|
-
import {
|
|
4
|
+
import "../std__assert-DflMZha5.mjs";
|
|
5
|
+
import { r as assertFalse } from "../assert_throws-D4DNWrux.mjs";
|
|
6
6
|
import { t as assert } from "../assert-BhQd8QHP.mjs";
|
|
7
7
|
import { t as acceptsJsonLd } from "../negotiation-TWEs6Cl8.mjs";
|
|
8
8
|
import { test } from "@fedify/fixture";
|
|
@@ -2,7 +2,7 @@ import { Temporal } from "@js-temporal/polyfill";
|
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
4
|
import { l as AssertionError, t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
|
|
5
|
-
import { t as assertNotEquals } from "../assert_not_equals
|
|
5
|
+
import { t as assertNotEquals } from "../assert_not_equals-BkxW5QJI.mjs";
|
|
6
6
|
import { t as createExponentialBackoffPolicy } from "../retry-Ddbq3AcK.mjs";
|
|
7
7
|
import { test } from "@fedify/fixture";
|
|
8
8
|
//#region src/federation/retry.test.ts
|
|
@@ -3,10 +3,9 @@ import "urlpattern-polyfill";
|
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
4
|
import { n as RouterError, t as Router } from "../router-CrMLXoOr.mjs";
|
|
5
5
|
import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
|
|
6
|
-
import "../std__assert-
|
|
7
|
-
import {
|
|
6
|
+
import "../std__assert-DflMZha5.mjs";
|
|
7
|
+
import { r as assertFalse, t as assertThrows } from "../assert_throws-D4DNWrux.mjs";
|
|
8
8
|
import { t as assert } from "../assert-BhQd8QHP.mjs";
|
|
9
|
-
import { t as assertThrows } from "../assert_throws-4NwKEy2q.mjs";
|
|
10
9
|
import { test } from "@fedify/fixture";
|
|
11
10
|
//#region src/federation/router.test.ts
|
|
12
11
|
function setUp(options = {}) {
|
|
@@ -3,14 +3,15 @@ import "urlpattern-polyfill";
|
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
4
|
import { t as esm_default } from "../esm-DVILvP5e.mjs";
|
|
5
5
|
import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
|
|
6
|
-
import "../std__assert-
|
|
7
|
-
import {
|
|
6
|
+
import "../std__assert-DflMZha5.mjs";
|
|
7
|
+
import { r as assertFalse } from "../assert_throws-D4DNWrux.mjs";
|
|
8
8
|
import { n as assertInstanceOf, t as assert } from "../assert-BhQd8QHP.mjs";
|
|
9
|
-
import { t as assertNotEquals } from "../assert_not_equals
|
|
10
|
-
import {
|
|
9
|
+
import { t as assertNotEquals } from "../assert_not_equals-BkxW5QJI.mjs";
|
|
10
|
+
import { t as assertRejects } from "../assert_rejects-WyYSTDDX.mjs";
|
|
11
|
+
import { l as verifyRequest } from "../http-BRdkmpRl.mjs";
|
|
11
12
|
import { i as rsaPrivateKey2, n as ed25519PrivateKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-CCxRJhWa.mjs";
|
|
12
|
-
import { t as doesActorOwnKey } from "../owner-
|
|
13
|
-
import { n as extractInboxes, r as sendActivity, t as SendActivityError } from "../send-
|
|
13
|
+
import { t as doesActorOwnKey } from "../owner-DRXYR3jY.mjs";
|
|
14
|
+
import { n as extractInboxes, r as sendActivity, t as SendActivityError } from "../send-CVlj4zuA.mjs";
|
|
14
15
|
import { createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
|
|
15
16
|
import { Activity, Application, Endpoints, Group, Person, Service } from "@fedify/vocab";
|
|
16
17
|
import { FetchError, UrlError } from "@fedify/vocab-runtime";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import "@js-temporal/polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import "../std__assert-
|
|
5
|
-
import {
|
|
4
|
+
import "../std__assert-DflMZha5.mjs";
|
|
5
|
+
import { r as assertFalse } from "../assert_throws-D4DNWrux.mjs";
|
|
6
6
|
import { t as assert } from "../assert-BhQd8QHP.mjs";
|
|
7
|
-
import { t as hasMalformedKnownTemporalLiteral } from "../temporal-
|
|
7
|
+
import { t as hasMalformedKnownTemporalLiteral } from "../temporal-BwiXwu1s.mjs";
|
|
8
8
|
import { test } from "@fedify/fixture";
|
|
9
9
|
//#region src/federation/temporal.test.ts
|
|
10
10
|
test("hasMalformedKnownTemporalLiteral() detects expanded proof timestamps", async () => {
|
|
@@ -3,9 +3,9 @@ import "urlpattern-polyfill";
|
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
4
|
import { n as createRequestContext } from "../context-Juj6bdHC.mjs";
|
|
5
5
|
import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
|
|
6
|
-
import "../std__assert-
|
|
6
|
+
import "../std__assert-DflMZha5.mjs";
|
|
7
7
|
import { t as MemoryKvStore } from "../kv-mI4Ix2EU.mjs";
|
|
8
|
-
import { a as createFederation, o as handleWebFinger } from "../middleware-
|
|
8
|
+
import { a as createFederation, o as handleWebFinger } from "../middleware-a9um4sWr.mjs";
|
|
9
9
|
import { test } from "@fedify/fixture";
|
|
10
10
|
import { Image, Link, Person } from "@fedify/vocab";
|
|
11
11
|
//#region src/federation/webfinger.test.ts
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { n as version, t as name } from "./deno-
|
|
5
|
-
import { o as validateCryptoKey, r as fetchKey } from "./key-
|
|
4
|
+
import { n as version, t as name } from "./deno-v7kfTDw9.mjs";
|
|
5
|
+
import { o as validateCryptoKey, r as fetchKey } from "./key-qe6uT5ER.mjs";
|
|
6
6
|
import { CryptographicKey } from "@fedify/vocab";
|
|
7
7
|
import { SpanStatusCode, trace } from "@opentelemetry/api";
|
|
8
8
|
import { FetchError } from "@fedify/vocab-runtime";
|
|
@@ -11,7 +11,7 @@ let byte_encodings_base64 = require("byte-encodings/base64");
|
|
|
11
11
|
let structured_field_values = require("structured-field-values");
|
|
12
12
|
//#region deno.json
|
|
13
13
|
var name = "@fedify/fedify";
|
|
14
|
-
var version = "2.0.33-dev.
|
|
14
|
+
var version = "2.0.33-dev.2414+98deefa2";
|
|
15
15
|
//#endregion
|
|
16
16
|
//#region src/sig/key.ts
|
|
17
17
|
/** Classifies decoding failures without hiding unexpected loader errors. */
|
|
@@ -10,7 +10,7 @@ import { decodeBase64, encodeBase64 } from "byte-encodings/base64";
|
|
|
10
10
|
import { Item, decodeDict, encodeItem } from "structured-field-values";
|
|
11
11
|
//#region deno.json
|
|
12
12
|
var name = "@fedify/fedify";
|
|
13
|
-
var version = "2.0.33-dev.
|
|
13
|
+
var version = "2.0.33-dev.2414+98deefa2";
|
|
14
14
|
//#endregion
|
|
15
15
|
//#region src/sig/key.ts
|
|
16
16
|
/** Classifies decoding failures without hiding unexpected loader errors. */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { n as version, t as name } from "./deno-
|
|
4
|
+
import { n as version, t as name } from "./deno-v7kfTDw9.mjs";
|
|
5
5
|
import { Activity, getTypeId } from "@fedify/vocab";
|
|
6
6
|
import { SpanKind, SpanStatusCode, context, propagation, trace } from "@opentelemetry/api";
|
|
7
7
|
import { getLogger } from "@logtape/logtape";
|
|
@@ -39,12 +39,33 @@ var InboxListenerSet = class InboxListenerSet {
|
|
|
39
39
|
return this.dispatchWithClass(activity)?.listener ?? null;
|
|
40
40
|
}
|
|
41
41
|
};
|
|
42
|
+
/**
|
|
43
|
+
* Checks whether an activity's ID and all of its actor IDs have the same
|
|
44
|
+
* non-opaque origin. Activities without an ID have no origin to authenticate.
|
|
45
|
+
*
|
|
46
|
+
* The caller is responsible for rejecting a missing primary actor ID before
|
|
47
|
+
* relying on this check.
|
|
48
|
+
* @internal
|
|
49
|
+
*/
|
|
50
|
+
function actorsHaveSameOrigin(activity) {
|
|
51
|
+
if (activity.id == null) return true;
|
|
52
|
+
const origin = activity.id.origin;
|
|
53
|
+
return origin !== "null" && activity.actorIds.every((actor) => actor.origin === origin);
|
|
54
|
+
}
|
|
42
55
|
async function routeActivity({ context: ctx, json, originalJson, normalizedActivity, ldSignatureVerified, activity, recipient, inboxListeners, inboxContextFactory, listenerInboxContextFactory, inboxErrorHandler, kv, kvPrefixes, queue, span, tracerProvider, idempotencyStrategy }) {
|
|
43
56
|
const logger = getLogger([
|
|
44
57
|
"fedify",
|
|
45
58
|
"federation",
|
|
46
59
|
"inbox"
|
|
47
60
|
]);
|
|
61
|
+
if (activity.actorId == null) {
|
|
62
|
+
logger.error("Missing actor.", { activity: json });
|
|
63
|
+
span.setStatus({
|
|
64
|
+
code: SpanStatusCode.ERROR,
|
|
65
|
+
message: "Missing actor."
|
|
66
|
+
});
|
|
67
|
+
return "missingActor";
|
|
68
|
+
}
|
|
48
69
|
let cacheKey = null;
|
|
49
70
|
if (activity.id != null) {
|
|
50
71
|
const inboxContext = inboxContextFactory(recipient, json, activity.id?.href, getTypeId(activity).href);
|
|
@@ -79,14 +100,6 @@ async function routeActivity({ context: ctx, json, originalJson, normalizedActiv
|
|
|
79
100
|
return "alreadyProcessed";
|
|
80
101
|
}
|
|
81
102
|
}
|
|
82
|
-
if (activity.actorId == null) {
|
|
83
|
-
logger.error("Missing actor.", { activity: json });
|
|
84
|
-
span.setStatus({
|
|
85
|
-
code: SpanStatusCode.ERROR,
|
|
86
|
-
message: "Missing actor."
|
|
87
|
-
});
|
|
88
|
-
return "missingActor";
|
|
89
|
-
}
|
|
90
103
|
span.setAttribute("activitypub.actor.id", activity.actorId.href);
|
|
91
104
|
if (queue != null) {
|
|
92
105
|
const carrier = {};
|
|
@@ -179,4 +192,4 @@ async function routeActivity({ context: ctx, json, originalJson, normalizedActiv
|
|
|
179
192
|
});
|
|
180
193
|
}
|
|
181
194
|
//#endregion
|
|
182
|
-
export {
|
|
195
|
+
export { actorsHaveSameOrigin as n, routeActivity as r, InboxListenerSet as t };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "@js-temporal/polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { n as version, t as name } from "./deno-
|
|
4
|
+
import { n as version, t as name } from "./deno-v7kfTDw9.mjs";
|
|
5
5
|
import { CryptographicKey, Object as Object$1, isActor } from "@fedify/vocab";
|
|
6
6
|
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
7
7
|
import { FetchError, UrlError, getDocumentLoader } from "@fedify/vocab-runtime";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const { Temporal } = require("@js-temporal/polyfill");
|
|
2
2
|
const { URLPattern } = require("urlpattern-polyfill");
|
|
3
3
|
require("./chunk-DDcVe30Y.cjs");
|
|
4
|
-
const require_http = require("./http-
|
|
4
|
+
const require_http = require("./http-CytEl2_x.cjs");
|
|
5
5
|
let _logtape_logtape = require("@logtape/logtape");
|
|
6
6
|
let es_toolkit = require("es-toolkit");
|
|
7
7
|
let _fedify_vocab_runtime = require("@fedify/vocab-runtime");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
|
3
|
-
import { l as validateCryptoKey, t as doubleKnock } from "./http-
|
|
3
|
+
import { l as validateCryptoKey, t as doubleKnock } from "./http-i02DDItX.js";
|
|
4
4
|
import { getLogger } from "@logtape/logtape";
|
|
5
5
|
import { curry } from "es-toolkit";
|
|
6
6
|
import { FetchError, UrlError, createActivityPubRequest, getRemoteDocument, logRequest, preloadedContexts, validatePublicUrl } from "@fedify/vocab-runtime";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "@js-temporal/polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { n as version, t as name } from "./deno-
|
|
5
|
-
import { o as validateCryptoKey, r as fetchKey } from "./key-
|
|
4
|
+
import { n as version, t as name } from "./deno-v7kfTDw9.mjs";
|
|
5
|
+
import { o as validateCryptoKey, r as fetchKey } from "./key-qe6uT5ER.mjs";
|
|
6
6
|
import { Activity, CryptographicKey, Object as Object$1, getTypeId } from "@fedify/vocab";
|
|
7
7
|
import { SpanStatusCode, trace } from "@opentelemetry/api";
|
|
8
8
|
import { getDocumentLoader } from "@fedify/vocab-runtime";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
const { Temporal } = require("@js-temporal/polyfill");
|
|
2
2
|
const { URLPattern } = require("urlpattern-polyfill");
|
|
3
|
-
const require_middleware = require("./middleware-
|
|
3
|
+
const require_middleware = require("./middleware-C_ybJNaa.cjs");
|
|
4
4
|
exports.FederationImpl = require_middleware.FederationImpl;
|
|
@@ -2,10 +2,10 @@ const { Temporal } = require("@js-temporal/polyfill");
|
|
|
2
2
|
const { URLPattern } = require("urlpattern-polyfill");
|
|
3
3
|
const require_chunk = require("./chunk-DDcVe30Y.cjs");
|
|
4
4
|
const require_transformers = require("./transformers-NeAONrAq.cjs");
|
|
5
|
-
const require_http = require("./http-
|
|
5
|
+
const require_http = require("./http-CytEl2_x.cjs");
|
|
6
6
|
const require_types = require("./types-DRPjmHVV.cjs");
|
|
7
|
-
const require_proof = require("./proof-
|
|
8
|
-
const require_kv_cache = require("./kv-cache-
|
|
7
|
+
const require_proof = require("./proof-BS0ckB77.cjs");
|
|
8
|
+
const require_kv_cache = require("./kv-cache-CCCwr3Y2.cjs");
|
|
9
9
|
let _logtape_logtape = require("@logtape/logtape");
|
|
10
10
|
let _fedify_vocab = require("@fedify/vocab");
|
|
11
11
|
let _opentelemetry_api = require("@opentelemetry/api");
|
|
@@ -53,12 +53,33 @@ var InboxListenerSet = class InboxListenerSet {
|
|
|
53
53
|
return this.dispatchWithClass(activity)?.listener ?? null;
|
|
54
54
|
}
|
|
55
55
|
};
|
|
56
|
+
/**
|
|
57
|
+
* Checks whether an activity's ID and all of its actor IDs have the same
|
|
58
|
+
* non-opaque origin. Activities without an ID have no origin to authenticate.
|
|
59
|
+
*
|
|
60
|
+
* The caller is responsible for rejecting a missing primary actor ID before
|
|
61
|
+
* relying on this check.
|
|
62
|
+
* @internal
|
|
63
|
+
*/
|
|
64
|
+
function actorsHaveSameOrigin(activity) {
|
|
65
|
+
if (activity.id == null) return true;
|
|
66
|
+
const origin = activity.id.origin;
|
|
67
|
+
return origin !== "null" && activity.actorIds.every((actor) => actor.origin === origin);
|
|
68
|
+
}
|
|
56
69
|
async function routeActivity({ context: ctx, json, originalJson, normalizedActivity, ldSignatureVerified, activity, recipient, inboxListeners, inboxContextFactory, listenerInboxContextFactory, inboxErrorHandler, kv, kvPrefixes, queue, span, tracerProvider, idempotencyStrategy }) {
|
|
57
70
|
const logger = (0, _logtape_logtape.getLogger)([
|
|
58
71
|
"fedify",
|
|
59
72
|
"federation",
|
|
60
73
|
"inbox"
|
|
61
74
|
]);
|
|
75
|
+
if (activity.actorId == null) {
|
|
76
|
+
logger.error("Missing actor.", { activity: json });
|
|
77
|
+
span.setStatus({
|
|
78
|
+
code: _opentelemetry_api.SpanStatusCode.ERROR,
|
|
79
|
+
message: "Missing actor."
|
|
80
|
+
});
|
|
81
|
+
return "missingActor";
|
|
82
|
+
}
|
|
62
83
|
let cacheKey = null;
|
|
63
84
|
if (activity.id != null) {
|
|
64
85
|
const inboxContext = inboxContextFactory(recipient, json, activity.id?.href, (0, _fedify_vocab.getTypeId)(activity).href);
|
|
@@ -93,14 +114,6 @@ async function routeActivity({ context: ctx, json, originalJson, normalizedActiv
|
|
|
93
114
|
return "alreadyProcessed";
|
|
94
115
|
}
|
|
95
116
|
}
|
|
96
|
-
if (activity.actorId == null) {
|
|
97
|
-
logger.error("Missing actor.", { activity: json });
|
|
98
|
-
span.setStatus({
|
|
99
|
-
code: _opentelemetry_api.SpanStatusCode.ERROR,
|
|
100
|
-
message: "Missing actor."
|
|
101
|
-
});
|
|
102
|
-
return "missingActor";
|
|
103
|
-
}
|
|
104
117
|
span.setAttribute("activitypub.actor.id", activity.actorId.href);
|
|
105
118
|
if (queue != null) {
|
|
106
119
|
const carrier = {};
|
|
@@ -336,7 +349,7 @@ var FederationBuilderImpl = class {
|
|
|
336
349
|
this.collectionTypeIds = {};
|
|
337
350
|
}
|
|
338
351
|
async build(options) {
|
|
339
|
-
const { FederationImpl } = await Promise.resolve().then(() => require("./middleware-
|
|
352
|
+
const { FederationImpl } = await Promise.resolve().then(() => require("./middleware-BDniN395.cjs"));
|
|
340
353
|
const f = new FederationImpl(options);
|
|
341
354
|
const trailingSlashInsensitiveValue = f.router.trailingSlashInsensitive;
|
|
342
355
|
f.router = this.router.clone();
|
|
@@ -1160,8 +1173,8 @@ async function handleObject(request, { values, context, objectDispatcher, author
|
|
|
1160
1173
|
* @param parameters The parameters for handling the collection.
|
|
1161
1174
|
* @returns A promise that resolves to an HTTP response.
|
|
1162
1175
|
*/
|
|
1163
|
-
async function handleCollection(request, { name: name$
|
|
1164
|
-
const spanName = name$
|
|
1176
|
+
async function handleCollection(request, { name: name$2, identifier, uriGetter, filter, filterPredicate, context, collectionCallbacks, tracerProvider, onUnauthorized, onNotFound }) {
|
|
1177
|
+
const spanName = name$2.trim().replace(/\s+/g, "_");
|
|
1165
1178
|
tracerProvider = tracerProvider ?? _opentelemetry_api.trace.getTracerProvider();
|
|
1166
1179
|
const tracer = tracerProvider.getTracer(require_http.name, require_http.version);
|
|
1167
1180
|
const cursor = new URL(request.url).searchParams.get("cursor");
|
|
@@ -1203,7 +1216,7 @@ async function handleCollection(request, { name: name$1, identifier, uriGetter,
|
|
|
1203
1216
|
collection = new _fedify_vocab.OrderedCollection({
|
|
1204
1217
|
id: baseUri,
|
|
1205
1218
|
totalItems: totalItems == null ? null : Number(totalItems),
|
|
1206
|
-
items: filterCollectionItems(itemsOrResponse, name$
|
|
1219
|
+
items: filterCollectionItems(itemsOrResponse, name$2, filterPredicate)
|
|
1207
1220
|
});
|
|
1208
1221
|
} else {
|
|
1209
1222
|
const lastCursor = await collectionCallbacks.lastCursor?.(context, identifier);
|
|
@@ -1224,7 +1237,7 @@ async function handleCollection(request, { name: name$1, identifier, uriGetter,
|
|
|
1224
1237
|
} else {
|
|
1225
1238
|
const uri = new URL(baseUri);
|
|
1226
1239
|
uri.searchParams.set("cursor", cursor);
|
|
1227
|
-
const pageOrResponse = await tracer.startActiveSpan(`activitypub.dispatch_collection_page ${name$
|
|
1240
|
+
const pageOrResponse = await tracer.startActiveSpan(`activitypub.dispatch_collection_page ${name$2}`, {
|
|
1228
1241
|
kind: _opentelemetry_api.SpanKind.SERVER,
|
|
1229
1242
|
attributes: {
|
|
1230
1243
|
"activitypub.collection.id": uri.href,
|
|
@@ -1268,7 +1281,7 @@ async function handleCollection(request, { name: name$1, identifier, uriGetter,
|
|
|
1268
1281
|
id: uri,
|
|
1269
1282
|
prev,
|
|
1270
1283
|
next,
|
|
1271
|
-
items: filterCollectionItems(items, name$
|
|
1284
|
+
items: filterCollectionItems(items, name$2, filterPredicate),
|
|
1272
1285
|
partOf
|
|
1273
1286
|
});
|
|
1274
1287
|
}
|
|
@@ -1654,6 +1667,36 @@ async function handleInboxInternal(request, parameters, span) {
|
|
|
1654
1667
|
headers: { "Content-Type": "text/plain; charset=utf-8" }
|
|
1655
1668
|
});
|
|
1656
1669
|
}
|
|
1670
|
+
if (activity.actorId == null) {
|
|
1671
|
+
logger.error("Missing actor.", {
|
|
1672
|
+
activity: json,
|
|
1673
|
+
recipient
|
|
1674
|
+
});
|
|
1675
|
+
span.setStatus({
|
|
1676
|
+
code: _opentelemetry_api.SpanStatusCode.ERROR,
|
|
1677
|
+
message: "Missing actor."
|
|
1678
|
+
});
|
|
1679
|
+
return new Response("Missing actor.", {
|
|
1680
|
+
status: 400,
|
|
1681
|
+
headers: { "Content-Type": "text/plain; charset=utf-8" }
|
|
1682
|
+
});
|
|
1683
|
+
}
|
|
1684
|
+
if (!skipSignatureVerification && activity.id != null && !actorsHaveSameOrigin(activity)) {
|
|
1685
|
+
logger.error("The activity ({activityId}) and its actors do not have the same origin.", {
|
|
1686
|
+
activity: json,
|
|
1687
|
+
recipient,
|
|
1688
|
+
activityId: activity.id.href,
|
|
1689
|
+
actorIds: activity.actorIds.map((actor) => actor.href)
|
|
1690
|
+
});
|
|
1691
|
+
span.setStatus({
|
|
1692
|
+
code: _opentelemetry_api.SpanStatusCode.ERROR,
|
|
1693
|
+
message: `The activity (${activity.id.href}) and its actors do not have the same origin.`
|
|
1694
|
+
});
|
|
1695
|
+
return new Response("The activity and its actors do not have the same origin.", {
|
|
1696
|
+
status: 401,
|
|
1697
|
+
headers: { "Content-Type": "text/plain; charset=utf-8" }
|
|
1698
|
+
});
|
|
1699
|
+
}
|
|
1657
1700
|
const routeResult = await routeActivity({
|
|
1658
1701
|
context: ctx,
|
|
1659
1702
|
json,
|
|
@@ -1782,8 +1825,8 @@ var CustomCollectionHandler = class {
|
|
|
1782
1825
|
* @param CollectionPage The CollectionPage constructor.
|
|
1783
1826
|
* @param filterPredicate Optional filter predicate for items.
|
|
1784
1827
|
*/
|
|
1785
|
-
constructor(name$
|
|
1786
|
-
this.name = name$
|
|
1828
|
+
constructor(name$1, values, context, callbacks, tracerProvider = _opentelemetry_api.trace.getTracerProvider(), Collection, CollectionPage, filterPredicate) {
|
|
1829
|
+
this.name = name$1;
|
|
1787
1830
|
this.values = values;
|
|
1788
1831
|
this.context = context;
|
|
1789
1832
|
this.callbacks = callbacks;
|
|
@@ -3092,6 +3135,33 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
3092
3135
|
activity = await _fedify_vocab.Activity.fromJsonLd(parseInput, parseContext);
|
|
3093
3136
|
span.setAttribute("activitypub.activity.type", (0, _fedify_vocab.getTypeId)(activity).href);
|
|
3094
3137
|
if (activity.id != null) span.setAttribute("activitypub.activity.id", activity.id.href);
|
|
3138
|
+
if (activity.actorId == null) {
|
|
3139
|
+
logger.error("Missing actor in queued incoming activity.", {
|
|
3140
|
+
activityId: activity.id?.href,
|
|
3141
|
+
activity: message.activity,
|
|
3142
|
+
recipient: message.identifier
|
|
3143
|
+
});
|
|
3144
|
+
span.setStatus({
|
|
3145
|
+
code: _opentelemetry_api.SpanStatusCode.ERROR,
|
|
3146
|
+
message: "Missing actor."
|
|
3147
|
+
});
|
|
3148
|
+
span.end();
|
|
3149
|
+
return;
|
|
3150
|
+
}
|
|
3151
|
+
if (!this.skipSignatureVerification && activity.id != null && !actorsHaveSameOrigin(activity)) {
|
|
3152
|
+
logger.error("The queued activity ({activityId}) and its actors do not have the same origin.", {
|
|
3153
|
+
activityId: activity.id.href,
|
|
3154
|
+
actorIds: activity.actorIds.map((actor) => actor.href),
|
|
3155
|
+
activity: message.activity,
|
|
3156
|
+
recipient: message.identifier
|
|
3157
|
+
});
|
|
3158
|
+
span.setStatus({
|
|
3159
|
+
code: _opentelemetry_api.SpanStatusCode.ERROR,
|
|
3160
|
+
message: `The activity (${activity.id.href}) and its actors do not have the same origin.`
|
|
3161
|
+
});
|
|
3162
|
+
span.end();
|
|
3163
|
+
return;
|
|
3164
|
+
}
|
|
3095
3165
|
cacheKey = activity.id == null ? null : [
|
|
3096
3166
|
...this.kvPrefixes.activityIdempotence,
|
|
3097
3167
|
context.origin,
|
|
@@ -4202,20 +4272,6 @@ var ContextImpl = class ContextImpl {
|
|
|
4202
4272
|
activity: await fetched.toJsonLd({ contextLoader })
|
|
4203
4273
|
});
|
|
4204
4274
|
return false;
|
|
4205
|
-
} else if (fetched.actorIds.length < 1) {
|
|
4206
|
-
logger.debug("Fetched activity object is missing an actor; unable to verify.", {
|
|
4207
|
-
recipient,
|
|
4208
|
-
activity: await fetched.toJsonLd({ contextLoader })
|
|
4209
|
-
});
|
|
4210
|
-
return false;
|
|
4211
|
-
}
|
|
4212
|
-
const activityId = fetched.id;
|
|
4213
|
-
if (!fetched.actorIds.every((actor) => actor.origin === activityId.origin)) {
|
|
4214
|
-
logger.debug("Fetched activity object has actors from different origins; unable to verify.", {
|
|
4215
|
-
recipient,
|
|
4216
|
-
activity: await fetched.toJsonLd({ contextLoader })
|
|
4217
|
-
});
|
|
4218
|
-
return false;
|
|
4219
4275
|
}
|
|
4220
4276
|
logger.debug("Successfully fetched the remote activity object {activityId}; ignore the original activity and use the fetched one, which is trustworthy.");
|
|
4221
4277
|
activity = fetched;
|
|
@@ -4224,6 +4280,20 @@ var ContextImpl = class ContextImpl {
|
|
|
4224
4280
|
recipient,
|
|
4225
4281
|
activity: json
|
|
4226
4282
|
});
|
|
4283
|
+
if (activity.actorId == null) {
|
|
4284
|
+
logger.debug("Activity is missing an actor; unable to verify.", {
|
|
4285
|
+
recipient,
|
|
4286
|
+
activity: json
|
|
4287
|
+
});
|
|
4288
|
+
return false;
|
|
4289
|
+
}
|
|
4290
|
+
if (activity.id != null && !actorsHaveSameOrigin(activity)) {
|
|
4291
|
+
logger.debug("Activity has actors from different origins; unable to verify.", {
|
|
4292
|
+
recipient,
|
|
4293
|
+
activity: json
|
|
4294
|
+
});
|
|
4295
|
+
return false;
|
|
4296
|
+
}
|
|
4227
4297
|
const routeResult = await routeActivity({
|
|
4228
4298
|
context: this,
|
|
4229
4299
|
json,
|