Skip to content
Snippets Groups Projects
Unverified Commit e89e7607 authored by syuilo's avatar syuilo Committed by GitHub
Browse files

Merge pull request #2555 from mei23/mei-0831-vali3

HTTP Signature ホスト検証エラーメッセージの調整
parents e53dde38 18b4f74c
No related branches found
No related tags found
No related merge requests found
......@@ -38,7 +38,7 @@ export default async (job: bq.Job, done: any): Promise<void> => {
try {
ValidateActivity(activity, host);
} catch (e) {
console.warn(e);
console.warn(e.message);
done();
return;
}
......@@ -55,7 +55,7 @@ export default async (job: bq.Job, done: any): Promise<void> => {
try {
ValidateActivity(activity, host);
} catch (e) {
console.warn(e);
console.warn(e.message);
done();
return;
}
......@@ -100,7 +100,10 @@ function ValidateActivity(activity: any, host: string) {
// id (if exists)
if (typeof activity.id === 'string') {
const uriHost = toUnicode(new URL(activity.id).hostname.toLowerCase());
if (host !== uriHost) throw new Error('activity.id has different host');
if (host !== uriHost) {
const diag = activity.signature ? '. Has LD-Signature. Forwarded?' : '';
throw new Error(`activity.id(${activity.id}) has different host(${host})${diag}`);
}
}
// actor (if exists)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment