@fedify/fedify 2.3.0-dev.1145 → 2.3.0-dev.1150
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-ShiR1K6b.mjs → builder-Bjm1Jq9n.mjs} +2 -2
- package/dist/compat/mod.d.cts +1 -1
- package/dist/compat/mod.d.ts +1 -1
- package/dist/compat/transformers.test.mjs +1 -1
- package/dist/{context-DI2gRbyN.d.cts → context-CRXCkTM6.d.cts} +48 -6
- package/dist/{context-DCtsSHDv.d.ts → context-MgCh7YGu.d.ts} +48 -6
- package/dist/{deno-h0TWFuEz.mjs → deno-CKFE6Uya.mjs} +1 -1
- package/dist/{docloader-BdDN0Aqx.mjs → docloader-B-ZE1cZf.mjs} +2 -2
- package/dist/federation/builder.test.mjs +1 -1
- package/dist/federation/handler.test.mjs +1363 -44
- package/dist/federation/idempotency.test.mjs +2 -2
- package/dist/federation/metrics.test.mjs +1 -1
- package/dist/federation/middleware.test.mjs +1667 -163
- package/dist/federation/mod.cjs +1 -1
- package/dist/federation/mod.d.cts +2 -2
- package/dist/federation/mod.d.ts +2 -2
- package/dist/federation/mod.js +1 -1
- package/dist/federation/retry.test.mjs +1 -1
- package/dist/federation/send.test.mjs +8 -8
- package/dist/federation/temporal.test.d.mts +2 -0
- package/dist/federation/temporal.test.mjs +71 -0
- package/dist/federation/webfinger.test.mjs +1 -1
- package/dist/{getMachineId-bsd-etIyxDet.mjs → getMachineId-bsd-BY01PL1n.mjs} +1 -1
- package/dist/{getMachineId-darwin-D23zTf4g.mjs → getMachineId-darwin-Dr1gkBkp.mjs} +1 -1
- package/dist/{getMachineId-win-Dpap6v5i.mjs → getMachineId-win-QEYwcJiy.mjs} +1 -1
- package/dist/{http-7kAB7PVx.cjs → http-DQYEA7AZ.cjs} +1 -1
- package/dist/{http-B2hxA7dO.js → http-WbS1gKzr.js} +1 -1
- package/dist/{http-QzW9IWfs.mjs → http-vHCgbhTg.mjs} +3 -3
- package/dist/{key-Dh2OK1XQ.mjs → key-N0zP_oJA.mjs} +2 -2
- package/dist/{kv-cache-b22dNkjt.js → kv-cache-DM2O-Yjy.js} +1 -1
- package/dist/{kv-cache-DCPp-MT0.cjs → kv-cache-Dsg_bi4N.cjs} +1 -1
- package/dist/{kv-cache-EZRIPZXD.mjs → kv-cache-GXXZEemD.mjs} +1 -1
- package/dist/{ld-eZbar1rr.mjs → ld-BwKhquPx.mjs} +302 -6
- package/dist/{metrics-E0hAHtLZ.mjs → metrics-7Vy9FvEw.mjs} +1 -1
- package/dist/{middleware-BrGIM_Ra.js → middleware-BscgvU-m.js} +428 -99
- package/dist/{middleware-BUl1BH4x.cjs → middleware-D_iXrYHJ.cjs} +429 -99
- package/dist/{middleware-mToCR2tG.mjs → middleware-Db1_qAFG.mjs} +1 -1
- package/dist/{middleware-CyJDCmNg.mjs → middleware-ZuUcO0t1.mjs} +348 -108
- package/dist/{mod-CI9fduEi.d.cts → mod-C7HOzGqH.d.cts} +1 -1
- package/dist/{mod-CkRiJHGA.d.ts → mod-CpQHB3Ys.d.ts} +1 -1
- package/dist/mod.cjs +4 -4
- package/dist/mod.d.cts +2 -2
- package/dist/mod.d.ts +2 -2
- package/dist/mod.js +4 -4
- package/dist/nodeinfo/handler.test.mjs +1 -1
- package/dist/{owner-ByO_Fw6U.mjs → owner-FD0H_vpj.mjs} +2 -2
- package/dist/{proof-jVqClF49.cjs → proof-CYK8T8IS.cjs} +353 -3
- package/dist/{proof-BkRyFchv.js → proof-I3EokKN-.js} +300 -4
- package/dist/{proof-CSo0S8OK.mjs → proof-V_lafPmA.mjs} +3 -3
- package/dist/{send-jzrTV1FU.mjs → send-Cc2_10tF.mjs} +3 -3
- package/dist/sig/http.test.mjs +2 -2
- package/dist/sig/key.test.mjs +1 -1
- package/dist/sig/ld.test.mjs +558 -2
- package/dist/sig/mod.cjs +2 -2
- 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-BkmBfs__.mjs +95 -0
- package/dist/testing/mod.d.mts +48 -6
- 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 +7 -7
- /package/dist/{execAsync-DCBrgFiV.mjs → execAsync-Dxb7rNf3.mjs} +0 -0
- /package/dist/{getMachineId-linux-ObI47Hql.mjs → getMachineId-linux-Bbhofx-s.mjs} +0 -0
- /package/dist/{getMachineId-unsupported-Ddu-PFeh.mjs → getMachineId-unsupported-dIOte2Ct.mjs} +0 -0
- /package/dist/{retry-v_sGLH1d.mjs → retry-_VvV0h9f.mjs} +0 -0
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { Temporal } from "@js-temporal/polyfill";
|
|
2
|
+
import "urlpattern-polyfill";
|
|
3
|
+
globalThis.addEventListener = () => {};
|
|
4
|
+
import { c as getNormalizationContextLoader } from "./ld-BwKhquPx.mjs";
|
|
5
|
+
import jsonld from "@fedify/vocab-runtime/jsonld";
|
|
6
|
+
//#region src/federation/temporal.ts
|
|
7
|
+
function isPlainObject(value) {
|
|
8
|
+
return typeof value === "object" && value != null && !Array.isArray(value);
|
|
9
|
+
}
|
|
10
|
+
function normalizeDateTimeLiteral(value) {
|
|
11
|
+
return value.substring(19).match(/[Z+-]/) ? value : value + "Z";
|
|
12
|
+
}
|
|
13
|
+
function isMalformedDateTimeLiteral(value) {
|
|
14
|
+
if (typeof value !== "string") return false;
|
|
15
|
+
try {
|
|
16
|
+
Temporal.Instant.from(normalizeDateTimeLiteral(value));
|
|
17
|
+
return false;
|
|
18
|
+
} catch {
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
function isMalformedDurationLiteral(value) {
|
|
23
|
+
if (typeof value !== "string") return false;
|
|
24
|
+
try {
|
|
25
|
+
Temporal.Duration.from(value);
|
|
26
|
+
return false;
|
|
27
|
+
} catch {
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
const TEMPORAL_DATE_TIME_IRIS = new Set([
|
|
32
|
+
"https://www.w3.org/ns/activitystreams#deleted",
|
|
33
|
+
"https://www.w3.org/ns/activitystreams#endTime",
|
|
34
|
+
"https://www.w3.org/ns/activitystreams#published",
|
|
35
|
+
"https://www.w3.org/ns/activitystreams#startTime",
|
|
36
|
+
"https://www.w3.org/ns/activitystreams#updated",
|
|
37
|
+
"http://purl.org/dc/terms/created",
|
|
38
|
+
"https://w3id.org/security#created"
|
|
39
|
+
]);
|
|
40
|
+
const TEMPORAL_DURATION_IRIS = new Set(["https://www.w3.org/ns/activitystreams#duration"]);
|
|
41
|
+
const QUESTION_CLOSED_IRI = "https://www.w3.org/ns/activitystreams#closed";
|
|
42
|
+
const XSD_DATE_TIME_IRI = "http://www.w3.org/2001/XMLSchema#dateTime";
|
|
43
|
+
function hasMalformedExpandedDateTimeLiteral(value) {
|
|
44
|
+
if (Array.isArray(value)) return value.some(hasMalformedExpandedDateTimeLiteral);
|
|
45
|
+
return isPlainObject(value) && "@value" in value && isMalformedDateTimeLiteral(value["@value"]);
|
|
46
|
+
}
|
|
47
|
+
function hasMalformedExpandedQuestionClosedLiteral(value) {
|
|
48
|
+
if (Array.isArray(value)) return value.some(hasMalformedExpandedQuestionClosedLiteral);
|
|
49
|
+
if (!isPlainObject(value) || !("@value" in value)) return false;
|
|
50
|
+
const literal = value["@value"];
|
|
51
|
+
if (typeof literal === "boolean") return false;
|
|
52
|
+
if (typeof literal !== "string") return false;
|
|
53
|
+
if (value["@type"] !== XSD_DATE_TIME_IRI) return false;
|
|
54
|
+
if (new Date(literal).toString() === "Invalid Date") return false;
|
|
55
|
+
return isMalformedDateTimeLiteral(literal);
|
|
56
|
+
}
|
|
57
|
+
function hasMalformedExpandedDurationLiteral(value) {
|
|
58
|
+
if (Array.isArray(value)) return value.some(hasMalformedExpandedDurationLiteral);
|
|
59
|
+
return isPlainObject(value) && "@value" in value && isMalformedDurationLiteral(value["@value"]);
|
|
60
|
+
}
|
|
61
|
+
function hasMalformedKnownTemporalLiteralInternal(value, visited) {
|
|
62
|
+
if (Array.isArray(value)) return value.some((item) => hasMalformedKnownTemporalLiteralInternal(item, visited));
|
|
63
|
+
if (!isPlainObject(value)) return false;
|
|
64
|
+
if (visited.has(value)) return false;
|
|
65
|
+
visited.add(value);
|
|
66
|
+
if ("@value" in value) return false;
|
|
67
|
+
for (const [key, child] of Object.entries(value)) {
|
|
68
|
+
if (TEMPORAL_DATE_TIME_IRIS.has(key)) {
|
|
69
|
+
if (hasMalformedExpandedDateTimeLiteral(child)) return true;
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
if (key === QUESTION_CLOSED_IRI) {
|
|
73
|
+
if (hasMalformedExpandedQuestionClosedLiteral(child)) return true;
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
if (TEMPORAL_DURATION_IRIS.has(key)) {
|
|
77
|
+
if (hasMalformedExpandedDurationLiteral(child)) return true;
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
if (hasMalformedKnownTemporalLiteralInternal(child, visited)) return true;
|
|
81
|
+
}
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
async function hasMalformedKnownTemporalLiteral(value, contextLoader) {
|
|
85
|
+
try {
|
|
86
|
+
return hasMalformedKnownTemporalLiteralInternal(await jsonld.expand(value, {
|
|
87
|
+
documentLoader: getNormalizationContextLoader(contextLoader),
|
|
88
|
+
keepFreeFloatingNodes: true
|
|
89
|
+
}), /* @__PURE__ */ new Set());
|
|
90
|
+
} catch {
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
//#endregion
|
|
95
|
+
export { hasMalformedKnownTemporalLiteral as t };
|
package/dist/testing/mod.d.mts
CHANGED
|
@@ -618,6 +618,42 @@ interface InboxMessage {
|
|
|
618
618
|
readonly id: ReturnType<typeof crypto.randomUUID>;
|
|
619
619
|
readonly baseUrl: string;
|
|
620
620
|
readonly activity: unknown;
|
|
621
|
+
/**
|
|
622
|
+
* The normalized JSON-LD representation of a signed inbox activity that
|
|
623
|
+
* Fedify already compacted successfully while accepting the request. Queue
|
|
624
|
+
* workers can reuse this producer-side parse cache under stricter loader or
|
|
625
|
+
* network constraints without changing the raw payload preserved for
|
|
626
|
+
* forwarding.
|
|
627
|
+
*
|
|
628
|
+
* This may exist even when {@link ldSignatureVerified} is `false`, because
|
|
629
|
+
* fallback-authenticated traffic and already-queued backlog items can still
|
|
630
|
+
* depend on the cached normalized form to avoid re-fetching remote custom
|
|
631
|
+
* contexts during worker processing.
|
|
632
|
+
*
|
|
633
|
+
* This is optional for backward compatibility with messages that were
|
|
634
|
+
* queued by older Fedify versions or that were already in a queue before
|
|
635
|
+
* upgrading.
|
|
636
|
+
*
|
|
637
|
+
* Fedify keeps this on the queued message itself instead of an external
|
|
638
|
+
* sidecar because generic queue backends do not provide reliable lifecycle
|
|
639
|
+
* guarantees for auxiliary storage across retries and redeliveries.
|
|
640
|
+
*
|
|
641
|
+
* @internal
|
|
642
|
+
*/
|
|
643
|
+
readonly normalizedActivity?: unknown;
|
|
644
|
+
/**
|
|
645
|
+
* Whether the producer actually verified the Linked Data Signature before
|
|
646
|
+
* queueing this message. This lets workers distinguish verified LDS replay
|
|
647
|
+
* from other authenticated inbox traffic that merely happened to include a
|
|
648
|
+
* signature block. This provenance marker is separate from the optional
|
|
649
|
+
* normalizedActivity parse cache.
|
|
650
|
+
*
|
|
651
|
+
* `undefined` preserves backward compatibility with older queued messages
|
|
652
|
+
* that predate this marker.
|
|
653
|
+
*
|
|
654
|
+
* @internal
|
|
655
|
+
*/
|
|
656
|
+
readonly ldSignatureVerified?: boolean;
|
|
621
657
|
readonly started: string;
|
|
622
658
|
readonly attempt: number;
|
|
623
659
|
readonly identifier: string | null;
|
|
@@ -2011,9 +2047,12 @@ interface InboxContext<TContextData> extends Context<TContextData> {
|
|
|
2011
2047
|
* Forwards a received activity to the recipients' inboxes. The forwarded
|
|
2012
2048
|
* activity will be signed in HTTP Signatures by the forwarder, but its
|
|
2013
2049
|
* payload will not be modified, i.e., Linked Data Signatures and Object
|
|
2014
|
-
* Integrity Proofs will not be added.
|
|
2015
|
-
*
|
|
2016
|
-
*
|
|
2050
|
+
* Integrity Proofs will not be added. Even when Fedify internally
|
|
2051
|
+
* normalizes a Linked Data Signature activity for parsing, this method still
|
|
2052
|
+
* forwards the original received payload so the sender's signatures/proofs
|
|
2053
|
+
* are preserved as-is. Therefore, if the activity is not signed (i.e., it
|
|
2054
|
+
* has neither Linked Data Signatures nor Object Integrity Proofs), the
|
|
2055
|
+
* recipient probably will not trust the activity.
|
|
2017
2056
|
* @param forwarder The forwarder's identifier or the forwarder's username
|
|
2018
2057
|
* or the forwarder's key pair(s).
|
|
2019
2058
|
* @param recipients The recipients of the activity.
|
|
@@ -2029,9 +2068,12 @@ interface InboxContext<TContextData> extends Context<TContextData> {
|
|
|
2029
2068
|
* Forwards a received activity to the recipients' inboxes. The forwarded
|
|
2030
2069
|
* activity will be signed in HTTP Signatures by the forwarder, but its
|
|
2031
2070
|
* payload will not be modified, i.e., Linked Data Signatures and Object
|
|
2032
|
-
* Integrity Proofs will not be added.
|
|
2033
|
-
*
|
|
2034
|
-
*
|
|
2071
|
+
* Integrity Proofs will not be added. Even when Fedify internally
|
|
2072
|
+
* normalizes a Linked Data Signature activity for parsing, this method still
|
|
2073
|
+
* forwards the original received payload so the sender's signatures/proofs
|
|
2074
|
+
* are preserved as-is. Therefore, if the activity is not signed (i.e., it
|
|
2075
|
+
* has neither Linked Data Signatures nor Object Integrity Proofs), the
|
|
2076
|
+
* recipient probably will not trust the activity.
|
|
2035
2077
|
* @param forwarder The forwarder's identifier or the forwarder's username.
|
|
2036
2078
|
* @param recipients In this case, it must be `"followers"`.
|
|
2037
2079
|
* @param options Options for forwarding the activity.
|
|
@@ -5,9 +5,9 @@ import { t as assertEquals } from "../assert_equals-C-ZRDbaf.mjs";
|
|
|
5
5
|
import "../std__assert-BBjXFNOb.mjs";
|
|
6
6
|
import { t as assertRejects } from "../assert_rejects-DN60FHPX.mjs";
|
|
7
7
|
import { t as esm_default } from "../esm-BQRw925N.mjs";
|
|
8
|
-
import { l as verifyRequest } from "../http-
|
|
8
|
+
import { l as verifyRequest } from "../http-vHCgbhTg.mjs";
|
|
9
9
|
import { i as rsaPrivateKey2 } from "../keys-C3kae-6B.mjs";
|
|
10
|
-
import { t as getAuthenticatedDocumentLoader } from "../docloader-
|
|
10
|
+
import { t as getAuthenticatedDocumentLoader } from "../docloader-B-ZE1cZf.mjs";
|
|
11
11
|
import { mockDocumentLoader, test } from "@fedify/fixture";
|
|
12
12
|
import { UrlError } from "@fedify/vocab-runtime";
|
|
13
13
|
//#region src/utils/docloader.test.ts
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { n as kvCache, t as MockKvStore } from "../kv-cache-
|
|
4
|
+
import { n as kvCache, t as MockKvStore } from "../kv-cache-GXXZEemD.mjs";
|
|
5
5
|
import { deepStrictEqual, throws } from "node:assert";
|
|
6
6
|
import { createTestMeterProvider, mockDocumentLoader, test } from "@fedify/fixture";
|
|
7
7
|
import { preloadedContexts } from "@fedify/vocab-runtime";
|
package/dist/utils/mod.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const { Temporal } = require("@js-temporal/polyfill");
|
|
2
2
|
const { URLPattern } = require("urlpattern-polyfill");
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
-
const require_kv_cache = require("../kv-cache-
|
|
4
|
+
const require_kv_cache = require("../kv-cache-Dsg_bi4N.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-DM2O-Yjy.js";
|
|
4
4
|
export { getAuthenticatedDocumentLoader, kvCache };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fedify/fedify",
|
|
3
|
-
"version": "2.3.0-dev.
|
|
3
|
+
"version": "2.3.0-dev.1150+8db5848a",
|
|
4
4
|
"description": "An ActivityPub server framework",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ActivityPub",
|
|
@@ -151,10 +151,10 @@
|
|
|
151
151
|
"jsonld": "^9.0.0",
|
|
152
152
|
"structured-field-values": "^2.0.4",
|
|
153
153
|
"urlpattern-polyfill": "^10.1.0",
|
|
154
|
-
"@fedify/uri-template": "2.3.0-dev.
|
|
155
|
-
"@fedify/
|
|
156
|
-
"@fedify/
|
|
157
|
-
"@fedify/vocab": "2.3.0-dev.
|
|
154
|
+
"@fedify/uri-template": "2.3.0-dev.1150+8db5848a",
|
|
155
|
+
"@fedify/vocab": "2.3.0-dev.1150+8db5848a",
|
|
156
|
+
"@fedify/webfinger": "2.3.0-dev.1150+8db5848a",
|
|
157
|
+
"@fedify/vocab-runtime": "2.3.0-dev.1150+8db5848a"
|
|
158
158
|
},
|
|
159
159
|
"devDependencies": {
|
|
160
160
|
"@opentelemetry/sdk-metrics": "2.7.1",
|
|
@@ -167,8 +167,8 @@
|
|
|
167
167
|
"tsx": "^4.21.0",
|
|
168
168
|
"typescript": "^6.0.0",
|
|
169
169
|
"wrangler": "^4.17.0",
|
|
170
|
-
"@fedify/
|
|
171
|
-
"@fedify/
|
|
170
|
+
"@fedify/fixture": "2.0.0",
|
|
171
|
+
"@fedify/vocab-tools": "^2.3.0-dev.1150+8db5848a"
|
|
172
172
|
},
|
|
173
173
|
"scripts": {
|
|
174
174
|
"build:self": "tsdown",
|
|
File without changes
|
|
File without changes
|
/package/dist/{getMachineId-unsupported-Ddu-PFeh.mjs → getMachineId-unsupported-dIOte2Ct.mjs}
RENAMED
|
File without changes
|
|
File without changes
|