fix: 削除済みユーザーとアクティビティactorがないときのフォールバックを修正

This commit is contained in:
usbharu 2023-12-21 13:36:45 +09:00
parent e7743c77f2
commit 0e547fce3d
3 changed files with 55 additions and 18 deletions

View File

@ -9,6 +9,9 @@ hideout:
public-key: "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAu1SU1LfVLPHCozMxH2Mo4lgOEePzNm0tRgeLezV6ffAt0gunVTLw7onLRnrq0/IzW7yWR7QkrmBL7jTKEn5u+qKhbwKfBstIs+bMY2Zkp18gnTxKLxoS2tFczGkPLPgizskuemMghRniWaoLcyehkd3qqGElvW/VDL5AaWTg0nLVkjRo9z+40RQzuVaE8AkAFmxZzow3x+VJYKdjykkJ0iT9wCS0DRTXu269V264Vf/3jvredZiKRkgwlL9xNAwxXFg0x/XFw005UWVRIkdgcKWTjpBP2dPwVZ4WWC+9aGVd+Gyn1o0CLelf4rEjGoXbAAEgAqeGUxrcIlbjXfbcmwIDAQAB" public-key: "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAu1SU1LfVLPHCozMxH2Mo4lgOEePzNm0tRgeLezV6ffAt0gunVTLw7onLRnrq0/IzW7yWR7QkrmBL7jTKEn5u+qKhbwKfBstIs+bMY2Zkp18gnTxKLxoS2tFczGkPLPgizskuemMghRniWaoLcyehkd3qqGElvW/VDL5AaWTg0nLVkjRo9z+40RQzuVaE8AkAFmxZzow3x+VJYKdjykkJ0iT9wCS0DRTXu269V264Vf/3jvredZiKRkgwlL9xNAwxXFg0x/XFw005UWVRIkdgcKWTjpBP2dPwVZ4WWC+9aGVd+Gyn1o0CLelf4rEjGoXbAAEgAqeGUxrcIlbjXfbcmwIDAQAB"
storage: storage:
type: local type: local
debug:
trace-query-exception: true
trace-query-call: true
spring: spring:
flyway: flyway:

View File

@ -94,7 +94,15 @@ class InboxJobProcessor(
//todo 不正なactorを取得してしまわないようにする //todo 不正なactorを取得してしまわないようにする
val verify = val verify =
signature?.let { verifyHttpSignature(httpRequest, it, transaction, jsonNode["actor"].textValue()) } ?: false signature?.let {
verifyHttpSignature(
httpRequest,
it,
transaction,
jsonNode.get("actor")?.asText() ?: signature.keyId
)
}
?: false
logger.debug("Is verifying success? {}", verify) logger.debug("Is verifying success? {}", verify)

View File

@ -57,6 +57,32 @@ data class Actor private constructor(
postsCount: Int = 0, postsCount: Int = 0,
lastPostDate: Instant? = null lastPostDate: Instant? = null
): Actor { ): Actor {
if (id == 0L) {
return Actor(
id = id,
name = name,
domain = domain,
screenName = screenName,
description = description,
inbox = inbox,
outbox = outbox,
url = url,
publicKey = publicKey,
privateKey = privateKey,
createdAt = createdAt,
keyId = keyId,
followers = followers,
following = following,
instance = instance,
locked = locked,
followersCount = followersCount,
followingCount = followingCount,
postsCount = postsCount,
lastPostDate = lastPostDate
)
}
// idは0未満ではいけない // idは0未満ではいけない
require(id >= 0) { "id must be greater than or equal to 0." } require(id >= 0) { "id must be greater than or equal to 0." }
@ -184,22 +210,22 @@ data class Actor private constructor(
override fun toString(): String { override fun toString(): String {
return "Actor(" + return "Actor(" +
"id=$id, " + "id=$id, " +
"name='$name', " + "name='$name', " +
"domain='$domain', " + "domain='$domain', " +
"screenName='$screenName', " + "screenName='$screenName', " +
"description='$description', " + "description='$description', " +
"inbox='$inbox', " + "inbox='$inbox', " +
"outbox='$outbox', " + "outbox='$outbox', " +
"url='$url', " + "url='$url', " +
"publicKey='$publicKey', " + "publicKey='$publicKey', " +
"privateKey=$privateKey, " + "privateKey=$privateKey, " +
"createdAt=$createdAt, " + "createdAt=$createdAt, " +
"keyId='$keyId', " + "keyId='$keyId', " +
"followers=$followers, " + "followers=$followers, " +
"following=$following, " + "following=$following, " +
"instance=$instance, " + "instance=$instance, " +
"locked=$locked" + "locked=$locked" +
")" ")"
} }
} }