Skip to content

Automatically update heatmap json when new rule is pushed to master. #5213

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

JrOrOneEquals1
Copy link

Summary of the Pull Request

Adds a new workflow in GitHub Actions to automatically update 'other/sigma_attack_nav_coverage.json' when a new rule is pushed to master.

The workflow will create and push a new commit containing the updated json when a change is detected between the generated and current json, and the commit message will have the SHA of the triggering commit for reference.

This will overwrite the changes from PR #5210 since it builds from the current sigma-cli. Once the cli gets updated with the new format and version numbers, the json will be updated the next time this workflow runs.

Changelog

chore: workflow - auto-update heatmap

Example Log Event

Fixed Issues

SigmaHQ Rule Creation Conventions

  • If your PR adds new rules, please consider following and applying these conventions

JrOrOneEquals1 and others added 2 commits February 26, 2025 10:03
Create workflow to automatically update heatmap when new rule is pushed to master
@github-actions github-actions bot added the Maintenance Related to additions and update of the repository features label Feb 26, 2025
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Welcome @JrOrOneEquals1 👋

It looks like this is your first pull request on the Sigma rules repository!

Please make sure to read the SigmaHQ conventions document to make sure your contribution is adhering to best practices and has all the necessary elements in place for a successful approval.

Thanks again, and welcome to the Sigma community! 😃

@nasbench nasbench added the Work In Progress Some changes are needed label Feb 28, 2025
@nasbench nasbench self-requested a review February 28, 2025 14:53
Comment on lines 4 to 34
push:
branches: [ "master" ]

jobs:
generate-heatmap:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
ref: ${{ github.ref_name }}
submodules: true

- name: Install Sigma
run: pipx install sigma-cli

- name: Update Heatmap
run: sigma analyze attack count ./other/sigma_attack_nav_coverage.json rule*

- name: Commit and Push Changes
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add ./other/sigma_attack_nav_coverage.json
git add ./other/sigma_attack_nav_coverage.png
if git diff --cached --quiet; then
echo "No changes to commit."
else
git commit -m "Generated heatmap for commit ${{ github.sha }}"
git push origin $GITHUB_REF_NAME
fi
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its not recommended to do it this way.

Please take a look at this workflow we already have https://github.com/SigmaHQ/sigma/blob/master/.github/workflows/sigma-rule-promoter.yml and apply similar changes.

A PR needs to be created and the workflow needs to be run once a month

@nasbench nasbench added the Author Input Required changes the require information from original author of the rules label Mar 5, 2025
Modify update-heatmap.yml to run the workflow once a month, and create a new pull request.
@JrOrOneEquals1
Copy link
Author

Updated the file with those changes, can you check it out?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author Input Required changes the require information from original author of the rules Maintenance Related to additions and update of the repository features Work In Progress Some changes are needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants