agent-security-hardening
AFaffaan-m/ECC314k4,125 new stars in the last 7 days
Create and manage Kibana alerting rules and the action policies that notify on their alerts, for both Universal Alerting and classic alerting. Use when the user wants to be alerted or notified about conditions in their data, change where or how often alerts notify (including snoozing notifications), edit, enable, disable, or delete existing rules or action policies, or list existing alerting, including managing rules with Terraform. Not for Security detection rules.
Turn a monitoring goal into working alerting and manage what already exists. Create Universal Alerting rules and action policies by default; use classic alerting only when the user names a classic rule type, edits an existing classic rule, or Universal Alerting is unavailable. Load only the chosen system's references before writing anything.
This skill executes Elasticsearch operations through the elastic CLI. If the
elastic CLI is not installed, tell the user what it is needed for. Do
not guess credentials, call the HTTP API directly, or attempt other workarounds.
This skill references operations in HTTP-shorthand form (e.g., GET /, GET /_cat/indices, GET /{index}/_mapping,
GET /{index}/_settings/index.mode, POST /_query). The Operations table at the end of this document
maps each shorthand to the equivalent elastic CLI command — always use the CLI rather than calling the HTTP API
directly.
Kibana has two alerting systems. They do not share rules, APIs, or notification wiring.
classic-rule-types.md. Its details live entirely in the
classic references — do not load them for any other task. Classic alerting has no action policies: each classic rule
notifies through its own actions, which run connectors.If the user states a Kibana version before 9.6, use classic alerting without the check below.
Otherwise, before the first Universal Alerting call, check it once with GET kbn:/api/alerting/v2/rules and
per_page=1:
| Response | Meaning | Do |
|---|---|---|
| 200 | Available | Use Universal Alerting |
404, and GET kbn:/api/status succeeds | Not in this Kibana: a version before 9.6 (see version.number), or a Serverless Security or Elasticsearch project | Use classic alerting |
503 with code ALERTING_DISABLED | Turned off by an administrator (alerting:v2:enabled) | Use classic alerting |
| 403 | Available, but the user lacks the Rules feature privilege | Stop and tell the user which privilege they need; do not use classic alerting |
Any other result — another status code, a 404 followed by a failed GET kbn:/api/status, an authentication error, or no
connection — says nothing about availability: stop and report the error. Do not use classic alerting.
When using classic alerting, do not ask first, and say in the final report why the rule is classic: the stated version or the meaning from the table. For a find or list request, report classic results only and say why. A request that needs an action policy or routing tag has no classic equivalent; tell the user why Universal Alerting is unavailable instead.
Identify the job. Match the request to one or more rows below. A request can combine jobs — for example a new rule and its notifications — and they can be done in either order, because a shared routing tag links a Universal Alerting rule to its policies.
| Job | Example request | System | Read before writing |
|---|---|---|---|
| Find or list | "Show me all production alerting rules" | Both systems, read-only — create, update, enable, or delete nothing | — |
| New rule with notifications | "Alert me / page on-call when CPU is above 90% on any host" | Universal Alerting | universal-rules.md, universal-action-policies.md, universal-workflow-destinations.md |
| New rule without notifications | "Record every time checkout latency exceeds 2 seconds" | Universal Alerting | universal-rules.md |
| Notifications only | "Send payments alerts to Slack instead of email", "Snooze the on-call policy" | Universal Alerting — action policies; a rule changes only to add a routing tag the user agrees to | universal-action-policies.md, plus universal-workflow-destinations.md when a destination changes |
| Edit an existing rule or change its lifecycle | "Disable rule cpu-web" | Either system, depends on where result appears | That system's references |
| New rule of a named classic type | "Create an Elasticsearch query rule that…" | Classic | classic-rules.md, classic-rule-types.md, plus classic-actions-connectors-terraform.md for notifications |
| Terraform for a rule | "Manage an index threshold rule with Terraform" | Route as any other request. The Terraform resource (elasticstack_kibana_alerting_rule) covers classic rules only: for Universal Alerting, tell the user and offer the API instead | classic-actions-connectors-terraform.md for a classic rule |
Reference paths are relative to references/ (see References). Never mix systems: Universal Alerting
rules have no rule-level actions, and classic rules have no action policies or routing tags.
Find what the request refers to. If the request does not identify which rules or action policies it intends — for example "the payments rules" or "my production alerts" with no tag, name, or ID — ask the user before making any API calls; do not search rule names to guess the set. When the user refers to an existing rule by ID, name, or tag, search both systems — Universal Alerting first, then classic — and use whichever returns a match. Run both searches even when the first one matches, so a rule with the same name or tag in the other system is not missed:
| Given | Universal Alerting | Classic alerting |
|---|---|---|
| ID | GET kbn:/api/alerting/v2/rules/{id} | GET kbn:/api/alerting/rule/{id} |
| Name | GET kbn:/api/alerting/v2/rules with search=<name> | GET kbn:/api/alerting/rules/_find with search=<name>&search_fields=name |
| Tag | GET kbn:/api/alerting/v2/rules with filter=metadata.tags:"<tag>" | GET kbn:/api/alerting/rules/_find with filter=alert.attributes.tags:"<tag>" |
| Routing tag | GET kbn:/api/alerting/v2/rules with filter=metadata.routing_tags:"<tag>" | — (classic rules have no routing tags) |
List and find responses are paged: request the next page while the items returned so far are fewer than total.
Skip one search only when the user's wording belongs to a single system:
| User says | Search |
|---|---|
| "routing tag", "action policy", "alert kind" or "signal kind", "universal rule", "v2" | Universal Alerting only |
| A classic rule type ("index threshold rule", "Elasticsearch query rule") | Classic only |
| "connector", "tag", "label", or a bare name or ID | Both systems |
"Snooze" and "mute" do not determine which alerting system to use: classic rules are snoozed on the rule, while Universal Alerting notifications are snoozed on action policies.
If only one system matches, use it. If both match, show both to the user and ask which they mean. If neither matches, say so — do not create a rule in its place. For a find or list request with no system named, report the results from both systems, labeled by system.
Before editing or deleting a rule, confirm matches with user to ensure they're mutating the intended object. Do not assume without their confirmation unless a single result matches exactly.
Action policies exist only in Universal Alerting; find them with Find policies.
Verify by reading back. After every write, read the rule or policy again and report its live id, name, enabled state, and, for notifications, the matcher and destinations. Do not claim success without the read-back.
User: "Page the on-call workflow wf-pagerduty when CPU is above 90% on any host for 5 minutes."
GET kbn:/api/alerting/v2/rules with per_page=1 →
available.universal-rules.md; POST kbn:/api/alerting/v2/rules with an alert-kind rule grouped by host.name and a
routing tag such as notify-host-cpu-high.universal-action-policies.md and universal-workflow-destinations.md; check the license and wf-pagerduty,
then POST kbn:/api/alerting/v2/action_policies matching that routing tag.User: "Send alerts from rules tagged team-payments to Slack workflow wf-slack instead of email."
The user wants to change where alerts are sent, not what triggers them, so edit action policies and leave the rules' queries unchanged. Alerts can match several policies, so changing one policy may leave another still sending email:
GET kbn:/api/alerting/v2/rules with filter=metadata.tags:"team-payments", and collect their
metadata.routing_tags.universal-action-policies.md and list the policies that send those rules' alerts: those that always match
(catch-alls, and tag matches without an expression) and, labeled as possible matches, those with a
matcher.expression.wf-slack, then PATCH the destinations of each confirmed policy.User: "Snooze rule cpu-web for two hours."
GET kbn:/api/alerting/v2/rules/cpu-web → 404. GET kbn:/api/alerting/rule/cpu-web → found.classic-rules.md and use its snooze call.User: "Create an Elasticsearch query rule that fires when more than 100 error logs arrive in 10 minutes."
The user named a classic rule type: read classic-rules.md and classic-rule-types.md, then create the classic rule
they describe.
kbn:/s/<space_id>/ for non-default Kibana spaces. Rules, policies, connectors, and workflows are
space-scoped and must share a space.consumer: "securitySolution"/"siem" and
/api/detection_engine/rules belong to the Security Detections API.https://www.elastic.co/docs/api/doc/kibana/operation/operation-<command>, where <command> is the CLI command name
from the Operations table (for example operation-patch-alerting-v2-action-policies-id)elastic kb is shorthand for elastic stack kb. Universal Alerting and Workflows write commands take the JSON body
from --input-file '<path.json>'. Add --space '<space_id>' for a non-default space. If the CLI rejects a command name
from this table, run elastic kb alerting-v2 --help (or the matching command group) and use the listed name.
| HTTP API (shorthand) | elastic CLI command |
|---|---|
GET /_license | elastic es license get |
GET kbn:/api/status | elastic kb system get-status |
POST /_query | elastic es esql query --query '<esql>' |
GET kbn:/api/alerting/v2/rules | elastic kb alerting-v2 get-alerting-v2-rules [--filter '<kql>'] [--search '<q>'] [--page <n>] [--per-page <n>] [--sort-field <field>] [--sort-order asc|desc] |
POST kbn:/api/alerting/v2/rules | elastic kb alerting-v2 post-alerting-v2-rules --input-file '<rule.json>' |
GET kbn:/api/alerting/v2/rules/{id} | elastic kb alerting-v2 get-alerting-v2-rules-id --id '<id>' |
PUT kbn:/api/alerting/v2/rules/{id} | elastic kb alerting-v2 put-alerting-v2-rules-id --id '<id>' --input-file '<rule.json>' |
PATCH kbn:/api/alerting/v2/rules/{id} | elastic kb alerting-v2 patch-alerting-v2-rules-id --id '<id>' --input-file '<patch.json>' |
DELETE kbn:/api/alerting/v2/rules/{id} | elastic kb alerting-v2 delete-alerting-v2-rules-id --id '<id>' |
POST kbn:/api/alerting/v2/rules/{id}/_enable | elastic kb alerting-v2 post-alerting-v2-rules-id-enable --id '<id>' |
POST kbn:/api/alerting/v2/rules/{id}/_disable | elastic kb alerting-v2 post-alerting-v2-rules-id-disable --id '<id>' |
POST kbn:/api/alerting/v2/rules/_bulk_enable | elastic kb alerting-v2 post-alerting-v2-rules-bulk-enable --input-file '<ids.json>' |
POST kbn:/api/alerting/v2/rules/_bulk_disable | elastic kb alerting-v2 post-alerting-v2-rules-bulk-disable --input-file '<ids.json>' |
POST kbn:/api/alerting/v2/rules/_bulk_delete | elastic kb alerting-v2 post-alerting-v2-rules-bulk-delete --input-file '<ids.json>' |
GET kbn:/api/alerting/v2/action_policies | elastic kb alerting-v2 get-alerting-v2-action-policies [--filter '<kql>'] [--search '<q>'] [--page <n>] [--per-page <n>] [--sort-field <field>] [--sort-order asc|desc] |
GET kbn:/api/alerting/v2/action_policies/{id} | elastic kb alerting-v2 get-alerting-v2-action-policies-id --id '<id>' |
POST kbn:/api/alerting/v2/action_policies | elastic kb alerting-v2 post-alerting-v2-action-policies --input-file '<policy.json>' |
PUT kbn:/api/alerting/v2/action_policies/{id} | elastic kb alerting-v2 put-alerting-v2-action-policies-id --id '<id>' --input-file '<policy.json>' |
PATCH kbn:/api/alerting/v2/action_policies/{id} | elastic kb alerting-v2 patch-alerting-v2-action-policies-id --id '<id>' --input-file '<patch.json>' |
DELETE kbn:/api/alerting/v2/action_policies/{id} | elastic kb alerting-v2 delete-alerting-v2-action-policies-id --id '<id>' |
POST kbn:/api/alerting/v2/action_policies/{id}/_enable | elastic kb alerting-v2 post-alerting-v2-action-policies-id-enable --id '<id>' |
POST kbn:/api/alerting/v2/action_policies/{id}/_disable | elastic kb alerting-v2 post-alerting-v2-action-policies-id-disable --id '<id>' |
POST kbn:/api/alerting/v2/action_policies/{id}/_snooze | elastic kb alerting-v2 post-alerting-v2-action-policies-id-snooze --id '<id>' --input-file '<snooze.json>' |
POST kbn:/api/alerting/v2/action_policies/{id}/_unsnooze | elastic kb alerting-v2 post-alerting-v2-action-policies-id-unsnooze --id '<id>' |
POST kbn:/api/alerting/v2/action_policies/{id}/_update_api_key | elastic kb alerting-v2 post-alerting-v2-action-policies-id-update-api-key --id '<id>' |
POST kbn:/api/alerting/v2/action_policies/_bulk_enable | elastic kb alerting-v2 post-alerting-v2-action-policies-bulk-enable --input-file '<ids.json>' |
POST kbn:/api/alerting/v2/action_policies/_bulk_disable | elastic kb alerting-v2 post-alerting-v2-action-policies-bulk-disable --input-file '<ids.json>' |
POST kbn:/api/alerting/v2/action_policies/_bulk_snooze | elastic kb alerting-v2 post-alerting-v2-action-policies-bulk-snooze --input-file '<ids-and-snooze.json>' |
POST kbn:/api/alerting/v2/action_policies/_bulk_unsnooze | elastic kb alerting-v2 post-alerting-v2-action-policies-bulk-unsnooze --input-file '<ids.json>' |
POST kbn:/api/alerting/v2/action_policies/_bulk_update_api_key | elastic kb alerting-v2 post-alerting-v2-action-policies-bulk-update-api-key --input-file '<ids.json>' |
POST kbn:/api/alerting/v2/action_policies/_bulk_delete | elastic kb alerting-v2 post-alerting-v2-action-policies-bulk-delete --input-file '<ids.json>' |
GET kbn:/api/workflows/connectors | elastic kb workflows get-workflows-connectors |
GET kbn:/api/workflows/schema | elastic kb workflows get-workflows-schema --loose false |
POST kbn:/api/workflows/test | elastic kb workflows post-workflows-test --input-file '<test.json>' |
GET kbn:/api/workflows/executions/{executionId} | elastic kb workflows get-workflows-executions-executionid --execution-id '<id>' |
GET kbn:/api/workflows/executions/{executionId}/logs | elastic kb workflows get-workflows-executions-executionid-logs --execution-id '<id>' |
GET kbn:/api/workflows/workflow/{id} | elastic kb workflows get-workflows-workflow-id --id '<id>' |
POST kbn:/api/workflows/workflow | elastic kb workflows post-workflows-workflow --input-file '<workflow.json>' |
PUT kbn:/api/workflows/workflow/{id} | elastic kb workflows put-workflows-workflow-id --id '<id>' --input-file '<workflow.json>' |
GET kbn:/api/actions/connector/{id} | elastic kb connectors get-actions-connector-id --id '<id>' |
GET kbn:/api/alerting/rules/_find | elastic kb alerting get-alerting-rules-find [--filter '<kql>'] [--search '<q>'] [--per-page <n>] [--page <n>] [--sort-field <field>] [--sort-order asc|desc] |
POST kbn:/api/alerting/rule/{id} | elastic kb alerting post-alerting-rule-id --id '<id>' --name '<name>' --rule-type-id '<type>' --consumer '<consumer>' --schedule '<json>' --params '<json>' [--tags '<json>'] [--actions '<json>'] [--enabled] |
GET kbn:/api/alerting/rule/{id} | elastic kb alerting get-alerting-rule-id --id '<id>' |
PUT kbn:/api/alerting/rule/{id} | elastic kb alerting put-alerting-rule-id --id '<id>' --name '<name>' --schedule '<json>' --params '<json>' [--tags '<json>'] [--actions '<json>'] |
DELETE kbn:/api/alerting/rule/{id} | elastic kb alerting delete-alerting-rule-id --id '<id>' |
POST kbn:/api/alerting/rule/{id}/_enable | elastic kb alerting post-alerting-rule-id-enable --id '<id>' |
POST kbn:/api/alerting/rule/{id}/_disable | elastic kb alerting post-alerting-rule-id-disable --id '<id>' [--untrack] |
POST kbn:/api/alerting/rule/{id}/_mute_all | elastic kb alerting post-alerting-rule-id-mute-all --id '<id>' |
POST kbn:/api/alerting/rule/{id}/_unmute_all | elastic kb alerting post-alerting-rule-id-unmute-all --id '<id>' |
POST kbn:/api/alerting/rule/{id}/_update_api_key | elastic kb alerting post-alerting-rule-id-update-api-key --id '<id>' |
POST kbn:/api/alerting/rule/{rule_id}/alert/{alert_id}/_mute | elastic kb alerting post-alerting-rule-rule-id-alert-alert-id-mute --rule-id '<rule_id>' --alert-id '<alert_id>' |
POST kbn:/api/alerting/rule/{rule_id}/alert/{alert_id}/_unmute | elastic kb alerting post-alerting-rule-rule-id-alert-alert-id-unmute --rule-id '<rule_id>' --alert-id '<alert_id>' |
POST kbn:/api/alerting/rule/{id}/snooze_schedule | elastic kb alerting post-alerting-rule-id-snooze-schedule --id '<id>' --schedule '<json>' |
DELETE kbn:/api/alerting/rule/{ruleId}/snooze_schedule/{scheduleId} | elastic kb alerting delete-alerting-rule-ruleid-snooze-schedule-scheduleid --rule-id '<ruleId>' --schedule-id '<scheduleId>' |
AFaffaan-m/ECC314k4,125 new stars in the last 7 days
Audit the whole repo: find bugs, security holes and performance bottlenecks. Get a ranked report in plain English.
DIDietrichGebert/ponytail202k4,780 new stars in the last 7 days
GAgarrytan/gstack143k636 new stars in the last 7 days
Harden code against the OWASP Top 10: input handling, authentication, sessions and dependencies.
ADaddyosmani/agent-skills122k1,627 new stars in the last 7 days
ADaddyosmani/agent-skills122k1,627 new stars in the last 7 days
RUruvnet/RuView106k693 new stars in the last 7 days