Skip to content

Multi-tier framework for evaluating AI agent skills and plugins with quality gates, security scanning, harness compatibility checks, semantic overlap detection, synthetic evaluation dataset generation, and live agent evaluation that measures how skills affect agent behavior. Ships reusable CI templates that bring every check to any repository.

fix(ci): scope Gitleaks to checked-out history (#106)

Rio Yub9d2f966dd08
diff --git a/.github/workflows/security.yml b/.github/workflows/security.yml
index 6bf9e4f8..c34623db 100644
--- a/.github/workflows/security.yml
+++ b/.github/workflows/security.yml
@@ -57,13 +57,30 @@ jobs:
- name: Verify full Git checkout
run: |
test -d .git
- test "$(git rev-list --count HEAD)" -gt 0
+ test "$(git rev-parse --is-shallow-repository)" = "false"
+ git rev-parse --verify "HEAD^{commit}" >/dev/null
- name: Scan Git history
- run: >-
- docker run --rm
- --volume "$PWD:/repo:ro"
- ghcr.io/gitleaks/gitleaks:v8.30.0@sha256:691af3c7c5a48b16f187ce3446d5f194838f91238f27270ed36eef6359a574d9
- git --no-banner --redact --verbose /repo
+ # Pull requests and main pushes scan only history reachable from the
+ # checked-out commit. Audits keep --all so unmerged refs and tags stay
+ # covered. Re-derive these v8.30.0 options when bumping the image.
+ shell: bash
+ run: |
+ set -euo pipefail
+ case "$GITHUB_EVENT_NAME" in
+ pull_request|push)
+ log_opts="--full-history --diff-filter=tuxdb HEAD --"
+ ;;
+ # Unknown future events deliberately receive the wider audit.
+ *)
+ log_opts="--full-history --all --diff-filter=tuxdb --"
+ ;;
+ esac
+
+ docker run --rm \
+ --volume "$PWD:/repo:ro" \
+ ghcr.io/gitleaks/gitleaks:v8.30.0@sha256:691af3c7c5a48b16f187ce3446d5f194838f91238f27270ed36eef6359a574d9 \
+ git --no-banner --redact --verbose \
+ --log-opts="$log_opts" /repo
dependency-review:
name: Dependency review
diff --git a/tests/test_ci_workflows.py b/tests/test_ci_workflows.py
index e92a708d..a3a03f82 100644
--- a/tests/test_ci_workflows.py
+++ b/tests/test_ci_workflows.py
@@ -174,6 +174,37 @@ def test_security_keeps_gitleaks_always_on_and_skips_only_nonessential_jobs() ->
assert "vars.ENABLE_GITHUB_ADVANCED_SECURITY == 'true'" in codeql_if
+def test_gitleaks_uses_event_specific_full_history_scopes() -> None:
+ job = _load("security.yml")["jobs"]["gitleaks"]
+ checkout = next(
+ step for step in job["steps"] if step.get("uses", "").startswith("actions/checkout@")
+ )
+ verify = next(step for step in job["steps"] if step.get("name") == "Verify full Git checkout")
+ scan = next(step for step in job["steps"] if step.get("name") == "Scan Git history")
+
+ assert str(checkout["with"]["fetch-depth"]) == "0"
+ assert 'test "$(git rev-parse --is-shallow-repository)" = "false"' in verify["run"]
+ assert 'git rev-parse --verify "HEAD^{commit}"' in verify["run"]
+ assert (
+ "gitleaks:v8.30.0@sha256:691af3c7c5a48b16f187ce3446d5f194838f91238f27270ed36eef6359a574d9"
+ in scan["run"]
+ )
+ scan_run = scan["run"]
+ head_opts = "--full-history --diff-filter=tuxdb HEAD --"
+ audit_opts = "--full-history --all --diff-filter=tuxdb --"
+ assignments = re.findall(r'log_opts="([^"]+)"', scan_run)
+
+ assert assignments == [head_opts, audit_opts]
+ assert scan["shell"] == "bash"
+ assert "set -euo pipefail" in scan_run
+ assert 'case "$GITHUB_EVENT_NAME" in' in scan_run
+ assert re.search(
+ rf'pull_request\|push\)\s+log_opts="{re.escape(head_opts)}"\s+;;', scan_run
+ )
+ assert re.search(rf'\*\)\s+log_opts="{re.escape(audit_opts)}"\s+;;', scan_run)
+ assert '--log-opts="$log_opts"' in scan_run
+
+
def test_dco_stays_unconditional_and_has_no_path_filter() -> None:
dco = _load("dco.yml")
@@ -187,6 +218,7 @@ def test_non_pr_workflow_triggers_are_preserved() -> None:
security = _load("security.yml")
assert ci["on"]["push"] == {"branches": ["main"]}
+ assert set(security["on"]) == {"pull_request", "push", "schedule", "workflow_dispatch"}
assert security["on"]["push"] == {"branches": ["main"]}
assert security["on"]["schedule"] == [{"cron": "23 7 * * 1"}]
assert "workflow_dispatch" in security["on"]