feat: add m01 (网哨M01) mail gateway threat-intelligence service#154
Open
K6gg wants to merge 1 commit into
Open
Conversation
Add services/m01__intelligence exposing the m01 mail security gateway local
threat-intelligence APIs as gRPC methods: DetectIntelligence, ListIntelligence,
AddIntelligence, UpdateIntelligence, DeleteIntelligence, GetIntelligenceStats.
- x-api-key auth with Bearer JWT fallback
- { code, msg, data } envelope unwrap; handler-side enum validation
- Idempotent add (dedup by pattern), update by id, delete on absence
- Standard gRPC error mapping; x-request-id/x-engine-instance audit headers
- Mock-based unit tests (100% line, >90% branch) and a mock upstream
- Wire into root dispatcher and package.json bin/files
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #137
接入设备
网哨 M01 邮件安全网关 — 本地威胁情报(情报漏洞资产)。服务包
services/m01__intelligence,proto 包M01_Intelligence。设备版本
产品「全量 API 文档」(OpenAPI 3.0.1),
/m01/intelligence/*路由。认证方式
secret.apiKey,以x-api-key: <key>头发送。secret.apiToken,无 apiKey 时以Authorization: Bearer <token>发送。实现方法
方式:RPC(gRPC,6 个方法)
DetectIntelligencePOST /m01/intelligence/detectionqueries[]各含 pattern/type/request_idListIntelligencePOST /m01/intelligence/listAddIntelligencePOST /m01/intelligence/addUpdateIntelligencePOST /m01/intelligence/updateDeleteIntelligencePOST /m01/intelligence/deleteGetIntelligenceStatsGET /m01/intelligence/stats{code,msg,data}信封统一解封;枚举(tlp/urgency/attribute/status/type)在 handler 侧校验。INVALID_ARGUMENT,401/403 或信封 code 401/403→PERMISSION_DENIED,4xx 或信封 code 400→FAILED_PRECONDITION,5xx/网络→UNAVAILABLE,非 JSON→UNKNOWN。x-request-id/x-engine-instance)。测试命令
已知限制
info/records等多态结构以google.protobuf.Struct原样透传。真实设备验证
(截图:网哨 M01 控制台本地情报列表中可见该 indicator 的新增与删除)