|
标题: 关于疑似卡巴斯基 HTTPS 扫描导致 Node.js 访问 正文: 大家好,我想向 DSH 社区反馈一个 Node.js 访问 DeepSeek API 时与卡巴斯基的兼容性问题,希望社区或官方文档能记录为已知问题,并给出解决指引。 可能的原因: node -e "fetch('https://api.deepseek.com').then(r => console.log('HTTP', r.status)).catch(e => { console.error(e, e.cause); process.exit(1) })"实际结果: 排查结果: 原因判断: 临时规避:
建议: 期望: 如果需要,我可以补充卡巴斯基版本、Node 版本和证书链截图。 谢谢。 标签: Title: Feedback: Suspected Kaspersky HTTPS Scanning Causing Node.js Requests to Body: Hi DSH Community, I would like to report a compatibility issue between Node.js access to the DeepSeek API and Kaspersky. I hope the community or official documentation can record it as a known issue and provide troubleshooting guidance. Possible cause: Yesterday I was able to use DSH normally to complete tasks. Today, after updating the Kaspersky databases, DSH failed to call the model and showed: I then used the following command to identify the problem. After turning off Kaspersky, DSH worked normally again. Reproduction command: node -e "fetch('https://api.deepseek.com').then(r => console.log('HTTP', r.status)).catch(e => { console.error(e, e.cause); process.exit(1) })"Actual result: Troubleshooting: Likely cause: Temporary workaround:
Suggestion: Expectation: If needed, I can provide the Kaspersky version, Node version, and certificate chain screenshots. Thank you. Tags: |
Replies: 4 comments 2 replies
|
你的判断是对的, 而且有一个不用关掉 HTTPS 扫描的解法: 卡巴斯基的根证书可以加进 Node 的信任库. 根因: 卡巴斯基的「加密连接扫描」对 TLS 做中间人, 用它自己的自签名根证书重新签发证书链. Node 默认不信任这张根证书, 所以 解法: 先在 Windows 上导出卡巴斯基的根证书:
然后在启动 DSH 之前指向它: $env:NODE_EXTRA_CA_CERTS = "C:\path\to\kaspersky-root.pem"
dsh要让所有终端长期生效, 就把 这不是经验之谈, 我在本机做了 A/B 对照. Node v22.22.3, 起一个用自签名证书的本地 HTTPS 服务, 同一条命令只改这一个环境变量:
两个坑:
一个可用于确认的中间态: 如果设了 Disclosure of scope: measured on Node v22.22.3 (Windows) against a locally generated self-signed certificate and a local HTTPS server; I did not have Kaspersky installed, so the export steps come from its documented certificate behaviour rather than from a machine I tested end to end. |
|
先直接回答你三个问题, 再给你一条自己就能跑的判断命令. 你问的几个 AI 答案不一样, 多半是把三张不同的证书混在一起讲了 -- 先把它们分开, 后面的问题就都清楚了:
问题 1: 以后会不会又因为卡巴更新数据库出现这个问题?
怎么判断是哪一种? 这条命令只读, 不改任何设置, 也不关闭校验: node -e "const t=require('tls');const s=t.connect({host:'api.deepseek.com',port:443,servername:'api.deepseek.com',rejectUnauthorized:false},()=>{const p=s.getPeerCertificate(true);console.log('authorized:',s.authorized,'| authError:',s.authorizationError||'(none)');console.log('leaf:',p.subject.CN,'<- issuer:',p.issuer.CN||p.issuer.O);let x=p,g=0;while(x&&g++<8){if(!x.issuerCertificate||x.issuerCertificate===x){console.log('root:',x.subject.CN||x.subject.O);console.log('rootValidFrom:',x.valid_from);console.log('rootSHA256:',x.fingerprint256);break}x=x.issuerCertificate}s.end()})"怎么读:
问题 2: 出现这个问题还是按这个方法吗? 是. 建议一次做两件事, 以后最多花 10 秒:
验证: 直接跑你最初那条复现命令, 现在应该返回 还有一个可能更省心的替代项, 如果你的 Node >= v22.15.0: node -v # 先确认版本
$env:NODE_OPTIONS = "--use-system-ca"这条让 Node 直接读 Windows 信任库(卡巴的根本来就在里面). 我在本机 (Windows, Node v22.22.3) 量过: 不开这个开关时 Node 默认信任 145 张根(全是它自带的), 开了之后是 305 张 = 145 张自带 + 160 张系统库 -- 也就是追加, 不是替换, 而且 问题 3: 卡巴将来更新会不会自己修好? 不会, 不建议等. 这不是 bug, 而是两边的设计撞在一起: 卡巴的 HTTPS 扫描必须做中间人才能扫描内容(这就是它的工作方式), 而 Node 故意不使用系统信任库(它自带一份跨平台一致的根列表). 所以两边都不会去「修」. 同样的问题会出现在任何自带信任库的程序(Python / Java / Go ...)搭配任何做 HTTPS 拦截的软件(ESET / Bitdefender / 企业代理如 Zscaler)上, 社区里这类 FAQ 很多. 也正因如此, 你提的「文档里记一条」是有价值的 -- 不过这属于 DSH 仓库 / 文档维护者的取舍, 你可以去仓库开一条 issue 或 PR 提这个建议(API 侧本身没有问题可修). Disclosure of scope: measured on Node v22.22.3 (Windows) with a locally generated self-signed certificate and a local HTTPS server; the version requirement for |
|
你的两条观察不矛盾, 反而互相印证. 关键是你这条测试的测量时点:
两条证据线这样自洽:
处理建议:
|
|
Confirmed on Windows, plus a one-variable fix that keeps HTTPS scanning enabled: I hit the same failure and can confirm the diagnosis in this thread with certificate-level evidence, and add a workaround that does not require turning off the antivirus' encrypted-connection scanning. Environment
Symptoms
Minimal reproductionnode -e "fetch('https://api.deepseek.com').then(r=>console.log('HTTP',r.status)).catch(e=>console.error(e, e.cause))"Certificate-level evidence
Fix / workaroundsetx NODE_USE_SYSTEM_CA 1Then open a new shell (setx only affects processes started afterwards) and restart dsh. To test in the current shell only: $env:NODE_USE_SYSTEM_CA="1"
Please do not use Secondary observationWhen the TLS client does not send SNI, the same endpoint presents a DigiCert-issued certificate for an unrelated domain ( Questions for maintainers
中文摘要:本机同样复现该问题(dsh 0.1.5-rc.1 / Node v26.7.0 / Windows 11)。根因是卡巴斯基的加密连接扫描用其自签根证书重签了 |
你的判断是对的, 而且有一个不用关掉 HTTPS 扫描的解法: 卡巴斯基的根证书可以加进 Node 的信任库.
根因: 卡巴斯基的「加密连接扫描」对 TLS 做中间人, 用它自己的自签名根证书重新签发证书链. Node 默认不信任这张根证书, 所以
fetch抛SELF_SIGNED_CERT_IN_CHAIN. 关掉扫描就能恢复, 正说明被替换的是本地这一段证书链, 与api.deepseek.com服务端的证书无关 -- 这一点你已经验证过了.解法:
NODE_EXTRA_CA_CERTS先在 Windows 上导出卡巴斯基的根证书:
Win+R打开certlm.msc, 展开「受信任的根证书颁发机构」->「证书」Kaspersky的那张根证书 (通常在列表靠前的厂商区)kaspersky-root.pem然后在启动 DSH 之前指向它:
要让所有终端长期生效, 就把
NODE_EXTRA_CA_CERTS写进系统环境变量.这不是经验之谈, 我在本机做了 A/B 对照. Node v22.22.3, 起一个用自签名证书的本地 HTTPS 服务, 同一条命令只改这一个环境变量:
fetch('https://localhost:8443')NODE_EXTRA_CA_CERTSf…