-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yaml
40 lines (39 loc) · 1.42 KB
/
action.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
name: Sigma Rules Validator
description: "Validate Sigma rules using the JSON schema"
branding:
icon: check-circle
color: green
inputs:
paths:
description: "Paths to the Sigma rules (can be a newline-separated list of paths or files)"
required: false
default: "./"
schemaURL:
description: "URL of the JSON schema"
required: false
default: "https://raw.githubusercontent.com/SigmaHQ/sigma-specification/main/sigma-schema.json"
schemaFile:
description: "Path to the local JSON schema"
required: false
runs:
using: "composite"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
- name: Install dependencies
shell: bash
run: pip install requests check-jsonschema
- name: Validate Sigma rules
shell: bash
run: |
echo "Downloading validate.py from Sigma repository"
wget -O ${{ github.action_path }}/validate.py https://raw.githubusercontent.com/SigmaHQ/sigma/master/tests/validate-sigma-schema/validate.py
echo "Validating Sigma rules against sigma-schema.json"
check-jsonschema --schemafile $(python ${{ github.action_path }}/validate.py schema) $(sudo -E python ${{ github.action_path }}/validate.py rules)
env:
SIGMA_RULES_PATH: ${{ inputs.paths }}
SIGMA_SCHEMA_URL: ${{ inputs.schemaURL }}
SIGMA_SCHEMA_FILE: ${{ inputs.schemaFile }}