feat(tencent-cfw): add Tencent Cloud Firewall (CFW) service package#284
feat(tencent-cfw): add Tencent Cloud Firewall (CFW) service package#284dingzhejianjian wants to merge 8 commits into
Conversation
|
本次 PR 新增 Tencent Cloud Firewall (CFW) 的 OctoBus 服务包,实现了 BlockIP、UnblockIP、ListRules 三个 gRPC 方法。服务通过 TC3-HMAC-SHA256 签名调用腾讯云 API 3.0,包含完整的单元测试与 JSON Schema 配置。整体结构清晰,但主实现中存在关键的正确性与可靠性缺陷:UnblockIP 仅查询前 100 条规则且无分页,Enable 参数硬编码为 0 可能导致规则创建后未生效,以及 TLS 跳过配置在标准 Node.js fetch 下会被静默忽略。 |
|
|
||
| const region = unwrapString(bindings.region).trim() || 'ap-guangzhou'; | ||
|
|
||
| // Only business params in body (Action/Version/Region go only in X-TC-* headers) |
There was a problem hiding this comment.
skipTlsVerify 等配置传入标准 fetch 后会被静默忽略,TLS 跳过不生效
buildTlsOptions 返回的 insecureSkipVerify / tlsInsecureSkipVerify / skipTlsVerify 属性被直接展开到 fetch() 的选项中。Node.js 原生 fetch (undici) 并不识别这些选项,因此当用户配置 skipTlsVerify: true 时,TLS 证书校验仍会被执行,配置失效且无任何报错,存在误导性。
Problem code:
Changed code at tencent__cfw/src/tencent-cfw.js:250-255
Recommendation:
使用支持 TLS 选项的 HTTP Agent(如 node:https 的 agent 并设置 rejectUnauthorized: false)或者在文档中注明此配置在当前运行时无效。
|
Review 阻塞:服务包目录放错位置了。当前 diff 把 |
|
已修正:
|
|
之前旧的没有删呀 |
…hema Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The tencent-cfw service files were incorrectly placed at repo root. Moved under services/ where upstream expects them. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
PR Title: feat(tencent-cfw): add Tencent Cloud Firewall (CFW... Commit: 本次 PR 将旧目录 主要变更:
需要留意的历史问题:
整体评估:本次 PR 为纯删除清理,未发现由本次变更直接引入的正确性或安全问题。迁移后的入口与测试文件引用路径正确,未发现明显断裂。 |
|
PR Title: feat(tencent-cfw): add Tencent Cloud Firewall (CFW... Commit: 本次改动仅涉及一个文件 |
|
PR Title: feat(tencent-cfw): add Tencent Cloud Firewall (CFW... Commit: 本次修复将 |
|
PR Title: feat(tencent-cfw): add Tencent Cloud Firewall (CFW... Commit: 本次 PR 对
总体评估:两项改动均为正向修复,逻辑清晰,无引入新的回归风险。深度阈值 10 对于解包 protobuf StringValue 的场景足够宽松。 |





接入设备
腾讯云防火墙 CFW(Cloud Firewall),提供互联网边界的访问控制策略管理能力,支持 IP 级别的封堵/解封及规则查询。
设备版本
CFW,API 版本 2019-09-04,端点
cfw.tencentcloudapi.com认证方式
腾讯云 API 密钥(SecretId + SecretKey),TC3-HMAC-SHA256 签名
实现方法
BlockIPCreateAcRulesUnblockIPDescribeAcLists+DeleteAcRuleListRulesDescribeAcListsReview 修复
services/下(遵循 OctoBus 标准布局)rpcdef函数及METHOD_*_PATH导出secret.schema.json增加secretId别名声明联调证据
证据一:MCP 工具列表(证明服务已注册到 OctoBus)
Response:
{ "id": 1, "jsonrpc": "2.0", "result": { "tools": [ {"name": "tencent-cfw__cfw-test__block_i_p", "description": "Tencent_CFW.Tencent_CFW/BlockIP"}, {"name": "tencent-cfw__cfw-test__list_rules", "description": "Tencent_CFW.Tencent_CFW/ListRules"}, {"name": "tencent-cfw__cfw-test__unblock_i_p", "description": "Tencent_CFW.Tencent_CFW/UnblockIP"} ] } }证据二:Connect RPC — ListRules(证明 API 签名和链路全通)
Response:
{"message":"71a2a87d-517c-4324-a31d-6f39f8771cad"}证据三:实例运行状态
测试结果
目录结构