Skip to content
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
4 changes: 3 additions & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# Global default code owners
* @lopes

# Reusable Security Workflows & Gitleaks Baseline
# Reusable Security Workflows & Scanner Baselines
/.github/workflows/ @lopes
/.github/dependabot.yml @lopes
/.gitleaks.toml @lopes
/.zizmor.yml @lopes

# Account-Wide Security Policy & Documentation
/SECURITY.md @lopes
Expand Down
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ body:
options:
- "Gitleaks Secret Scanning (.gitleaks.toml, security.yml)"
- "Opengrep SAST Scanning (security.yml)"
- "Zizmor GitHub Actions Scanning (.zizmor.yml, security.yml)"
- "Trivy Vulnerability & IaC Scanning (security.yml)"
- "Community Health Defaults (SECURITY.md)"
validations:
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ body:
id: context
attributes:
label: Context
description: "Security rationale, false-positive analysis, execution time impact across caller repositories, and affected files (`.gitleaks.toml`, `security.yml`)."
description: "Security rationale, false-positive analysis, execution time impact across caller repositories, and affected files (`.gitleaks.toml`, `.zizmor.yml`, `security.yml`)."
validations:
required: true
- type: textarea
Expand Down
4 changes: 2 additions & 2 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@

## Type of Change
- [ ] Reusable Security Workflow (`.github/workflows/security.yml`)
- [ ] Canonical Gitleaks Ruleset (`.gitleaks.toml`)
- [ ] Canonical Scanner Baselines (`.gitleaks.toml`, `.zizmor.yml`)
- [ ] Account-Wide Security Policy (`SECURITY.md`)
- [ ] Documentation & Governance (`README.md`, `.github/`)

