Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

alibabacloud-waf-lua-extension-dev

БесплатноБез исполняемых скриптовНе проверен

Use when creating, editing, or reviewing WAF 3.0 custom Lua extension plugins, plugin parameters, or request validation logic.

sdk-teamот sdk-team592 установки в других каталогах

Об этом скилле

WAF Extension Plugin (Lua) Development & Review

Alibaba Cloud WAF 3.0 "Extension Plugins" allow custom Lua scripts to hook into the request processing pipeline and implement security logic beyond the native rules.

Official documentation: https://help.aliyun.com/zh/waf/web-application-firewall-3-0/user-guide/extensions

This feature is supported only on the subscription Enterprise/Flagship editions and the pay-as-you-go edition, and it is a paid service. After a plugin is created, it takes effect only when it is referenced by a "Custom Rules" protection template.

Key Constraints (Read First)

Constraint Impact
No OpenAPI / CLI Extension plugins can only be configured in the console; there is no corresponding aliyun command or SDK interface. Do not try to create/query plugins via CLI, and there is no capability to import local files
Block-only action The "plugin action parameter" in debug testing currently supports only block mode; punish() means blocking the request
No logging print/warn have no effect; there is no log output mechanism inside scripts. The only feedback is the execution-result panel of "Run Debug" in the console
Association required to take effect After a plugin is created, it must be referenced by a "Custom Rules" protection template; the plugin logic executes only when the rule matches

Plugin Composition

An extension plugin consists of four parts in the console. This Skill uses a set of local project files to mirror them, for version control and review — but this file structure is a convention of this Skill; the platform does not consume these files, and they must ultimately be pasted into the console manually:

Console Configuration Local Project File Description
Basic information (name/description) plugin.json Plugin metadata
Plugin code plugin.lua Custom Lua script
Parameter definitions params.json Predefined parameters (including type, value, KMS reference)
Debug tests tests/*.json Simulated traffic and expected action results

Workflow

1. Create

  1. Clarify the protection goal: what kind of requests to block, and which request fields to decide on.
  2. Create the plugin directory <plugin-name>/ in the workspace and generate the four file types (see "Plugin Project Structure").
  3. Write plugin.lua: read the request → evaluate → call aliwaf.func.punish() on a match.
  4. Extract hard-coded values in the script (secrets, thresholds, whitelists, etc.) into params.xxx and declare them in params.json.
  5. Write at least one tests/*.json case for each key scenario (one hit + one pass).
  6. Paste the four configuration blocks into the console → enter the traffic parameters one by one → click "Run Debug", compare the results against the expectations in tests/*.json, and associate the plugin with the custom rule only after all cases pass.

2. Edit

  1. Read the existing plugin.lua and params.json first; understand the current logic before changing it.
  2. When changing logic, maintain the parameter definitions and test cases at the same time, so the script never references an undeclared params.xxx.
  3. Re-run the review checklist after the change.

3. Review

Check item by item against the Code Review Checklist. The review output should indicate: matched items, risk level, specific line numbers/APIs, and fix suggestions.

Plugin Project Structure

<plugin-name>/
├── plugin.json      # Basic information: name, description
├── plugin.lua       # Custom Lua script
├── params.json      # Parameter definitions (array)
└── tests/           # Debug test cases
    ├── hit.json     # Expected hit (punish)
    └── pass.json    # Expected pass

Fields of a single parameter in params.json: name (corresponds to params.xxx in the script), type (string/number/boolean/json_object/json_array), description, and either value or kms_secret_name (one of the two).

Fields of tests/*.json: traffic (method/uri/query/args/headers/cookies/request_body), expect_punish (boolean). The console's traffic parameters are flat key-value pairs; the nested fields above are the local record format and must be mapped manually when entered.

See references/examples.md for complete templates.

Runtime Environment

The standard library whitelist and prohibition list below, as well as the static-check hints in "Common Errors", come from the platform implementation and are not fully covered in the official documentation.

Available Lua Standard Libraries

  • base: core basic functions (globally available)
  • table, string, math, utf8
  • cjson: JSON encoding/decoding (safe mode)
  • bit32: 32-bit bitwise operations
  • pb: Protobuf encoding/decoding

Unavailable Standard Libraries

Accessing the following libraries raises an erro

Полный SKILL.md на ClawHub

Установить alibabacloud-waf-lua-extension-dev в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл alibabacloud-waf-lua-extension-dev?

Use when creating, editing, or reviewing WAF 3.0 custom Lua extension plugins, plugin parameters, or request validation logic.

Как установить скилл alibabacloud-waf-lua-extension-dev?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл alibabacloud-waf-lua-extension-dev запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить alibabacloud-waf-lua-extension-dev с