-
Notifications
You must be signed in to change notification settings - Fork 84
Add Volcengine WAF service #456
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
flynnnnnn9
wants to merge
2
commits into
chaitin:main
Choose a base branch
from
flynnnnnn9:codex/add-volcengine-waf-clean
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| #!/usr/bin/env node | ||
|
|
||
| import { fileURLToPath } from "node:url"; | ||
| import { runServiceMain } from "@chaitin-ai/octobus-sdk"; | ||
|
|
||
| import { service } from "../volcengine__waf/src/service.js"; | ||
|
|
||
| runServiceMain(service, { | ||
| entryFile: fileURLToPath(new URL("../volcengine__waf/bin/volcengine-waf.js", import.meta.url)), | ||
| }); |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| # Volcengine WAF OctoBus Service | ||
|
|
||
| ## Supported RPCs | ||
|
|
||
| This service package exposes read-only Volcengine WAF query APIs through OctoBus RPCs. | ||
|
|
||
| | RPC | Volcengine Action | Purpose | | ||
| |---|---|---| | ||
| | `ListDomain` | `ListDomain` | Query protected domains. | | ||
| | `ListLoadBalancer` | `ListLoadBalancer` | Query load balancer access resources. | | ||
| | `QueryProtectionOverviewLb` | `QueryProtectionOverviewLb` | Query protection overview metrics. | | ||
| | `QueryAttackSecurityEvent` | `QueryAttackSecurityEvent` | Query attack security events. | | ||
| | `QueryAttackAnalysisWithRuleAggLb` | `QueryAttackAnalysisWithRuleAggLb` | Query attack analysis grouped by protection rule. | | ||
| | `QueryFlowOverviewLb` | `QueryFlowOverviewLb` | Query traffic overview metrics. | | ||
| | `ListCustomPage` | `ListCustomPage` | Query custom response pages. | | ||
| | `GetTLSConfig` | `GetTLSConfig` | Query TLS configuration. | | ||
| | `GetVulnerabilityConfig` | `GetVulnerabilityConfig` | Query vulnerability protection configuration. | | ||
| | `ListVulnerabilityRule` | `ListVulnerabilityRule` | Query vulnerability protection rules. | | ||
| | `ListCustomBotConfig` | `ListCustomBotConfig` | Query custom bot protection configuration. | | ||
| | `ListWafServiceCertificate` | `ListWafServiceCertificate` | Query WAF service certificates. | | ||
| | `ListBlockRule` | `ListBlockRule` | Query block rules. | | ||
| | `ListAllowRule` | `ListAllowRule` | Query allow rules. | | ||
|
|
||
| ## Configuration | ||
|
|
||
| Use the service `config.schema.json` and `secret.schema.json` files for required endpoint, region, and credential fields. Secrets must be supplied at runtime and are not stored in this package. | ||
|
|
||
| ## Tests | ||
|
|
||
| Run the service test with Node.js from the repository or service worktree: | ||
|
|
||
| ```bash | ||
| node --test test/*.test.js | ||
| ``` |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| #!/usr/bin/env node | ||
| import { runServiceMain } from '@chaitin-ai/octobus-sdk'; | ||
|
|
||
| import { service } from '../src/service.js'; | ||
|
|
||
| runServiceMain(service); |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| { | ||
| "$schema": "https://json-schema.org/draft/2020-12/schema", | ||
| "type": "object", | ||
| "additionalProperties": true, | ||
| "properties": { | ||
| "region": { | ||
| "type": "string", | ||
| "default": "cn-beijing", | ||
| "description": "Volcengine region used for signing and regional WAF endpoints." | ||
| }, | ||
| "endpoint": { | ||
| "type": "string", | ||
| "description": "Optional Volcengine WAF endpoint override." | ||
| }, | ||
| "timeoutMs": { | ||
| "type": "integer", | ||
| "minimum": 1, | ||
| "default": 5000, | ||
| "description": "HTTP timeout in milliseconds." | ||
| }, | ||
| "headers": { | ||
| "type": "object", | ||
| "additionalProperties": { | ||
| "type": "string" | ||
| }, | ||
| "description": "Optional additional HTTP headers. Signing headers are set by the service." | ||
| } | ||
| } | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| { | ||
| "name": "@chaitin-ai/octobus-service-volcengine-waf", | ||
| "version": "0.1.0", | ||
| "private": true, | ||
| "type": "module", | ||
| "bin": { | ||
| "volcengine-waf": "bin/volcengine-waf.js" | ||
| }, | ||
| "scripts": { | ||
| "test": "node --test test/*.test.js" | ||
| }, | ||
| "dependencies": { | ||
| "@chaitin-ai/octobus-sdk": "^0.6.0" | ||
| } | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| syntax = "proto3"; | ||
|
|
||
| package Volcengine_WAF; | ||
|
|
||
| import "google/protobuf/struct.proto"; | ||
|
|
||
| option go_package = "miner/grpc-service/Volcengine_WAF"; | ||
|
|
||
| service Volcengine_WAF { | ||
| rpc ListDomain(VolcengineRequest) returns (VolcengineResponse) {} | ||
| rpc ListLoadBalancer(VolcengineRequest) returns (VolcengineResponse) {} | ||
| rpc QueryAttackAnalysisWithRuleAggLb(VolcengineRequest) returns (VolcengineResponse) {} | ||
| rpc QueryAttackSecurityEvent(VolcengineRequest) returns (VolcengineResponse) {} | ||
| rpc QueryFlowOverviewLb(VolcengineRequest) returns (VolcengineResponse) {} | ||
| rpc QueryProtectionOverviewLb(VolcengineRequest) returns (VolcengineResponse) {} | ||
| rpc ListCustomPage(VolcengineRequest) returns (VolcengineResponse) {} | ||
| rpc ListVulnerabilityRule(VolcengineRequest) returns (VolcengineResponse) {} | ||
| rpc GetVulnerabilityConfig(VolcengineRequest) returns (VolcengineResponse) {} | ||
| rpc ListCustomBotConfig(VolcengineRequest) returns (VolcengineResponse) {} | ||
| rpc GetTLSConfig(VolcengineRequest) returns (VolcengineResponse) {} | ||
| rpc ListWafServiceCertificate(VolcengineRequest) returns (VolcengineResponse) {} | ||
| rpc ListBlockRule(VolcengineRequest) returns (VolcengineResponse) {} | ||
| rpc ListAllowRule(VolcengineRequest) returns (VolcengineResponse) {} | ||
| } | ||
|
|
||
| message VolcengineRequest { | ||
| google.protobuf.Struct payload = 1; | ||
| } | ||
|
|
||
| message VolcengineResponse { | ||
| google.protobuf.Value response = 1; | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| { | ||
| "$schema": "https://json-schema.org/draft/2020-12/schema", | ||
| "type": "object", | ||
| "additionalProperties": true, | ||
| "properties": { | ||
| "accessKeyId": { | ||
| "type": "string", | ||
| "description": "Volcengine AccessKeyID." | ||
| }, | ||
| "access_key_id": { | ||
| "type": "string", | ||
| "description": "Alias for accessKeyId." | ||
| }, | ||
| "secretAccessKey": { | ||
| "type": "string", | ||
| "description": "Volcengine SecretAccessKey." | ||
| }, | ||
| "secret_access_key": { | ||
| "type": "string", | ||
| "description": "Alias for secretAccessKey." | ||
| }, | ||
| "sessionToken": { | ||
| "type": "string", | ||
| "description": "Optional temporary security token." | ||
| }, | ||
| "session_token": { | ||
| "type": "string", | ||
| "description": "Alias for sessionToken." | ||
| } | ||
| } | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| { | ||
| "schema": "chaitin.octobus.service.v1", | ||
| "name": "volcengine-waf", | ||
| "displayName": "Volcengine WAF", | ||
| "description": "OctoBus package for Volcengine Web Application Firewall read-only query APIs.", | ||
| "runtime": { | ||
| "mode": "long-running" | ||
| }, | ||
| "proto": { | ||
| "roots": [ | ||
| "proto" | ||
| ], | ||
| "files": [ | ||
| "proto/volcengine_waf.proto" | ||
| ] | ||
| }, | ||
| "configSchema": "config.schema.json", | ||
| "secretSchema": "secret.schema.json", | ||
| "sdk": { | ||
| "cli": { | ||
| "commands": { | ||
| "Volcengine_WAF.Volcengine_WAF/ListDomain": { | ||
| "name": "list-domain", | ||
| "description": "Query Volcengine WAF protected domains." | ||
| }, | ||
| "Volcengine_WAF.Volcengine_WAF/ListLoadBalancer": { | ||
| "name": "list-load-balancer", | ||
| "description": "Query Volcengine WAF load balancer access resources." | ||
| }, | ||
| "Volcengine_WAF.Volcengine_WAF/QueryProtectionOverviewLb": { | ||
| "name": "query-protection-overview-lb", | ||
| "description": "Query Volcengine WAF protection overview metrics." | ||
| }, | ||
| "Volcengine_WAF.Volcengine_WAF/QueryAttackAnalysisWithRuleAggLb": { | ||
| "name": "query-attack-analysis-with-rule-agg-lb", | ||
| "description": "Query Volcengine WAF attack analysis grouped by protection rule." | ||
| }, | ||
| "Volcengine_WAF.Volcengine_WAF/QueryAttackSecurityEvent": { | ||
| "name": "query-attack-security-event", | ||
| "description": "Query Volcengine WAF attack security events." | ||
| }, | ||
| "Volcengine_WAF.Volcengine_WAF/QueryFlowOverviewLb": { | ||
| "name": "query-flow-overview-lb", | ||
| "description": "Query Volcengine WAF traffic overview metrics." | ||
| }, | ||
| "Volcengine_WAF.Volcengine_WAF/ListCustomPage": { | ||
| "name": "list-custom-page", | ||
| "description": "Query Volcengine WAF custom response pages." | ||
| }, | ||
| "Volcengine_WAF.Volcengine_WAF/GetTLSConfig": { | ||
| "name": "get-tls-config", | ||
| "description": "Query Volcengine WAF TLS configuration." | ||
| }, | ||
| "Volcengine_WAF.Volcengine_WAF/GetVulnerabilityConfig": { | ||
| "name": "get-vulnerability-config", | ||
| "description": "Query Volcengine WAF vulnerability protection configuration." | ||
| }, | ||
| "Volcengine_WAF.Volcengine_WAF/ListVulnerabilityRule": { | ||
| "name": "list-vulnerability-rule", | ||
| "description": "Query Volcengine WAF vulnerability protection rules." | ||
| }, | ||
| "Volcengine_WAF.Volcengine_WAF/ListCustomBotConfig": { | ||
| "name": "list-custom-bot-config", | ||
| "description": "Query Volcengine WAF custom bot protection configuration." | ||
| }, | ||
| "Volcengine_WAF.Volcengine_WAF/ListWafServiceCertificate": { | ||
| "name": "list-waf-service-certificate", | ||
| "description": "Query Volcengine WAF service certificates." | ||
| }, | ||
| "Volcengine_WAF.Volcengine_WAF/ListBlockRule": { | ||
| "name": "list-block-rule", | ||
| "description": "Query Volcengine WAF block rules." | ||
| }, | ||
| "Volcengine_WAF.Volcengine_WAF/ListAllowRule": { | ||
| "name": "list-allow-rule", | ||
| "description": "Query Volcengine WAF allow rules." | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| import { defineService } from '@chaitin-ai/octobus-sdk'; | ||
|
|
||
| import { handlers } from './volcengine-waf.js'; | ||
|
|
||
| export { handlers } from './volcengine-waf.js'; | ||
|
|
||
| export const service = defineService({ handlers }); |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GetTLSConfig 的描述错误地写成了“log configuration”
GetTLSConfig RPC 用于查询 TLS 配置,但在 service.json 和 README.md 中被描述为“Query Volcengine WAF log configuration.”,明显是复制粘贴错误。错误的文档描述会导致 CLI 帮助信息和 README 对使用者产生误导,使其误以为该接口用于查询日志配置。
Problem code:
Recommendation:
将 service.json 和 README.md 中 GetTLSConfig 的描述修正为与 TLS 配置相关的正确文案,例如“Query Volcengine WAF TLS configuration.”。
Suggested diff: