Skip to content

Commit a2aa108

Browse files
committed
Merge tag '1.3.1'
Fedify 1.3.1
2 parents 466e708 + befb38d commit a2aa108

File tree

4 files changed

+77
-7
lines changed

4 files changed

+77
-7
lines changed

CHANGES.md

Lines changed: 42 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,15 @@ Version 1.4.0
99
To be released.
1010

1111

12+
Version 1.3.1
13+
-------------
14+
15+
Released on December 11, 2024.
16+
17+
- Fixed idempotence check in inbox listeners to ensure activities for
18+
different origins are processed correctly.
19+
20+
1221
Version 1.3.0
1322
-------------
1423

@@ -126,6 +135,15 @@ Released on November 30, 2024.
126135
[#193]: https://github.com/dahlia/fedify/issues/193
127136

128137

138+
Version 1.2.9
139+
-------------
140+
141+
Released on December 11, 2024.
142+
143+
- Fixed idempotence check in inbox listeners to ensure activities for
144+
different origins are processed correctly.
145+
146+
129147
Version 1.2.8
130148
-------------
131149

@@ -145,7 +163,7 @@ Released on November 23, 2024.
145163
Version 1.2.7
146164
-------------
147165

148-
Released on December 22, 2024.
166+
Released on November 22, 2024.
149167

150168
- Fixed a bug where `lookupWebFinger()` function had thrown a `TypeError`
151169
when the *.well-known/webfinger* redirects to a relative URI. [[#166]]
@@ -154,7 +172,7 @@ Released on December 22, 2024.
154172
Version 1.2.6
155173
-------------
156174

157-
Released on December 19, 2024.
175+
Released on November 19, 2024.
158176

159177
- Fix a bug where `Actor`'s `inbox` and `outbox` properties had not been
160178
able to be set to an `OrderedCollectionPage` object, even though it is
@@ -332,6 +350,15 @@ Released on October 31, 2024.
332350
[#118]: https://github.com/dahlia/fedify/issues/118
333351

334352

353+
Version 1.1.9
354+
-------------
355+
356+
Released on December 11, 2024.
357+
358+
- Fixed idempotence check in inbox listeners to ensure activities for
359+
different origins are processed correctly.
360+
361+
335362
Version 1.1.8
336363
-------------
337364

@@ -417,7 +444,7 @@ Released on November 19, 2024.
417444
Version 1.1.5
418445
-------------
419446

420-
Released on December 14, 2024.
447+
Released on November 14, 2024.
421448

422449
- Suppressed a `TypeError` with a message <q>unusable</q> due to Node.js's
423450
mysterious behavior. [[#159]]
@@ -579,10 +606,19 @@ Released on October 20, 2024.
579606
[#150]: https://github.com/dahlia/fedify/issues/150
580607

581608

609+
Version 1.0.12
610+
--------------
611+
612+
Released on December 11, 2024.
613+
614+
- Fixed idempotence check in inbox listeners to ensure activities for
615+
different origins are processed correctly.
616+
617+
582618
Version 1.0.11
583619
--------------
584620

585-
Released on December 22, 2024.
621+
Released on November 22, 2024.
586622

587623
- Fixed a bug where `lookupWebFinger()` function had thrown a `TypeError`
588624
when the *.well-known/webfinger* redirects to a relative URI. [[#166]]
@@ -591,7 +627,7 @@ Released on December 22, 2024.
591627
Version 1.0.10
592628
--------------
593629

594-
Released on December 19, 2024.
630+
Released on November 19, 2024.
595631

596632
- Fix a bug where `Actor`'s `inbox` and `outbox` properties had not been
597633
able to be set to an `OrderedCollectionPage` object, even though it is
@@ -648,7 +684,7 @@ Released on December 19, 2024.
648684
Version 1.0.9
649685
-------------
650686

651-
Released on December 14, 2024.
687+
Released on November 14, 2024.
652688

653689
- Suppressed a `TypeError` with a message <q>unusable</q> due to Node.js's
654690
mysterious behavior. [[#159]]

src/federation/inbox.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ export async function routeActivity<TContextData>(
119119
const logger = getLogger(["fedify", "federation", "inbox"]);
120120
const cacheKey = activity.id == null ? null : [
121121
...kvPrefixes.activityIdempotence,
122+
ctx.origin,
122123
activity.id.href,
123124
] satisfies KvKey;
124125
if (cacheKey != null) {

src/federation/middleware.test.ts

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -671,10 +671,11 @@ test("Federation.setInboxListeners()", async (t) => {
671671
assertEquals(response.status, 401);
672672

673673
// Personal inbox + HTTP Signatures (RSA)
674+
const activityPayload = await activity().toJsonLd(options);
674675
let request = new Request("https://example.com/users/john/inbox", {
675676
method: "POST",
676677
headers: { "Content-Type": "application/activity+json" },
677-
body: JSON.stringify(await activity().toJsonLd(options)),
678+
body: JSON.stringify(activityPayload),
678679
});
679680
request = await signRequest(
680681
request,
@@ -693,6 +694,37 @@ test("Federation.setInboxListeners()", async (t) => {
693694
["https://example.com/person", "https://example.com/users/john#main-key"],
694695
]);
695696

697+
// Idempotence check
698+
response = await federation.fetch(request, { contextData: undefined });
699+
assertEquals(inbox.length, 1);
700+
701+
// Idempotence check with different origin (host)
702+
inbox.shift();
703+
request = new Request("https://another.host/users/john/inbox", {
704+
method: "POST",
705+
headers: { "Content-Type": "application/activity+json" },
706+
body: JSON.stringify(activityPayload),
707+
});
708+
request = await signRequest(
709+
request,
710+
rsaPrivateKey3,
711+
new URL("https://example.com/person2#key3"),
712+
);
713+
response = await federation.fetch(request, { contextData: undefined });
714+
assertEquals(inbox.length, 1);
715+
assertEquals(inbox[0][1].actorId, new URL("https://example.com/person2"));
716+
assertEquals(response.status, 202);
717+
718+
while (authenticatedRequests.length > 0) authenticatedRequests.shift();
719+
assertEquals(authenticatedRequests, []);
720+
await inbox[0][0].documentLoader("https://example.com/person");
721+
assertEquals(authenticatedRequests, [
722+
[
723+
"https://example.com/person",
724+
"https://another.host/users/john#main-key",
725+
],
726+
]);
727+
696728
// Shared inbox + HTTP Signatures (RSA)
697729
inbox.shift();
698730
request = new Request("https://example.com/inbox", {

src/federation/middleware.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -686,6 +686,7 @@ export class FederationImpl<TContextData> implements Federation<TContextData> {
686686
}
687687
const cacheKey = activity.id == null ? null : [
688688
...this.kvPrefixes.activityIdempotence,
689+
context.origin,
689690
activity.id.href,
690691
] satisfies KvKey;
691692
if (cacheKey != null) {

0 commit comments

Comments
 (0)