feat(huawei-dns): add Huawei Cloud DNS zone and record set management service package - #319
feat(huawei-dns): add Huawei Cloud DNS zone and record set management service package#319dingzhejianjian wants to merge 4 commits into
Conversation
|
本次 PR 新增了一个华为云 DNS(Huawei Cloud DNS)的 OctoBus 服务包,包含 gRPC handler、SDK-HMAC-SHA256 签名、HTTP 传输层和基础测试。同时,services/package.json 被大幅删减。经审查,发现以下关键问题:1)services/package.json 被错误地清空了所有已有服务的 bin/files/scripts/bundledDependencies 条目,属于破坏性回归;2)主实现文件中存在 URL 路径注入风险(zoneId/recordsetId 直接拼接进路径);3)ListZones 和 ListRecordSets 的 total 字段误用当前页长度代替上游分页总数,导致数据完整性问题;4)签名时 Content-Type 使用了非标准的 charset=utf8;5)fetch 超时配置因传入标准 fetch 不支持的参数而失效。 |
|
已修正:
|
|
PR Title: feat(huawei-dns): add Huawei Cloud DNS zone and re... Commit: 本次 PR 主要做了两部分工作:1) 在 package.json 中恢复了大量已有的 service package 的 bin 与 files 声明;2) 针对 huawei-dns 服务修复了 fetch 超时(改用 AbortController)、签名 Content-Type charset(utf8→utf-8)、zoneId/recordsetId 的 URL 编码,以及 ListRecordSets 的分页 total 字段。但 runListZones 的 total 字段修复不完整,仍沿用 items.length,需要同步修正。 |
|
PR Title: feat(huawei-dns): add Huawei Cloud DNS zone and re... Commit: 本次 PR 修复了 |
|
PR Title: feat(huawei-dns): add Huawei Cloud DNS zone and re... Commit: 本次修改仅涉及 |
|
PR Title: feat(huawei-dns): add Huawei Cloud DNS zone and re... Commit: 本次改动将 |
|
PR Title: feat(huawei-dns): add Huawei Cloud DNS zone and re... Commit: 本次变更包含两个修复点:
整体评估:两处改动均为合理的防御性修复,代码逻辑清晰,未发现引入新的正确性或安全性问题。 |
dingzhejianjian
left a comment
There was a problem hiding this comment.
✅ 已完成手动验证。服务注册正常,ListZones API 正常,ListRecordSets 缺参正确拦截。
|
Reviewer note: this PR currently has merge conflicts with the target branch, so it cannot be merged or reviewed safely in its current state. Please rebase or merge the latest base branch, resolve the conflicts, and make sure GitHub Actions pass again. I am marking/keeping this PR as draft until the conflicts are resolved. |
|
PR Title: feat(huawei-dns): add Huawei Cloud DNS zone and re... Commit: 本次 PR 仅修改了 |
|
PR Title: feat(huawei-dns): add Huawei Cloud DNS zone and re... Commit: 本次 PR 修改了
整体评估:变更逻辑清晰,新增服务与依赖对应关系一致。但发现 |
46334fa to
04dad86
Compare
手动验证结果 ✅
结论:3/3 通过,可进入 review。 |
手动验证结果(完整)① tools/list命令: 返回: {
"id": 1,
"jsonrpc": "2.0",
"result": {
"tools": [
{
"description": "Huawei_DNS.Huawei_DNS/CreateRecordSet",
"inputSchema": {
"properties": {
"description": {
"description": "Wrapper message for `string`.",
"type": [
"string",
"null"
]
},
"name": {
"type": "string"
},
"ttl": {
"description": "Wrapper message for `int32`.",
"type": [
"number",
"null"
]
},
"type": {
"type": "string"
},
"value": {
"type": "string"
},
"zone_id": {
"type": "string"
}
},
"required": [],
"type": "object"
},
"name": "huawei-dns__dns-test__create_record_set"
},
{
"description": "Huawei_DNS.Huawei_DNS/DeleteRecordSet",
"inputSchema": {
"properties": {
"recordset_id": {
"type": "string"
},
"zone_id": {
"type": "string"
}
},
"required": [],
"type": "object"
},
"name": "huawei-dns__dns-test__delete_record_set"
},
{
"description": "Huawei_DNS.Huawei_DNS/ListRecordSets",
"inputSchema": {
"properties": {
"limit": {
"description": "Wrapper message for `int64`.",
"type": [
"string",
"null"
]
},
"name": {
"description": "Wrapper message for `string`.",
"type": [
"string",
"null"
]
},
"offset": {
"description": "Wrapper message for `int64`.",
"type": [
"string",
"null"
]
},
"type": {
"description": "Wrapper message for `string`.",
"type": [
"string",
"null"
]
},
"zone_id": {
"type": "string"
}
},
"required": [],
"type": "object"
},
"name": "huawei-dns__dns-test__list_record_sets"
},
{
"description": "Huawei_DNS.Huawei_DNS/ListZones",
"inputSchema": {
"properties": {
"limit": {
"description": "Wrapper message for `int64`.",
"type": [
"string",
"null"
]
},
"offset": {
"description": "Wrapper message for `int64`.",
"type": [
"string",
"null"
]
}
},
"required": [],
"type": "object"
},
"name": "huawei-dns__dns-test__list_zones"
}
]
}
}② ListZones命令: 返回: {
"message": "ok"
}③ ListRecordSets(空参数测试)命令: 返回: {
"code": "invalid_argument",
"message": "INVALID_ARGUMENT: zone_id is required"
}✅ 结论:3/3 全部通过,可进入 review。 |
|
PR Title: feat(huawei-dns): add Huawei Cloud DNS zone and re... Commit: 本次 PR 修复了 Huawei DNS 服务包中的多个问题:为 unwrapString 增加递归深度保护(depth > 10 时截断),修正 Content-Type 签名格式(添加 charset 前的空格),重构 fetchJson 错误处理(将 res.text() 移入 try 块、透传 GrpcError、增加 429 映射),使用 undici Agent 实现 TLS 跳过验证,并通过 response.metadata?.total_count 获取列表总数。同时补充了对应的单元测试(HTTP 429/500/网络超时、深度递归、空值/数字类型等)。整体改动方向正确,但 mapHttpError 中移除了 401 的 PERMISSION_DENIED 映射,导致认证失败行为回退,需要修正。 |
手动验证结果(完整)① tools/list命令: 返回: 4 个 tool(create_record_set / delete_record_set / list_record_sets / list_zones) ② ListZones{"message": "ok"}③ ListRecordSets(空参数测试)返回: {"code": "invalid_argument", "message": "INVALID_ARGUMENT: zone_id is required"}✅ 结论:3/3 通过。 |
|
PR Title: feat(huawei-dns): add Huawei Cloud DNS zone and re... Commit: 本次修改仅在 关键设计决策:
总体评估:这是一处合理的性能/资源优化。Node.js 单线程模型下 |
e9e7476 to
4535d22
Compare
|
PR Title: feat(huawei-dns): add Huawei Cloud DNS zone and re... Commit: 本次 PR 是一次大规模的服务扩展与 SDK 升级,主要变更包括:
在审阅过程中发现了若干安全与可靠性问题:
|
- mapHttpError now handles 401 alongside 403 as PERMISSION_DENIED - Added 401 test case to HTTP transport errors - Fixes regression where 401 was incorrectly mapped to FAILED_PRECONDITION
|
PR Title: feat(huawei-dns): add Huawei Cloud DNS zone and re... Commit: 本次 PR 修复了华为云 DNS 服务中 HTTP 401 状态码的错误映射问题。在之前的修改中,401 被从 |
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ices Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>




接入设备
华为云 DNS(Domain Name Service),提供域名解析管理能力,支持 DNS 区域和解析记录的查询、创建、删除。
设备版本
DNS,API 版本 v2,端点
dns.myhuaweicloud.com认证方式
华为云 AK/SK(Access Key + Secret Key),SDK-HMAC-SHA256 签名
实现方法
ListZonesGET /v2/zonesListRecordSetsGET /v2/recordsets?zone_id=xxxCreateRecordSetPOST /v2/zones/{zone_id}/recordsetsDeleteRecordSetDELETE /v2/zones/{zone_id}/recordsets/{recordset_id}Review 修复
测试修复:
ensureTrailingSlash函数已导出到_test对象,修复测试 helper 覆盖验证ListZones total 修复:不再返回 items.length,改用 API 响应中的
metadata.total_count## 联调证据证据一:MCP 工具列表(证明服务已注册到 OctoBus)
证据二:Connect RPC — ListZones(证明 API 签名和链路全通)
证据三:实例运行状态
测试结果
目录结构
安全场景