Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add rule parse error check for auto PR #580

Merged
merged 3 commits into from
Jan 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions .github/workflows/rule-parse-error-check.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Rule parse error check

on:
workflow_dispatch:
pull_request:

jobs:
Expand All @@ -26,9 +27,16 @@ jobs:
repository: Yamato-Security/hayabusa-sample-evtx
path: hayabusa-sample-evtx

- name: Set up Rust toolchain
if: ${{ steps.skip_check.outputs.should_skip != 'true' }}
uses: dtolnay/rust-toolchain@stable

- name: run csv-timeline
run: cd hayabusa && cargo run --release -- csv-timeline -d ../hayabusa-sample-evtx -r ../hayabusa-rules -w -o timeline.csv | grep "Rule parsing error" | wc -l | grep 0
run: |
cd hayabusa
git fetch --prune --unshallow
LATEST_VER=`git describe --tags --abbrev=0`
URL="https://github.com/Yamato-Security/hayabusa/releases/download/${LATEST_VER}/hayabusa-${LATEST_VER#v}-linux.zip"
mkdir tmp
cd tmp
curl -OL $URL
unzip *.zip
chmod +x hayabusa-${LATEST_VER#v}-lin-x64-gnu
./hayabusa-${LATEST_VER#v}-lin-x64-gnu csv-timeline -d ../../hayabusa-sample-evtx -r ../../hayabusa-rules -w -o out.csv
./hayabusa-${LATEST_VER#v}-lin-x64-gnu csv-timeline -d ../../hayabusa-sample-evtx -r ../../hayabusa-rules -w -o out.csv -C | grep "Rule parsing error" | wc -l | grep 0
48 changes: 46 additions & 2 deletions .github/workflows/update-sigmarule.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,57 @@ name: Pipeline for sigma rule updates

on:
## This workflow is executed once a day.
## I added workflow_dispatch so that you can execute this workflow from the GitHub UI.
## I added workflow_dispatch so that you can execute this workflow from the GitHub UI.
workflow_dispatch:
inputs:
rule-parse-error-check:
description: If true, check rule parse error
required: false
type: boolean
default: true
schedule:
- cron: '0 20 * * *'
- cron: '0 20 * * *'

jobs:
rule-parse-error-check:
runs-on: ubuntu-latest
steps:
- name: clone hayabusa rule repo
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
path: hayabusa-rules

- name: clone hayabusa
uses: actions/checkout@v3
with:
repository: Yamato-Security/hayabusa
submodules: recursive
path: hayabusa

- name: clone hayabusa-sample-evtx
uses: actions/checkout@v3
with:
repository: Yamato-Security/hayabusa-sample-evtx
path: hayabusa-sample-evtx

- name: run csv-timeline
if: inputs.rule-parse-error-check
run: |
cd hayabusa
git fetch --prune --unshallow
LATEST_VER=`git describe --tags --abbrev=0`
URL="https://github.com/Yamato-Security/hayabusa/releases/download/${LATEST_VER}/hayabusa-${LATEST_VER#v}-linux.zip"
mkdir tmp
cd tmp
curl -OL $URL
unzip *.zip
chmod +x hayabusa-${LATEST_VER#v}-lin-x64-gnu
./hayabusa-${LATEST_VER#v}-lin-x64-gnu csv-timeline -d ../../hayabusa-sample-evtx -r ../../hayabusa-rules -w -o out.csv
./hayabusa-${LATEST_VER#v}-lin-x64-gnu csv-timeline -d ../../hayabusa-sample-evtx -r ../../hayabusa-rules -w -o out.csv -C | grep "Rule parsing error" | wc -l | grep 0

updateSigmaRule:
needs: rule-parse-error-check
runs-on: ubuntu-latest
steps:
- name: clone hayabusa rule repo
Expand Down