[StepSecurity] Apply security best practices#1008
[StepSecurity] Apply security best practices#1008step-security-bot wants to merge 1 commit intoroboflow:developfrom
Conversation
Signed-off-by: StepSecurity Bot <bot@stepsecurity.io>
|
|
|
You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool. What Enabling Code Scanning Means:
For more information about GitHub Code Scanning, check out the documentation. |
Codecov Report✅ All modified and coverable lines are covered by tests. ❌ Your project check has failed because the head coverage (80%) is below the target coverage (95%). You can increase the head coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## develop #1008 +/- ##
=======================================
Coverage 80% 80%
=======================================
Files 100 100
Lines 8447 8447
=======================================
Hits 6774 6774
Misses 1673 1673 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Adds security-oriented automation to the repository (supply-chain hardening, SAST/code scanning, dependency monitoring/review, and secret scanning) to improve the project’s security posture.
Changes:
- Adds StepSecurity harden-runner to multiple GitHub Actions workflows to audit outbound network calls.
- Introduces new GitHub security workflows: CodeQL scanning, OpenSSF Scorecard, and Dependency Review.
- Adds Dependabot updates for GitHub Actions and a gitleaks pre-commit hook.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| .pre-commit-config.yaml | Adds gitleaks hook for local secret scanning via pre-commit. |
| .github/workflows/scorecards.yml | Adds OpenSSF Scorecard workflow and uploads SARIF to code scanning. |
| .github/workflows/codeql.yml | Adds CodeQL workflow for Python and uploads results to code scanning. |
| .github/workflows/dependency-review.yml | Adds dependency review workflow on pull requests. |
| .github/dependabot.yml | Enables daily Dependabot updates for GitHub Actions. |
| .github/workflows/ci-tests-cpu.yml | Adds harden-runner step to CPU test jobs (incl. matrix legs). |
| .github/workflows/ci-tests-gpu.yml | Adds harden-runner step to GPU tests workflow. |
| .github/workflows/ci-typing.yml | Adds harden-runner step to typing CI workflow. |
| .github/workflows/ci-integrations.yml | Adds harden-runner step to integrations CI workflow. |
| .github/workflows/ci-build-docs.yml | Adds harden-runner step to docs build CI workflow. |
| .github/workflows/build-package.yml | Adds harden-runner step to package build workflow. |
| .github/workflows/publish-docs.yml | Adds harden-runner step to docs publishing workflow. |
| .github/workflows/publish-release.yml | Adds harden-runner step to release publishing workflow. |
| .github/workflows/publish-pre-release.yml | Adds harden-runner step to pre-release publishing workflow. |
| .github/workflows/pr-conflict-labeler.yml | Adds harden-runner step to conflict labeler workflow. |
| schedule: | ||
| - cron: '20 7 * * 2' | ||
| push: | ||
| branches: ["develop"] |
There was a problem hiding this comment.
The Scorecards workflow is configured to run on push to develop only. Since other workflows in this repo run on main and release/* too, Scorecard results may not reflect the branch that’s actually protected/default. Consider aligning the on.push.branches list with the repo’s primary branches (or removing the branch filter and relying on the scheduled + branch_protection_rule events).
| branches: ["develop"] | |
| branches: ["develop", "main", "release/*"] |
| - name: Harden the runner (Audit all outbound calls) | ||
| uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0 | ||
| with: | ||
| egress-policy: audit | ||
|
|
There was a problem hiding this comment.
step-security/harden-runner is added to a job matrix that runs on Windows and macOS as well as Ubuntu. The harden-runner action is typically Linux-specific (it relies on runner hardening/egress controls) and may fail or be a no-op on non-Linux runners; consider gating this step with an if: runner.os == 'Linux' (or moving hardening into a Linux-only job) so the Windows/macOS legs don’t break.
| - name: Harden the runner (Audit all outbound calls) | ||
| uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0 | ||
| with: | ||
| egress-policy: audit | ||
|
|
There was a problem hiding this comment.
This workflow runs on a self-hosted runner (runs-on: Roboflow-GPU-VM-Runner), but step-security/harden-runner is designed primarily for GitHub-hosted runners and may not behave as expected (or could interfere with runner networking/permissions) on self-hosted infrastructure. Consider skipping this step on self-hosted runners or validating that the runner environment supports the harden-runner requirements before enabling it here.
| - name: Harden the runner (Audit all outbound calls) | |
| uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0 | |
| with: | |
| egress-policy: audit |
| branches: ["develop"] | ||
| pull_request: | ||
| # The branches below must be a subset of the branches above | ||
| branches: ["develop"] |
There was a problem hiding this comment.
This CodeQL workflow only runs on develop for both push and pull_request. Elsewhere in the repo, CI runs on main and release/* as well, so CodeQL results may be missing for changes targeting those branches. Consider adding the same branch patterns (or at least the default branch) to the on.push.branches / on.pull_request.branches lists so code scanning coverage matches the rest of CI.
| branches: ["develop"] | |
| pull_request: | |
| # The branches below must be a subset of the branches above | |
| branches: ["develop"] | |
| branches: ["develop", "main", "release/*"] | |
| pull_request: | |
| # The branches below must be a subset of the branches above | |
| branches: ["develop", "main", "release/*"] |
Summary
This pull request is created by StepSecurity at the request of @Borda. Please merge the Pull Request to incorporate the requested changes. Please tag @Borda on your message if you have any questions related to the PR.
Security Fixes
Harden Runner
Harden-Runner is an open-source security agent for the GitHub-hosted runner to prevent software supply chain attacks. It prevents exfiltration of credentials, detects tampering of source code during build, and enables running jobs without
sudoaccess. See how popular open-source projects use Harden-Runner here.Harden runner usage
You can find link to view insights and policy recommendation in the build log
Please refer to documentation to find more details.
Keeping your actions up to date with Dependabot
With Dependabot version updates, when Dependabot identifies an outdated dependency, it raises a pull request to update the manifest to the latest version of the dependency. This is recommended by GitHub as well as The Open Source Security Foundation (OpenSSF).
Detect Vulnerabilities with SAST Workflow
Static Code Analysis (also known as Source Code Analysis) is usually performed as part of a Code Review (also known as clear-box testing) and is carried out at the Implementation phase of a Security Development Lifecycle (SDL). Static Code Analysis commonly refers to the running of Static Code Analysis tools that attempt to highlight possible vulnerabilities within ‘static’ (non-running) source code by using techniques such as Taint Analysis and Data Flow Analysis.
Add Dependency Review Workflow
The Dependency Review Workflow enforces dependency reviews on your pull requests. The action scans for vulnerable versions of dependencies introduced by package version changes in pull requests, and warns you about the associated security vulnerabilities. This gives you better visibility of what's changing in a pull request, and helps prevent vulnerabilities being added to your repository.
Add OpenSSF Scorecard Workflow
OpenSSF Scorecard is an automated tool that assesses a number of important heuristics ("checks") associated with software security and assigns each check a score of 0-10. You can use these scores to understand specific areas to improve in order to strengthen the security posture of your project.
Scorecard workflow also allows maintainers to display a Scorecard badge on their repository to show off their hard work.
Maintain Code Quality with Pre-Commit
Pre-commit is a framework for managing and maintaining multi-language pre-commit hooks. Hooks can be any scripts, code, or binaries that run at any stage of the git workflow. Pre-commit hooks are useful for enforcing code quality, code formatting, and detecting security vulnerabilities.
Feedback
For bug reports, feature requests, and general feedback; please email support@stepsecurity.io. To create such PRs, please visit https://app.stepsecurity.io/securerepo.
Signed-off-by: StepSecurity Bot bot@stepsecurity.io