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"
storage:
type: local
debug:
trace-query-exception: true
trace-query-call: true
spring:
flyway:

View File

@ -94,7 +94,15 @@ class InboxJobProcessor(
//todo 不正なactorを取得してしまわないようにする
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)

View File

@ -57,6 +57,32 @@ data class Actor private constructor(
postsCount: Int = 0,
lastPostDate: Instant? = null
): 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未満ではいけない
require(id >= 0) { "id must be greater than or equal to 0." }