feat: trust forwarded client addresses only from configured proxies (rate limit, audit, SSE) [CI]

Docs: access.md covers the missing node-side Backend identity and the hash-first install flow.
This commit is contained in:
justme committed 2026-10-07 22:51:44 +08:00
1 parent ff45ad086e
commit a19e6548d3
9 files changed
+201 -12

No files matched your search

@@ -50,6 +50,15 @@ public sealed class BackendOptions
/// </summary>
public string? CorsOrigins { get; set; }
/// <summary>
/// 可信的反向代理(逗号分隔的 IP 或 CIDR,如 <c>127.0.0.1,172.16.0.0/12</c>)。只有从这些地址连进来的请求,才采信
/// <see cref="TrustedProxyHeader"/> 里的客户端地址(用于登录限流、审计和 SSE 限制);空 = 不信任任何转发头,用套接字地址。
/// </summary>
public string? TrustedProxies { get; set; }
/// <summary>携带客户端地址的头,缺省 <c>X-Forwarded-For</c>(Cloudflare 单独的 <c>CF-Connecting-IP</c> 也可以填这里)。</summary>
public string? TrustedProxyHeader { get; set; }
public TimeSpan SessionLifetime { get; set; } = TimeSpan.FromHours(12);
public int LoginAttemptsPerMinute { get; set; } = 10;