From 00bb2a7b15c923e7d6044d6c1f86d16f0abc21ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=BE=B7=E5=AE=87?= Date: Mon, 5 Oct 2026 19:24:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D(=E4=BC=9A=E5=91=98=E5=AE=A1?= =?UTF-8?q?=E8=AE=A1):=20=E5=90=8E=E5=8F=B0=E6=94=B9=E6=A1=A3=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E6=94=B9=E7=94=A8=20SpacetimeDB=20=E4=BA=8B=E5=8A=A1?= =?UTF-8?q?=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - upsert_profile_membership_plan_record 不再信任入参 updated_at_micros - updated_at / created_at 统一取 ctx.timestamp,客户端时钟无法伪造审计时间 --- .../crates/spacetime-module/src/runtime/active/profile.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server-rs/crates/spacetime-module/src/runtime/active/profile.rs b/server-rs/crates/spacetime-module/src/runtime/active/profile.rs index 0bffc6c79..68b4f0586 100644 --- a/server-rs/crates/spacetime-module/src/runtime/active/profile.rs +++ b/server-rs/crates/spacetime-module/src/runtime/active/profile.rs @@ -8814,7 +8814,9 @@ fn upsert_profile_membership_plan_record( .map_err(|error| error.to_string())?; ensure_default_profile_membership_plan(ctx); - let updated_at = Timestamp::from_micros_since_unix_epoch(validated.updated_at_micros); + // 审计时间以 SpacetimeDB 事务时间为准:入参 `updated_at_micros` 不再被信任, + // 因为 procedure 可被持有 writer 身份者直接调用,客户端时钟可以伪造。 + let updated_at = ctx.timestamp; let existing = ctx .db .profile_membership_plan()