← Back to Skills Marketplace
sdk-team

Alibabacloud Waf Checkresponse Intercept Query

by alibabacloud-skills-team · GitHub ↗ · v0.0.3 · MIT-0
cross-platform ⚠ suspicious
87
Downloads
0
Stars
0
Active Installs
3
Versions
Install in OpenClaw
/install alibabacloud-waf-checkresponse-intercept-query
Description
Query Alibaba Cloud WAF block reasons via SLS logs and WAF CLI. Analyzes detailed information about blocked requests. Optionally supports disabling WAF rules...
README (SKILL.md)

WAF CheckResponse Intercept Query

Prerequisites

Pre-check: Aliyun CLI >= 3.3.3 required

Run aliyun version to verify >= 3.3.3. If not installed or version too low, run curl -fsSL https://aliyuncli.alicdn.com/setup.sh | bash to update, or see references/cli-installation-guide.md for installation instructions.

Pre-check: Aliyun CLI plugin update required

[MUST] run aliyun configure set --auto-plugin-install true to enable automatic plugin installation. [MUST] run aliyun plugin update to ensure that any existing plugins are always up-to-date.

At the start of the Core Workflow (before any CLI invocation): [MUST] Enable AI-Mode — AI-mode is required for Agent Skill execution. Run the following commands before any CLI invocation:

aliyun configure ai-mode enable
aliyun configure ai-mode set-user-agent --user-agent "AlibabaCloud-Agent-Skills/alibabacloud-waf-checkresponse-intercept-query"

[MUST] Disable AI-Mode at EVERY exit point — Before delivering the final response for ANY reason, always disable AI-mode first. This applies to ALL exit paths: workflow success, workflow failure, error/exception, user cancellation, session end, or any other scenario where no further CLI commands will be executed. AI-mode is only used for Agent Skill invocation scenarios and MUST NOT remain enabled after the skill stops running.

aliyun configure ai-mode disable

[MUST] CLI User-Agent — Every aliyun CLI command invocation must include: --user-agent AlibabaCloud-Agent-Skills/alibabacloud-waf-checkresponse-intercept-query

Before execution, you must collect the following information from the user:

Parameter Description Required
Request ID The traceid obtained from the HTML body of WAF's block (intercept) response, or the Request ID shown on the 405 block page displayed in the browser Yes

Optional: WAF Instance ID, SLS Project name, SLS Logstore name (will be auto-discovered if not provided)

Notes:

  • Request ID (traceid) is obtained from the HTML body of WAF's block response, or from the 405 block page displayed in the browser
  • Uses Alibaba Cloud default credential chain for authentication (ECS RAM Role, ~/.alibabacloud/config, etc.)

Region Information

RegionId Value Region Description
cn-hangzhou Chinese Mainland WAF instances within mainland China
ap-southeast-1 Outside Chinese Mainland WAF instances in overseas and Hong Kong/Macao/Taiwan regions

Query Workflow

Step 1: Information Collection

Confirm the Request ID (traceid) with the user. If the user has not provided one, guide them to obtain it from:

  1. The 405 block page displayed in the browser, which shows the Request ID directly
  2. The HTML body of WAF's block (intercept) response, which contains the traceid

Step 2: Auto-Discover WAF Instances and Verify Log Service

If the user has not provided WAF Instance ID and SLS configuration, perform auto-discovery:

Step 2a: Discover WAF Instances

# Query WAF instances in both regions in parallel
aliyun waf-openapi DescribeInstance --region cn-hangzhou --RegionId cn-hangzhou --user-agent AlibabaCloud-Agent-Skills/alibabacloud-waf-checkresponse-intercept-query
aliyun waf-openapi DescribeInstance --region ap-southeast-1 --RegionId ap-southeast-1 --user-agent AlibabaCloud-Agent-Skills/alibabacloud-waf-checkresponse-intercept-query

Step 2b: Check Log Service Status (Mandatory Before Querying Logs)

Before retrieving SLS configuration, you MUST first verify that the WAF instance has log service enabled by calling DescribeSlsLogStoreStatus:

