fix(sdk): 修复审计确认的 SDK-01~SDK-06/SDK-08 缺陷
- SDK-01:时钟回拨补偿只做一次(水位线跟随回拨后的时钟),避免 trustedNow 重复膨胀 - SDK-02:代理请求显式传 proxyAddr,消除运行期改写共享 opts 的数据竞争 - SDK-03:Decode 增加 256KB 结构层上限(与服务端 license 字节流上限对齐) - SDK-04:修正 license key 熵注释为 80bit - SDK-05:兼容服务端 version=0 空 CRL(携带吊销条目仍拒绝) - SDK-06:Validate 状态显式枚举,UNKNOWN/空值给出明确 fail-closed 错误 - SDK-08:缓存密钥混合 0600 随机 secret(旧 HKDF(指纹) 缓存读取后自动迁移) - SDK-07:README 记录 proxycert/Proxy 公钥旁路分发的设计信任假设 - 新增对应回归测试,go test -race -shuffle=on 全绿
This commit is contained in:
13 files changed
+440
-58
No files matched your search
+4
-9
@@ -104,10 +104,8 @@ func (c *Client) attestProxy(ctx context.Context) error {
|
||||
Lease string `json:"lease"`
|
||||
RenewAfter int64 `json:"renew_after"`
|
||||
}
|
||||
orig := c.opts.remoteServer
|
||||
c.opts.remoteServer = c.opts.proxyAddr
|
||||
err := c.postJSON(ctx, "/v1/proxy/attest", "", map[string]any{"sa_token": token}, &resp)
|
||||
c.opts.remoteServer = orig
|
||||
// 直接指定代理基址,运行期不改写共享 opts(SDK-02)。
|
||||
err := c.postJSONTo(ctx, c.opts.proxyAddr, "/v1/proxy/attest", "", map[string]any{"sa_token": token}, &resp)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -139,10 +137,7 @@ func (c *Client) renewProxy(ctx context.Context) error {
|
||||
Changed bool `json:"changed"`
|
||||
Terminate bool `json:"terminate"`
|
||||
}
|
||||
orig := c.opts.remoteServer
|
||||
c.opts.remoteServer = c.opts.proxyAddr
|
||||
err := c.postJSON(ctx, "/v1/proxy/renew", token, map[string]any{}, &resp)
|
||||
c.opts.remoteServer = orig
|
||||
err := c.postJSONTo(ctx, c.opts.proxyAddr, "/v1/proxy/renew", token, map[string]any{}, &resp)
|
||||
if err != nil {
|
||||
c.enterGrace(grace, err)
|
||||
return err
|
||||
@@ -405,7 +400,7 @@ func (c *Client) postNoContent(ctx context.Context, path, bearer string, body an
|
||||
return nil
|
||||
}
|
||||
|
||||
const sdkVersion = "0.7.0"
|
||||
const sdkVersion = "0.7.1"
|
||||
|
||||
// defaultFingerprint 是自动采集失败时的最后退路(仅 hostname),用于无绑定 license 的席位标识。
|
||||
// 有 bind.fp 的 license 在文件模式会 fail-closed(见 MachineFingerprint / verifyToken)。
|
||||
|
||||
Reference in new issue
Block a user