Skip to content

Commit 1e2edea

Browse files
shleeableYour Name
andauthored
Improvement: include query string in the HTTP signature (#480)
* fix * pint * updated * updated --------- Co-authored-by: Your Name <you@example.com>
1 parent 5919498 commit 1e2edea

18 files changed

Lines changed: 74 additions & 18 deletions

app/Jobs/Federation/DeliverCommentLikeActivity.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@ public function handle(): void
9090
];
9191

9292
$signatureService = app(HttpSignatureService::class);
93+
$path = $parsedUrl['path'] ?? '/';
94+
$queryString = isset($parsedUrl['query']) ? '?'.$parsedUrl['query'] : '';
95+
$requestPath = $path.$queryString;
9396

9497
try {
9598
$privateKey = app(SigningService::class)->getPrivateKey();
@@ -98,7 +101,7 @@ public function handle(): void
98101
$privateKey,
99102
$headers,
100103
'POST',
101-
$parsedUrl['path'] ?? '/',
104+
$requestPath,
102105
json_encode($activity)
103106
);
104107

app/Jobs/Federation/DeliverCommentReplyLikeActivity.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@ public function handle(): void
9090
];
9191

9292
$signatureService = app(HttpSignatureService::class);
93+
$path = $parsedUrl['path'] ?? '/';
94+
$queryString = isset($parsedUrl['query']) ? '?'.$parsedUrl['query'] : '';
95+
$requestPath = $path.$queryString;
9396

9497
try {
9598
$privateKey = app(SigningService::class)->getPrivateKey();
@@ -98,7 +101,7 @@ public function handle(): void
98101
$privateKey,
99102
$headers,
100103
'POST',
101-
$parsedUrl['path'] ?? '/',
104+
$requestPath,
102105
json_encode($activity)
103106
);
104107

app/Jobs/Federation/DeliverCreateCommentActivity.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ public function handle(): void
9393
];
9494

9595
$signatureService = app(HttpSignatureService::class);
96+
$path = $parsedUrl['path'] ?? '/';
97+
$queryString = isset($parsedUrl['query']) ? '?'.$parsedUrl['query'] : '';
98+
$requestPath = $path.$queryString;
9699

97100
try {
98101
$privateKey = app(SigningService::class)->getPrivateKey();
@@ -101,7 +104,7 @@ public function handle(): void
101104
$privateKey,
102105
$headers,
103106
'POST',
104-
$parsedUrl['path'] ?? '/',
107+
$requestPath,
105108
json_encode($activity)
106109
);
107110

app/Jobs/Federation/DeliverCreateCommentReplyActivity.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ public function handle(): void
9393
];
9494

9595
$signatureService = app(HttpSignatureService::class);
96+
$path = $parsedUrl['path'] ?? '/';
97+
$queryString = isset($parsedUrl['query']) ? '?'.$parsedUrl['query'] : '';
98+
$requestPath = $path.$queryString;
9699

97100
try {
98101
$privateKey = app(SigningService::class)->getPrivateKey();
@@ -101,7 +104,7 @@ public function handle(): void
101104
$privateKey,
102105
$headers,
103106
'POST',
104-
$parsedUrl['path'] ?? '/',
107+
$requestPath,
105108
json_encode($activity)
106109
);
107110

app/Jobs/Federation/DeliverCreateVideoActivity.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@ public function handle(): void
9797
];
9898

9999
$signatureService = app(HttpSignatureService::class);
100+
$path = $parsedUrl['path'] ?? '/';
101+
$queryString = isset($parsedUrl['query']) ? '?'.$parsedUrl['query'] : '';
102+
$requestPath = $path.$queryString;
100103

101104
try {
102105
$privateKey = app(SigningService::class)->getPrivateKey();
@@ -105,7 +108,7 @@ public function handle(): void
105108
$privateKey,
106109
$headers,
107110
'POST',
108-
$parsedUrl['path'] ?? '/',
111+
$requestPath,
109112
json_encode($activity)
110113
);
111114

app/Jobs/Federation/DeliverDeleteCommentActivity.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ public function handle(): void
9595
];
9696

9797
$signatureService = app(HttpSignatureService::class);
98+
$path = $parsedUrl['path'] ?? '/';
99+
$queryString = isset($parsedUrl['query']) ? '?'.$parsedUrl['query'] : '';
100+
$requestPath = $path.$queryString;
98101

99102
try {
100103
$privateKey = app(SigningService::class)->getPrivateKey();
@@ -103,7 +106,7 @@ public function handle(): void
103106
$privateKey,
104107
$headers,
105108
'POST',
106-
$parsedUrl['path'] ?? '/',
109+
$requestPath,
107110
json_encode($activity)
108111
);
109112

app/Jobs/Federation/DeliverDeleteCommentReplyActivity.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ public function handle(): void
9595
];
9696

9797
$signatureService = app(HttpSignatureService::class);
98+
$path = $parsedUrl['path'] ?? '/';
99+
$queryString = isset($parsedUrl['query']) ? '?'.$parsedUrl['query'] : '';
100+
$requestPath = $path.$queryString;
98101

99102
try {
100103
$privateKey = app(SigningService::class)->getPrivateKey();
@@ -103,7 +106,7 @@ public function handle(): void
103106
$privateKey,
104107
$headers,
105108
'POST',
106-
$parsedUrl['path'] ?? '/',
109+
$requestPath,
107110
json_encode($activity)
108111
);
109112

app/Jobs/Federation/DeliverDeleteVideoActivity.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ public function handle(): void
9595
];
9696

9797
$signatureService = app(HttpSignatureService::class);
98+
$path = $parsedUrl['path'] ?? '/';
99+
$queryString = isset($parsedUrl['query']) ? '?'.$parsedUrl['query'] : '';
100+
$requestPath = $path.$queryString;
98101

99102
try {
100103
$privateKey = app(SigningService::class)->getPrivateKey();
@@ -103,7 +106,7 @@ public function handle(): void
103106
$privateKey,
104107
$headers,
105108
'POST',
106-
$parsedUrl['path'] ?? '/',
109+
$requestPath,
107110
json_encode($activity)
108111
);
109112

app/Jobs/Federation/DeliverFollowRequest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ public function handle(): void
7171
];
7272

7373
$signatureService = app(HttpSignatureService::class);
74+
$path = $parsedUrl['path'] ?? '/';
75+
$queryString = isset($parsedUrl['query']) ? '?'.$parsedUrl['query'] : '';
76+
$requestPath = $path.$queryString;
7477

7578
try {
7679
$privateKey = app(SigningService::class)->getPrivateKey();
@@ -79,7 +82,7 @@ public function handle(): void
7982
$privateKey,
8083
$headers,
8184
'POST',
82-
$parsedUrl['path'] ?? '/',
85+
$requestPath,
8386
json_encode($activity)
8487
);
8588

app/Jobs/Federation/DeliverRejectActivity.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ public function handle(): void
6666
}
6767

6868
$signatureService = app(HttpSignatureService::class);
69+
$path = $parsedUrl['path'] ?? '/';
70+
$queryString = isset($parsedUrl['query']) ? '?'.$parsedUrl['query'] : '';
71+
$requestPath = $path.$queryString;
6972

7073
$headers = [
7174
'Host' => $parsedUrl['host'],
@@ -82,7 +85,7 @@ public function handle(): void
8285
$privateKey,
8386
$headers,
8487
'POST',
85-
$parsedUrl['path'] ?? '/',
88+
$requestPath,
8689
json_encode($activity)
8790
);
8891

0 commit comments

Comments
 (0)