aliyun waf-openapi DescribeSlsLogStoreStatus --region \x3Cregion-id> --InstanceId '\x3Cinstance-id>' --RegionId '\x3Cregion-id>' --user-agent AlibabaCloud-Agent-Skills/alibabacloud-waf-checkresponse-intercept-query
  • If the response indicates log service is already enabled (SlsLogStoreStatus is true/enabled), skip the enable operation and proceed directly to Step 2c (idempotent: no redundant writes).
  • If log service is not enabled, inform the user that WAF log service must be activated before log queries can proceed. With user consent, call ModifyUserWafLogStatus to enable it:
aliyun waf-openapi ModifyUserWafLogStatus \
  --region \x3Cregion-id> \
  --InstanceId '\x3Cinstance-id>' \
  --Status 1 \
  --RegionId '\x3Cregion-id>' \
  --user-agent AlibabaCloud-Agent-Skills/alibabacloud-waf-checkresponse-intercept-query

Constraint: This skill only supports enabling log service (Status=1). Disabling log service is not permitted. Never call this API with Status=0.

After enabling, wait a moment and re-verify with DescribeSlsLogStoreStatus to confirm activation.

Step 2c: Retrieve SLS Configuration (Mandatory After Confirming Log Service is Enabled)

Once DescribeSlsLogStoreStatus confirms that log service is enabled, you must immediately call DescribeSlsLogStore to obtain the WAF log Project and Logstore information:

aliyun waf-openapi DescribeSlsLogStore --region \x3Cregion-id> --InstanceId '\x3Cinstance-id>' --RegionId '\x3Cregion-id>' --user-agent AlibabaCloud-Agent-Skills/alibabacloud-waf-checkresponse-intercept-query

Key fields in the DescribeSlsLogStore response:

Field Description
ProjectName SLS Project name associated with the WAF instance
LogStoreName SLS Logstore name for WAF logs
Ttl Log retention period (in days)

Cross-region note: The SLS log storage region may differ from the WAF instance region (e.g., WAF in ap-southeast-1 but SLS logs stored in ap-southeast-5). When querying SLS in Step 3, always use the region where the SLS Project is located, not the WAF instance region.

Step 3: Query SLS Logs

Use the ProjectName, LogStoreName and SLS region obtained from Step 2 to query block logs (prefer using the Python script):

# Query using script (recommended, supports automatic time range expansion)
python3 scripts/get_waf_logs.py \
  --project \x3Cproject-name> \
  --logstore \x3Clogstore-name> \
  --request-id \x3Crequest-id> \
  --region \x3Csls-region>

Or use CLI directly:

TO_TIME=$(python3 -c "import time; print(int(time.time()))")
FROM_TIME=$((TO_TIME - 86400))

aliyun sls get-logs \
  --project \x3Cproject-name> \
  --logstore \x3Clogstore-name> \
  --from $FROM_TIME \
  --to $TO_TIME \
  --query "\x3Crequest-id>" \
  --region \x3Csls-region> \
  --user-agent AlibabaCloud-Agent-Skills/alibabacloud-waf-checkresponse-intercept-query

Important: The --region here must be the SLS log storage region, which may differ from the WAF instance region. Check the DescribeSlsLogStore response from Step 2 to determine the correct SLS region.

Step 4: Query Rule Details

Extract rule_id and final_plugin from the logs to query the rule configuration:

Important: The DescribeDefenseRule API requires the DefenseScene parameter. Common defense scenes include:

  • custom_acl - Custom access control rules
  • custom_cc - Custom rate limiting rules (CC rules)
  • waf_group - WAF protection rules
  • antiscan - Anti-scan rules
  • dlp - Data leakage prevention
  • tamperproof - Anti-tampering

You can determine the defense scene from final_plugin field in the logs:

final_plugin DefenseScene
customrule custom_acl or custom_cc
waf waf_group
scanner_behavior antiscan
dlp dlp
# Query rule details with DefenseScene
aliyun waf-openapi DescribeDefenseRule \
  --region \x3Cregion-id> \
  --InstanceId '\x3Cinstance-id>' \
  --TemplateId \x3Ctemplate-id> \
  --RuleId \x3Crule-id> \
  --DefenseScene '\x3Cdefense-scene>' \
  --RegionId '\x3Cregion-id>' \
  --user-agent AlibabaCloud-Agent-Skills/alibabacloud-waf-checkresponse-intercept-query

Note: If you don't know the TemplateId, first use DescribeDefenseTemplates to list templates:

aliyun waf-openapi DescribeDefenseTemplates \
  --region \x3Cregion-id> \
  --InstanceId '\x3Cinstance-id>' \
  --DefenseScene '\x3Cdefense-scene>' \
  --RegionId '\x3Cregion-id>' \
  --user-agent AlibabaCloud-Agent-Skills/alibabacloud-waf-checkresponse-intercept-query

Step 5: Output Analysis Report

Output using the following template:

## WAF Block Analysis Report

### Request Information
- Request ID: {request_id}
- Block Time: {time}
- Client IP: {real_client_ip (masked, e.g. 192.***.***.***)} 
- Request URL: {host}{request_path}?{masked_query_params}

### Block Details
- Rule ID: {rule_id}
- Rule Name: {rule_name}
- Action: {action}

### Recommendations
{Provide recommendations based on rule type, refer to references/common-block-reasons.md}

Troubleshooting

No Logs Found

  1. Re-check global log service status (should have been verified in Step 2b, but re-confirm):

    aliyun waf-openapi DescribeSlsLogStoreStatus --region \x3Cregion-id> --InstanceId '\x3Cinstance-id>' --RegionId '\x3Cregion-id>' --user-agent AlibabaCloud-Agent-Skills/alibabacloud-waf-checkresponse-intercept-query
    

    If not enabled, prompt the user and enable with ModifyUserWafLogStatus (see Step 2b). Only enabling (Status=1) is allowed.

  2. Check protection object log switch:

    aliyun waf-openapi DescribeResourceLogStatus --region \x3Cregion-id> --InstanceId '\x3Cinstance-id>' --RegionId '\x3Cregion-id>' --user-agent AlibabaCloud-Agent-Skills/alibabacloud-waf-checkresponse-intercept-query
    
  3. Enable protection object log collection (check-then-act: only if DescribeResourceLogStatus shows log collection is disabled for the target resource; skip if already enabled):

    aliyun waf-openapi ModifyResourceLogStatus \
      --region \x3Cregion-id> \
      --InstanceId '\x3Cinstance-id>' \
      --Resource '\x3Cresource-name>' \
      --Status true \
      --user-agent AlibabaCloud-Agent-Skills/alibabacloud-waf-checkresponse-intercept-query
    

See references/common-block-reasons.md for protection object naming conventions.

Permission Denied Errors

If you encounter permission errors, check the following:

  1. Verify CLI profile configuration:

    aliyun configure list
    
  2. Check RAM policy permissions: Required permissions:

    • waf-openapi:DescribeInstance
    • waf-openapi:DescribeSlsLogStoreStatus
    • waf-openapi:DescribeSlsLogStore
    • waf-openapi:ModifyUserWafLogStatus (optional, for enabling log service)
    • waf-openapi:DescribeDefenseRule (for rule details)
    • sls:GetLogs (for log queries)
  3. Try specifying a different profile:

    aliyun waf-openapi DescribeInstance --profile \x3Cprofile-name> --region \x3Cregion-id> --user-agent AlibabaCloud-Agent-Skills/alibabacloud-waf-checkresponse-intercept-query
    

Request ID Not Found

If the Request ID is not found in the logs:

  1. Verify Request ID format: Should be 32 characters without hyphens
  2. Check time range: The script automatically expands search up to 90 days
  3. Verify the correct region: Try both cn-hangzhou and ap-southeast-1
  4. Check log retention (TTL): Default is 180 days, use --ttl parameter if different

Multi-Instance Scenarios

If both Chinese Mainland and non-Chinese Mainland instances exist, determine based on query results:

  • Logs found in only one region -> use that region directly
  • Logs found in both regions -> ask the user for clarification
  • No logs found in either region -> ask the user for the expected region, check protection object log switch

Note: Follow the same discovery commands as in Step 2, then query logs across all discovered SLS projects until the Request ID is found.

