From bf686bbabd179d3c79b0463e0bfc2f9c59defdf2 Mon Sep 17 00:00:00 2001 From: Eder Date: Wed, 12 Aug 2026 00:28:22 -0400 Subject: [PATCH] feat(security): add GHAS-free baseline caller --- .github/workflows/security-baseline.yml | 27 ++++++++++++++++++++++ scripts/test_security_baseline_workflow.py | 25 ++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 .github/workflows/security-baseline.yml create mode 100644 scripts/test_security_baseline_workflow.py diff --git a/.github/workflows/security-baseline.yml b/.github/workflows/security-baseline.yml new file mode 100644 index 0000000..ec16b9f --- /dev/null +++ b/.github/workflows/security-baseline.yml @@ -0,0 +1,27 @@ +name: Security baseline + +# Required caller emits status on every pull request; scanner scope belongs in reusable inputs. +on: + pull_request: + push: + branches: [main] + workflow_dispatch: + +permissions: + contents: read + +jobs: + gitleaks: + uses: Staros-Labs/infra/.github/workflows/reusable-security-gitleaks.yml@07dce02accd706afbcb8a8b420de0979d3f03364 + with: + report_only: true + scan_history: false + permissions: + contents: read + + osv: + uses: Staros-Labs/infra/.github/workflows/reusable-security-osv.yml@07dce02accd706afbcb8a8b420de0979d3f03364 + with: + report_only: true + permissions: + contents: read diff --git a/scripts/test_security_baseline_workflow.py b/scripts/test_security_baseline_workflow.py new file mode 100644 index 0000000..83da37f --- /dev/null +++ b/scripts/test_security_baseline_workflow.py @@ -0,0 +1,25 @@ +from pathlib import Path +import unittest + + +WORKFLOW = Path(__file__).parents[1] / ".github/workflows/security-baseline.yml" + + +class SecurityBaselineWorkflowTests(unittest.TestCase): + def test_caller_uses_pinned_ghas_free_scanners(self) -> None: + text = WORKFLOW.read_text(encoding="utf-8") + self.assertIn("pull_request:", text) + self.assertIn("push:\n branches: [main]", text) + self.assertIn("workflow_dispatch:", text) + self.assertIn("Staros-Labs/infra/.github/workflows/reusable-security-gitleaks.yml@07dce02accd706afbcb8a8b420de0979d3f03364", text) + self.assertIn("Staros-Labs/infra/.github/workflows/reusable-security-osv.yml@07dce02accd706afbcb8a8b420de0979d3f03364", text) + self.assertEqual(text.count("report_only: true"), 2) + self.assertNotIn("github/codeql-action", text) + self.assertNotIn("security-events", text) + self.assertNotIn("upload-sarif", text) + self.assertNotIn("paths:", text) + self.assertNotIn("paths-ignore:", text) + + +if __name__ == "__main__": + unittest.main()