PP 增加受控凭据更新、真实登录与目录检查,待验证修改不会替换生效配置;扫描与取件共享生效修订。 钉钉来源向导、校验与登记共用 DWS 授权,支持中途恢复与换账号保护,取消旧扫码自动回落。 认证审计复用已有来源审计页,配置响应不回传密码;补齐运行镜像脚本与权限。 验证:make verify 退出 0;PP/DWS/httpapi 目标 race 回归通过;隔离 HTTP 服务验证 PP 协议及扫描/取件消费者。 尚未部署;真实 PP 凭据与目录可用性在测试站部署后验证。
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
package ppauth
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"os"
|
||||
"os/exec"
|
||||
"time"
|
||||
)
|
||||
|
||||
// CommandProbe reuses the worker's read-only PP adapter; secrets travel on stdin.
|
||||
func CommandProbe(python, script string) func(context.Context, Credentials) Observation {
|
||||
return func(ctx context.Context, c Credentials) Observation {
|
||||
ctx, cancel := context.WithTimeout(ctx, 45*time.Second)
|
||||
defer cancel()
|
||||
raw, _ := json.Marshal(c)
|
||||
command := exec.CommandContext(ctx, python, script)
|
||||
command.Stdin = bytes.NewReader(raw)
|
||||
command.Env = []string{"PATH=" + os.Getenv("PATH"), "PYTHONUNBUFFERED=1"}
|
||||
out, err := command.Output()
|
||||
if err != nil || len(out) > 8192 {
|
||||
return Observation{State: "unavailable", Message: "PP 检查服务暂不可用,请重试"}
|
||||
}
|
||||
var o Observation
|
||||
if json.Unmarshal(out, &o) != nil {
|
||||
return Observation{State: "unavailable", Message: "PP 检查结果不可识别"}
|
||||
}
|
||||
return o
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user