Rule Operation Constraints

Warning: Rule Disabling Policy

When the user requests to disable a rule:

  1. Check current rule status first — call DescribeDefenseRule to query the rule's current status. If the rule is already in the target state (e.g., already disabled), skip the write operation and inform the user (idempotent check-then-act pattern)
  2. Only perform disable operations (ModifyDefenseRuleStatus with RuleStatus=0)
  3. Never delete rules
  4. Never modify rule content
  5. Must confirm with user before executing
# Disable a rule (only after confirming it is currently enabled)
aliyun waf-openapi ModifyDefenseRuleStatus \
  --region \x3Cregion-id> \
  --InstanceId '\x3Cinstance-id>' \
  --RuleId \x3Crule-id> \
  --RuleStatus 0 \
  --RegionId '\x3Cregion-id>' \
  --user-agent AlibabaCloud-Agent-Skills/alibabacloud-waf-checkresponse-intercept-query

See references/rule-operations.md for detailed instructions.

References

Usage Guidance
This skill appears to implement the advertised WAF/SLS investigation and (with consent) rule disabling, but there are several issues you should consider before installing or running it: - Confirm prerequisites yourself: the skill requires the `aliyun` CLI (>=3.3.3) and access to your Alibaba Cloud credentials/role. The package metadata did not declare this; expect the script and SKILL.md to call `aliyun` extensively. - Avoid blind curl|bash: the SKILL.md suggests running a remote installer (aliyun's CDN). If you need the CLI, prefer installing via your OS package manager or inspect the installer script before execution. - Watch for persistent config changes: the skill instructs enabling `aliyun configure set --auto-plugin-install true` and manipulating an `ai-mode` setting. Enabling auto-plugin-install changes future CLI behavior and may cause unexpected plugin installs; the skill does not revert this setting. Only allow this if you accept that persistent change. - Least privilege for credentials: only grant the minimum RAM permissions required. Read-only WAF and SLS read permissions are sufficient for most investigations; only grant ModifyDefenseRuleStatus and log-enabling permissions when you explicitly trust the operator and confirm the action. - Confirm write operations interactively: the skill states it will ask for explicit confirmation before disabling rules or enabling log service. Keep that promise — do not allow any unattended/automated run that could perform write operations without approval. - Inspect the bundled script: the included Python script masks sensitive fields and calls `aliyun` subcommands; review it to ensure masking and outputs meet your privacy/security requirements. If you are not comfortable with running remote installers or changing CLI plugin settings, test this skill in an isolated environment or request a version that documents and avoids persistent CLI config changes.
Capability Analysis
Type: OpenClaw Skill Name: alibabacloud-waf-checkresponse-intercept-query Version: 0.0.3 The skill bundle is designed to troubleshoot Alibaba Cloud WAF blocks by querying SLS logs and rule configurations. It includes a Python script (scripts/get_waf_logs.py) that implements robust input validation and sensitive data masking for IPs, cookies, and tokens. While the skill has the capability to modify security settings (enabling logs or disabling WAF rules), these actions are strictly governed by instructions in SKILL.md and references/rule-operations.md, which mandate user confirmation, idempotent checks, and prohibit rule deletion or content modification.
Capability Assessment
Purpose & Capability
The skill correctly implements WAF/SLS queries and rule operations and includes RAM policy guidance that matches the described purpose. However, the metadata claims no required binaries or config paths while the SKILL.md and included script clearly require the `aliyun` CLI and access to the Alibaba Cloud credential chain (e.g., ~/.alibabacloud/config or ECS RAM role). That mismatch between declared requirements and actual needs is incoherent and could mislead users.
Instruction Scope
The runtime instructions remain within the WAF investigation/remediation scope (Describe* APIs, SLS queries, optional ModifyDefenseRuleStatus). But the SKILL.md also instructs: (1) running a remote installer via `curl -fsSL https://aliyuncli.alicdn.com/setup.sh | bash`, (2) enabling `aliyun configure set --auto-plugin-install true` (which changes CLI behavior persistently), and (3) enabling an 'AI-mode' toggle in the CLI. Those configuration and install steps go beyond mere querying and change user environment and remote-plugin behavior — requiring explicit user consent and care.
Install Mechanism
There is no formal install spec in the registry, but the SKILL.md tells users how to install/update the Aliyun CLI using a remote bootstrap script (curl | bash). While the URL points to Alibaba's CDN, advising users to execute a remote setup script is higher-risk than using a tracked package install. Also enabling `auto-plugin-install` can cause future remote plugin installs without further prompts.
Credentials
The skill declares no required environment variables or config paths, yet it depends on the Alibaba Cloud default credential chain and the presence of configured credentials or an IAM role. The reference RAM policies request both read-only WAF/SLS permissions and optional write permissions (ModifyDefenseRuleStatus, ModifyUserWafLogStatus, ModifyResourceLogStatus). Those write permissions are powerful; the SKILL.md requires user confirmation before altering rules, but the registry metadata not declaring the need for credential/config access is an omission that reduces transparency.
Persistence & Privilege
The skill alters CLI configuration (sets auto-plugin-install and AI-mode, sets a user-agent). Some of these changes are transient (AI-mode must be disabled at exit per instructions) but others are persistent (auto-plugin-install and the auto-plugin configuration). The SKILL.md does not instruct reverting auto-plugin-install, so installing the skill can leave lasting changes to the user's CLI behavior. The skill is not marked always:true, which is appropriate, but the persistent CLI changes are a privilege/footprint to be aware of.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install alibabacloud-waf-checkresponse-intercept-query
  3. After installation, invoke the skill by name or use /alibabacloud-waf-checkresponse-intercept-query
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v0.0.3
**Skill now requires Aliyun CLI AI-Mode and standardized User-Agent for all CLI invocations.** - Enforces Aliyun CLI >= 3.3.3 with automatic plugin updating as a prerequisite. - Requires enabling and disabling Aliyun CLI AI-Mode at workflow entry and every exit, ensuring mode is only active during skill operation. - All CLI commands must include `--user-agent AlibabaCloud-Agent-Skills/alibabacloud-waf-checkresponse-intercept-query`. - Documentation updated for stronger, clearer pre-checks and mandatory procedure for consistent environment setup.
v0.0.2
- Clarified that users should obtain the Request ID (traceid) specifically from the HTML body of WAF's block response or the 405 block page, rather than from response headers. - Updated instructions to make "traceid" from the block response body or error page the canonical Request ID for queries. - Improved wording and guidance for information collection and user prompts, ensuring accuracy when identifying the correct Request ID source. - No changes to API workflow, feature sets, or supported operations.
v0.0.1
alibabacloud-waf-checkresponse-intercept-query v0.0.1 - Initial release for investigating Alibaba Cloud WAF block incidents. - Supports querying SLS logs and analyzing detailed reasons for WAF-blocked requests by Request ID. - Automatically discovers WAF instances and verifies/enables required log service before querying. - Provides workflows for obtaining block details, including affected rule, action, and recommendations. - Includes optional abilities to enable log service and manage defense rules, with strict safeguards. - Clear, step-by-step workflow and troubleshooting guidance for block investigation.
Metadata
Slug alibabacloud-waf-checkresponse-intercept-query
Version 0.0.3
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 3
Frequently Asked Questions

What is Alibabacloud Waf Checkresponse Intercept Query?

Query Alibaba Cloud WAF block reasons via SLS logs and WAF CLI. Analyzes detailed information about blocked requests. Optionally supports disabling WAF rules... It is an AI Agent Skill for Claude Code / OpenClaw, with 87 downloads so far.

How do I install Alibabacloud Waf Checkresponse Intercept Query?

Run "/install alibabacloud-waf-checkresponse-intercept-query" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Alibabacloud Waf Checkresponse Intercept Query free?

Yes, Alibabacloud Waf Checkresponse Intercept Query is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does Alibabacloud Waf Checkresponse Intercept Query support?

Alibabacloud Waf Checkresponse Intercept Query is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Alibabacloud Waf Checkresponse Intercept Query?

It is built and maintained by alibabacloud-skills-team (@sdk-team); the current version is v0.0.3.

💬 Comments