修复相关漏洞
This commit is contained in:
+23
@@ -0,0 +1,23 @@
|
||||
namespace SimpleAdmin.Application;
|
||||
|
||||
/// <summary>同步第三方状态时的单向迁移保护;未知/陈旧结果不能覆盖已确认的签署进度。</summary>
|
||||
internal static class OnboardingSignStateGuard
|
||||
{
|
||||
internal static string Resolve(string current, string incoming)
|
||||
{
|
||||
if (current == ElectronicSignStatus.Archived && incoming == ElectronicSignStatus.Completed)
|
||||
return ElectronicSignStatus.Archived;
|
||||
if (IsTerminal(current) && current != incoming)
|
||||
throw Oops.Bah("契约锁返回状态与本地终态不一致,已保留本地状态,请核实后重试");
|
||||
if (current == ElectronicSignStatus.PendingCompanySeal
|
||||
&& incoming is not (ElectronicSignStatus.PendingCompanySeal
|
||||
or ElectronicSignStatus.Completed or ElectronicSignStatus.Archived
|
||||
or ElectronicSignStatus.Rejected or ElectronicSignStatus.Invalid or ElectronicSignStatus.Expired))
|
||||
throw Oops.Bah("契约锁状态暂未同步,已保留员工签署结果,请稍后重试");
|
||||
return incoming;
|
||||
}
|
||||
|
||||
private static bool IsTerminal(string status)
|
||||
=> status is ElectronicSignStatus.Completed or ElectronicSignStatus.Archived
|
||||
or ElectronicSignStatus.Rejected or ElectronicSignStatus.Invalid or ElectronicSignStatus.Expired;
|
||||
}
|
||||
Reference in New Issue
Block a user