diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..bda8113 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,8 @@ +## Summary + + + +## Testing + + + diff --git a/.github/workflows/security.yml b/.github/workflows/security.yml new file mode 100644 index 0000000..e39658c --- /dev/null +++ b/.github/workflows/security.yml @@ -0,0 +1,43 @@ +name: Security + +on: + push: + branches: [main] + pull_request: + +permissions: {} + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + gitleaks: + name: Gitleaks + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: read + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + fetch-depth: 0 + persist-credentials: false + - uses: gitleaks/gitleaks-action@e0c47f4f8be36e29cdc102c57e68cb5cbf0e8d1e # v3.0.0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITLEAKS_ENABLE_COMMENTS: false + + zizmor: + name: Zizmor + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + - uses: zizmorcore/zizmor-action@45d7276c9ca790aabd705e31ca99c6185c3e76dd # v0.8.1 + with: + advanced-security: false + annotations: true diff --git a/.gitignore b/.gitignore index 6f596e1..4263813 100644 --- a/.gitignore +++ b/.gitignore @@ -218,3 +218,8 @@ __marimo__/ # Streamlit .streamlit/secrets.toml + +# Claude + +.claude +CLAUDE.md diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..af03abf --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,14 @@ +repos: + - repo: local + hooks: + - id: gitleaks + name: gitleaks + entry: just gitleaks --pre-commit --staged + language: system + pass_filenames: false + - id: zizmor + name: zizmor + entry: just zizmor + language: system + pass_filenames: false + files: ^\.github/ diff --git a/Brewfile b/Brewfile new file mode 100644 index 0000000..7747aaa --- /dev/null +++ b/Brewfile @@ -0,0 +1,4 @@ +brew "gitleaks" +brew "just" +brew "prek" +brew "zizmor" diff --git a/README.md b/README.md index dacb320..c5da3f7 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,25 @@ -# cyber-security-lab +# Cybersecurity Lab + +[![Security](https://github.com/ahcodedev/cyber-security-lab/actions/workflows/security.yml/badge.svg?branch=main)](https://github.com/ahcodedev/cyber-security-lab/actions/workflows/security.yml) +[![gitleaks](https://img.shields.io/badge/protected%20by-gitleaks-blue)](https://github.com/gitleaks/gitleaks) +[![zizmor](https://img.shields.io/badge/%F0%9F%8C%88-zizmor-white?labelColor=white)](https://zizmor.sh/) + Cybersecurity Lab Environment + +## Setup + +```sh +brew bundle +prek install +``` + +## Security checks + +| Command | Purpose | +| --------------- | --------------------------------- | +| `just gitleaks` | Scan git history for secrets | +| `just zizmor` | Audit GitHub Actions workflows | +| `prek run -a` | Run the pre-commit hooks manually | + +Both checks run on commit via prek and in CI via `.github/workflows/security.yml`. + \ No newline at end of file diff --git a/justfile b/justfile new file mode 100644 index 0000000..0ca2eea --- /dev/null +++ b/justfile @@ -0,0 +1,11 @@ +[private] +list: + @just --list + +# Scan git history for secrets +gitleaks *args: + gitleaks git --redact --verbose {{ args }} + +# Audit GitHub Actions workflows +zizmor *args: + zizmor {{ args }} .