-
Notifications
You must be signed in to change notification settings - Fork 3.4k
[StepSecurity] Apply security best practices #2236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -18,6 +18,11 @@ jobs: | |||||
| links-check: | ||||||
| runs-on: ubuntu-latest | ||||||
| steps: | ||||||
| - name: Harden the runner (Audit all outbound calls) | ||||||
| uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0 | ||||||
| with: | ||||||
| egress-policy: audit | ||||||
|
|
||||||
| - name: Checkout repository | ||||||
| uses: actions/checkout@v6 | ||||||
|
||||||
| uses: actions/checkout@v6 | |
| uses: actions/checkout@<SAME_PINNED_COMMIT_SHA_USED_ELSEWHERE_IN_REPO> # v6 |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,78 @@ | ||||||
| # For most projects, this workflow file will not need changing; you simply need | ||||||
| # to commit it to your repository. | ||||||
| # | ||||||
| # You may wish to alter this file to override the set of languages analyzed, | ||||||
| # or to provide custom queries or build logic. | ||||||
| # | ||||||
| # ******** NOTE ******** | ||||||
| # We have attempted to detect the languages in your repository. Please check | ||||||
| # the `language` matrix defined below to confirm you have the correct set of | ||||||
| # supported CodeQL languages. | ||||||
| # | ||||||
| name: "CodeQL" | ||||||
|
|
||||||
| on: | ||||||
| push: | ||||||
| branches: ["develop"] | ||||||
| pull_request: | ||||||
| # The branches below must be a subset of the branches above | ||||||
| branches: ["develop"] | ||||||
| schedule: | ||||||
| - cron: "0 0 * * 1" | ||||||
|
|
||||||
| permissions: | ||||||
| contents: read | ||||||
|
|
||||||
| jobs: | ||||||
| analyze: | ||||||
| name: Analyze | ||||||
| runs-on: ubuntu-latest | ||||||
| permissions: | ||||||
| actions: read | ||||||
| contents: read | ||||||
| security-events: write | ||||||
|
|
||||||
| strategy: | ||||||
| fail-fast: false | ||||||
| matrix: | ||||||
| language: ["python"] | ||||||
| # CodeQL supports [ $supported-codeql-languages ] | ||||||
| # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support | ||||||
|
|
||||||
| steps: | ||||||
| - name: Harden the runner (Audit all outbound calls) | ||||||
| uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0 | ||||||
| with: | ||||||
| egress-policy: audit | ||||||
|
|
||||||
| - name: Checkout repository | ||||||
| uses: actions/checkout@v4 | ||||||
|
||||||
| uses: actions/checkout@v4 | |
| uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 |
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,27 @@ | ||||||||||||||
| # Dependency Review Action | ||||||||||||||
| # | ||||||||||||||
| # This Action will scan dependency manifest files that change as part of a Pull Request, | ||||||||||||||
| # surfacing known-vulnerable versions of the packages declared or updated in the PR. | ||||||||||||||
| # Once installed, if the workflow run is marked as required, | ||||||||||||||
| # PRs introducing known-vulnerable packages will be blocked from merging. | ||||||||||||||
| # | ||||||||||||||
| # Source repository: https://github.com/actions/dependency-review-action | ||||||||||||||
| name: 'Dependency Review' | ||||||||||||||
| on: [pull_request] | ||||||||||||||
|
|
||||||||||||||
| permissions: | ||||||||||||||
| contents: read | ||||||||||||||
|
|
||||||||||||||
| jobs: | ||||||||||||||
| dependency-review: | ||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||
| steps: | ||||||||||||||
| - name: Harden the runner (Audit all outbound calls) | ||||||||||||||
| uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0 | ||||||||||||||
| with: | ||||||||||||||
| egress-policy: audit | ||||||||||||||
|
|
||||||||||||||
| - name: 'Checkout Repository' | ||||||||||||||
| uses: actions/checkout@v4 | ||||||||||||||
| - name: 'Dependency Review' | ||||||||||||||
| uses: actions/dependency-review-action@v4 | ||||||||||||||
|
Comment on lines
+25
to
+27
|
||||||||||||||
| uses: actions/checkout@v4 | |
| - name: 'Dependency Review' | |
| uses: actions/dependency-review-action@v4 | |
| uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
| - name: 'Dependency Review' | |
| uses: actions/dependency-review-action@c9c05d8de6f8d8f982f050f4c6eaa0c1def81b1a # v4.3.5 |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,81 @@ | ||||||
| # This workflow uses actions that are not certified by GitHub. They are provided | ||||||
| # by a third-party and are governed by separate terms of service, privacy | ||||||
| # policy, and support documentation. | ||||||
|
|
||||||
| name: Scorecard supply-chain security | ||||||
| on: | ||||||
| # For Branch-Protection check. Only the default branch is supported. See | ||||||
| # https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection | ||||||
| branch_protection_rule: | ||||||
| # To guarantee Maintained check is occasionally updated. See | ||||||
| # https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained | ||||||
| schedule: | ||||||
| - cron: '20 7 * * 2' | ||||||
| push: | ||||||
| branches: ["develop"] | ||||||
|
|
||||||
| # Declare default permissions as read only. | ||||||
| permissions: read-all | ||||||
|
|
||||||
| jobs: | ||||||
| analysis: | ||||||
| name: Scorecard analysis | ||||||
| runs-on: ubuntu-latest | ||||||
| permissions: | ||||||
| # Needed to upload the results to code-scanning dashboard. | ||||||
| security-events: write | ||||||
| # Needed to publish results and get a badge (see publish_results below). | ||||||
| id-token: write | ||||||
| contents: read | ||||||
| actions: read | ||||||
| # To allow GraphQL ListCommits to work | ||||||
| issues: read | ||||||
| pull-requests: read | ||||||
| # To detect SAST tools | ||||||
| checks: read | ||||||
|
|
||||||
| steps: | ||||||
| - name: Harden the runner (Audit all outbound calls) | ||||||
| uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0 | ||||||
| with: | ||||||
| egress-policy: audit | ||||||
|
|
||||||
| - name: "Checkout code" | ||||||
| uses: actions/checkout@v4 | ||||||
|
||||||
| uses: actions/checkout@v4 | |
| uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new example
pipDependabot entries don’t specifytarget-branch: "develop"(and don’t set thecommit-messageprefix) like the existing rootpip/github-actionsentries. This will make Dependabot PRs for these example requirements target the repo default branch and use a different commit message format; consider adding the sametarget-branchandcommit-messagesettings to all the new example entries for consistency and to avoid updates landing on the wrong branch.