## Quality Checklist
- [ ] Reusable workflow (`security.yml`) passes on this PR (`gitleaks`, `opengrep`, `trivy`).
- [ ] Reusable workflow (`security.yml`) passes on this PR (`gitleaks`, `opengrep`, `zizmor`, `trivy`).
- [ ] Scanner versions and action tags are explicitly pinned.
- [ ] Downstream impact across caller repositories (`lopes/*`) reviewed.
- [ ] Commit follows [Scoped Commits](https://scopedcommits.com/) convention (`<scope>: <description>`).
46 changes: 37 additions & 9 deletions .github/workflows/security.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,24 @@ jobs:
with:
fetch-depth: 0
path: repo
persist-credentials: false

- name: Checkout shared security baseline
uses: actions/checkout@v7
with:
repository: lopes/.github
path: baseline
persist-credentials: false

- name: Install pinned gitleaks
env:
GITLEAKS_VERSION: ${{ inputs.gitleaks_version || '8.30.1' }}
run: |
set -euo pipefail
[[ "${GITLEAKS_VERSION}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || {
echo "::error::Invalid gitleaks_version '${GITLEAKS_VERSION}' (expected X.Y.Z)" >&2
exit 1
}
curl -fsSL "https://github.com/gitleaks/gitleaks/releases/download/v${GITLEAKS_VERSION}/gitleaks_${GITLEAKS_VERSION}_linux_x64.tar.gz" -o /tmp/gitleaks.tar.gz
tar -xzf /tmp/gitleaks.tar.gz -C /usr/local/bin gitleaks
chmod +x /usr/local/bin/gitleaks
Expand All @@ -86,12 +92,17 @@ jobs:
with:
fetch-depth: 1
path: repo
persist-credentials: false

- name: Install pinned opengrep static binary
env:
OPENGREP_VERSION: ${{ inputs.opengrep_version || '1.33.1' }}
run: |
set -euo pipefail
[[ "${OPENGREP_VERSION}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || {
echo "::error::Invalid opengrep_version '${OPENGREP_VERSION}' (expected X.Y.Z)" >&2
exit 1
}
curl -fsSL "https://github.com/opengrep/opengrep/releases/download/v${OPENGREP_VERSION}/opengrep_manylinux_x86" -o /usr/local/bin/opengrep
chmod +x /usr/local/bin/opengrep
opengrep --version
Expand Down Expand Up @@ -140,18 +151,24 @@ jobs:
with:
fetch-depth: 1
path: repo
persist-credentials: false

- name: Checkout shared security baseline
uses: actions/checkout@v7
with:
repository: lopes/.github
path: baseline
persist-credentials: false

- name: Install pinned zizmor
env:
ZIZMOR_VERSION: ${{ inputs.zizmor_version || '1.32.0' }}
run: |
set -euo pipefail
[[ "${ZIZMOR_VERSION}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || {
echo "::error::Invalid zizmor_version '${ZIZMOR_VERSION}' (expected X.Y.Z)" >&2
exit 1
}
curl -fsSL "https://github.com/zizmorcore/zizmor/releases/download/v${ZIZMOR_VERSION}/zizmor-x86_64-unknown-linux-gnu.tar.gz" -o /tmp/zizmor.tar.gz
tar -xzf /tmp/zizmor.tar.gz -C /usr/local/bin zizmor
chmod +x /usr/local/bin/zizmor
Expand All @@ -160,17 +177,27 @@ jobs:
- name: Audit GitHub Actions workflows
run: |
set -euo pipefail
if [ ! -d repo/.github/workflows ]; then
echo "No .github/workflows directory found; skipping zizmor."
if [ ! -d repo/.github/workflows ] && \
[ ! -f repo/.github/dependabot.yml ] && \
[ ! -f repo/.github/dependabot.yaml ] && \
[ ! -f repo/action.yml ] && \
[ ! -f repo/action.yaml ]; then
echo "No GitHub Actions workflows, composite actions, or dependabot config found; skipping zizmor."
exit 0
fi
if [ -f repo/.zizmor.yml ]; then
CONFIG_PATH="repo/.zizmor.yml"
elif [ -f repo/zizmor.yml ]; then
CONFIG_PATH="repo/zizmor.yml"
else
CONFIG_PATH="baseline/.zizmor.yml"
fi
CONFIG_PATH="baseline/.zizmor.yml"
for candidate in \
repo/.github/zizmor.yml \
repo/.github/zizmor.yaml \
repo/.zizmor.yml \
repo/.zizmor.yaml \
repo/zizmor.yml \
repo/zizmor.yaml; do
if [ -f "${candidate}" ]; then
CONFIG_PATH="${candidate}"
break
fi
done
echo "Using zizmor config: ${CONFIG_PATH}"
zizmor --no-online-audits --config "${CONFIG_PATH}" --min-severity medium repo

Expand All @@ -183,6 +210,7 @@ jobs:
uses: actions/checkout@v7
with:
fetch-depth: 1
persist-credentials: false

- name: Run Trivy filesystem vulnerability and misconfiguration scan
uses: aquasecurity/trivy-action@v0.36.0
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
# .github

Shared GitHub Actions reusable security workflows, canonical `.gitleaks.toml` baseline, and default community health files for `github.com/lopes` repositories.
Shared GitHub Actions reusable security workflows, canonical `.gitleaks.toml` and `.zizmor.yml` baselines, and default community health files for `github.com/lopes` repositories.

## What Lives Here

- **[`.github/workflows/security.yml`](.github/workflows/security.yml)** — Reusable workflow (`workflow_call`) executing four open-source deterministic checks across all repository paths (including `tests/`):
1. **`gitleaks`** (`v8.30.1`) — Full git commit-history secret scan (`fetch-depth: 0`, `--redact`). Uses the caller repository's `.gitleaks.toml` if present, or falls back to this repository's canonical [`.gitleaks.toml`](.gitleaks.toml).
2. **`opengrep`** (`v1.33.1`) — Open-source multi-language static analysis (`python`, `bash`, `rust`, `terraform`, `yaml/github-actions`, `generic/secrets`) at `ERROR` severity.
3. **`zizmor`** (`v1.32.0`) — Dedicated GitHub Actions workflow security auditor (template injection, excessive permissions, dangerous triggers, cache poisoning). Uses the caller repository's `.zizmor.yml` if present, or falls back to this repository's canonical [`.zizmor.yml`](.zizmor.yml).
4. **`trivy`** (`aquasecurity/trivy-action`) — Filesystem dependency vulnerability (`CRITICAL,HIGH` with available fixes) and IaC misconfiguration scan (Terraform, Ansible, Dockerfiles, GitHub Actions, and lockfiles).
3. **`zizmor`** (`v1.32.0`) — Dedicated GitHub Actions workflow security auditor (template injection, excessive permissions, dangerous triggers, cache poisoning). Uses the caller repository's zizmor config (`.github/zizmor.yml`, `.zizmor.yml`, `zizmor.yml`, or `.yaml` variants) if present, or falls back to this repository's canonical [`.zizmor.yml`](.zizmor.yml).
4. **`trivy`** (`aquasecurity/trivy-action` `v0.36.0`) — Filesystem dependency vulnerability (`CRITICAL,HIGH` with available fixes) and IaC misconfiguration scan (Terraform, Ansible, Dockerfiles, GitHub Actions, and lockfiles).
- **[`.gitleaks.toml`](.gitleaks.toml)** — Canonical secret-scanning ruleset extending Gitleaks defaults with explicit URL query-parameter credential detection (`?key=`, `?api_key=`, `?token=`, `?access_token=`, `?license_key=`) and zero `tests/` exclusions.
- **[`.zizmor.yml`](.zizmor.yml)** — Canonical GitHub Actions static analysis baseline enforcing version reference pinning (`ref-pin`) while focusing audits on workflow security flaws (`--min-severity medium`).
- **[`.zizmor.yml`](.zizmor.yml)** — Canonical GitHub Actions static analysis baseline enforcing version reference pinning (`ref-pin`) while focusing audits on workflow security flaws (`--min-severity medium`, with `artipacked` disabled to avoid false positives on standard `actions/checkout` steps in caller workflows that do not upload workspace artifacts).
- **[`SECURITY.md`](SECURITY.md)** — Account-wide default vulnerability disclosure policy inherited automatically by all public repositories under `github.com/lopes` unless overridden locally.

> [!IMPORTANT]
> **Why maintain an account-owned `.github` repository instead of calling a third-party workflow?**
> 1. **Supply-chain containment:** Referencing an external vendor's `uses: org/repo/.github/workflows/...@main` across every public and private repository delegates runner execution and `GITHUB_TOKEN` access to a mutable third-party branch. Owning `lopes/.github` keeps version pinning (`gitleaks`, `opengrep`, `trivy-action`, `actions/checkout`) under direct control while still pulling official upstream binaries and actions.
> 1. **Supply-chain containment:** Referencing an external vendor's `uses: org/repo/.github/workflows/...@main` across every public and private repository delegates runner execution and `GITHUB_TOKEN` access to a mutable third-party branch. Owning `lopes/.github` keeps version pinning (`gitleaks`, `opengrep`, `zizmor`, `trivy-action`, `actions/checkout`) under direct control while still pulling official upstream binaries and actions.
> 2. **Fast, focused execution (~25s vs. 5+ min):** Multi-linter suites (`super-linter`, `megalinter`) pull multi-gigabyte container images on every run and do not bundle `opengrep` or account-wide `.gitleaks.toml` inheritance.
> 3. **Single source of truth:** Updating a scanner version or adding a custom secret rule in `.gitleaks.toml` happens in one commit here rather than opening pull requests across every repository, and GitHub only inherits default community health files (`SECURITY.md`) from `<owner>/.github`.

Expand Down
Loading