spec-kit icon indicating copy to clipboard operation
spec-kit copied to clipboard

ci: add dependency audit workflow

Open PascalThuet opened this issue 5 months ago • 1 comments

Part of splitting #2442 into smaller, dedicated PRs. This is the original #2438 ask — the dependency-audit workflow — re-derived against current main.

What

  • New .github/workflows/security.yml with dependency-audit coverage split by trigger:
    • push / PR / manual: one deterministic dependency-audit job audits the committed .github/security-audit-requirements.txt snapshot with pip-audit --require-hashes.
    • weekly schedule: dependency-audit-scheduled compiles the runtime + test dependency set live per (os, python) matrix entry (ubuntu/windows × 3.11/3.12/3.13) and audits that, to catch newly published advisories the committed snapshot wouldn't.
  • .github/scripts/check_security_requirements.py: a sync gate that fails a PR which changed pyproject.toml (or the snapshot) without regenerating the committed requirements.
  • .github/security-audit-requirements.txt: the committed --universal --generate-hashes snapshot (generated against current main).
  • tests/test_security_workflow.py: static guards for the jobs, matrix, pins, hashed snapshot, and the sync script. Triggers are asserted by inclusion so the follow-up baseline-gate PR can add labeled/unlabeled without rewriting the test.
  • CONTRIBUTING.md: a "Security checks" subsection documenting the local commands.

Why

Gives CI a deterministic dependency-advisory signal on every PR plus a live scheduled sweep, without a lockfile or redundant PR matrix runs.

Validation

  • tests/test_security_workflow.py — 12 passed.
  • uvx ruff check .github/scripts/check_security_requirements.py tests/test_security_workflow.py is clean.
  • pip-audit --require-hashes against the committed snapshot reports no known vulnerabilities.
  • A fresh uv pip compile ... --no-header is byte-identical to the committed snapshot (sync gate passes).
  • Actions pinned to commit SHAs (actions/checkout aligned to the repo-standard 9c091bb... # v7.0.0).

Bandit + secret-scan gates are deliberately not here — they come in a follow-up PR so each gate reviews on its own. Independent of the other split PRs.

Disclosure: Updated on behalf of @PascalThuet by Codex (model: GPT-5, autonomous).

PascalThuet avatar Jun 23 '26 21:06 PascalThuet

Please address Copilot feedback

mnriem avatar Jun 29 '26 15:06 mnriem

Security audit review summary

Audit feedback addressed

  • Full checkout history keeps dependency diff bases available.
  • Missing GENERATED_REQUIREMENTS configuration now fails with an actionable message.
  • setup-python and setup-uv use the repository-standard pinned SHAs.
  • The scheduled audit matrix now covers Python 3.11, 3.12, 3.13, and 3.14 on Ubuntu and Windows.

Failed check resolution

The previous Dependency audit failure was caused by a genuinely stale committed requirements snapshot. It has been regenerated from current main, and the sync gate now accepts it.

Validation

  • Security/static workflow tests: 17 passed
  • Full suite: 4,446 passed, 112 skipped
  • Ruff: passed
  • Snapshot sync gate: passed
  • pip-audit: no known vulnerabilities found
  • git diff --check: passed

Head commit: 6c6ab783c49faf330d5262f007057626ed11631b


Posted on behalf of @PascalThuet by Codex (model: GPT-5, autonomous).

PascalThuet avatar Jul 20 '26 15:07 PascalThuet

@mnriem

One maintenance-policy question surfaced while rebasing this PR: pyproject.toml still declares Python >=3.11, while the functional CI matrix currently tests only Python 3.13 and 3.14. The scheduled security audit covers 3.11 through 3.14.

Could you confirm whether Python 3.11 and 3.12 remain officially supported, or are merely installable without CI guarantees?

Depending on the intended policy, we could either retain 3.11–3.14 in the scheduled audit or align it with the functional CI matrix.

Separately, the rebase exposed version drift for pinned actions between workflows (setup-uv v8.2.0 versus the repository-standard v8.3.2). This PR now aligns them, but a shared consistency check or documented convention could prevent future drift

PascalThuet avatar Jul 20 '26 15:07 PascalThuet

Addressed the latest Copilot review round.

The contributor guidance now explicitly describes the pip-audit command as auditing the committed snapshot and requires dependency changes to refresh and commit that snapshot before auditing. I also regenerated the snapshot to incorporate platformdirs 4.11.0, which fixes the current dependency-audit sync failure.

Validation: 17 security/workflow tests passed; the snapshot sync gate passed; pip-audit reported no known vulnerabilities; git diff --check passed. Markdownlint still reports two pre-existing fence-style findings at CONTRIBUTING.md:180 and CONTRIBUTING.md:194, outside this change.

Commit: 7032366caaf5e1c492d6777999882124f9e2a37f

Posted on behalf of @PascalThuet by Codex (model: GPT-5, autonomous).

PascalThuet avatar Jul 21 '26 15:07 PascalThuet

@mnriem

One maintenance-policy question surfaced while rebasing this PR: pyproject.toml still declares Python >=3.11, while the functional CI matrix currently tests only Python 3.13 and 3.14. The scheduled security audit covers 3.11 through 3.14.

Could you confirm whether Python 3.11 and 3.12 remain officially supported, or are merely installable without CI guarantees?

They are supported indeed without direct CI guarantee. If a bug shows up, we will fix it. As those 2 versions are already security fixes only from Python perspective, we do not anticipate that to occur regularly.

Depending on the intended policy, we could either retain 3.11–3.14 in the scheduled audit or align it with the functional CI matrix.

If it does not cause extra churn include 3.11 and 3.12

Separately, the rebase exposed version drift for pinned actions between workflows (setup-uv v8.2.0 versus the repository-standard v8.3.2). This PR now aligns them, but a shared consistency check or documented convention could prevent future drift

The alignment will be forced by updates needed for the GitHub agentic workflows on the one hand and the Dependabot fixes on the other hand

mnriem avatar Jul 22 '26 09:07 mnriem

Thank you!

mnriem avatar Jul 22 '26 10:07 mnriem