Skip to content
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

[StepSecurity] Apply security best practices #12783

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: daily

- package-ecosystem: pip
directory: /cmake/tribits/doc/sphinx
schedule:
interval: daily

- package-ecosystem: pip
directory: /packages/kokkos-kernels/docs
schedule:
interval: daily
10 changes: 8 additions & 2 deletions .github/workflows/PR-gcc-openmpi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,14 @@ on:
- develop
workflow_dispatch:

permissions:
contents: read

jobs:
trilogpu02-gcc:
permissions:
actions: write # for styfle/cancel-workflow-action to cancel/stop running workflows
contents: read # for actions/checkout to fetch code
runs-on: [self-hosted, trilogpu02]
container:
image: registry-ex.sandia.gov/trilinos-project/trilinos-containers/rhel8/trilinos-pr-env:gcc-8.5.0
Expand All @@ -29,7 +35,7 @@ jobs:
bash -l -c "module list"
printenv PATH
- name: Cancel Previous Runs
uses: styfle/[email protected]
uses: styfle/cancel-workflow-action@b173b6ec0100793626c2d9e6b90435061f4fc3e5 # 0.11.0
with:
access_token: ${{ github.token }}
- name: make dirs
Expand All @@ -38,7 +44,7 @@ jobs:
mkdir -p /home/Trilinos/src/Trilinos
mkdir -p /home/Trilinos/build
- name: Clone trilinos
uses: actions/checkout@v4
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0
- name: Repo status
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/clang_format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: DoozyX/[email protected]
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
- uses: DoozyX/clang-format-lint-action@1566bcec081dcb246ab02e7c5f9786c0b629dd4d # v0.16.2
with:
source: './packages/muelu ./packages/tempus ./packages/teko ./packages/xpetra'
exclude: './packages/tempus/examples'
Expand All @@ -18,7 +18,7 @@ jobs:
- run: git diff HEAD > format_patch.txt
- run: if [ "$(cat format_patch.txt)" == "" ] ; then rm format_patch.txt ; else cat format_patch.txt; fi

- uses: actions/upload-artifact@v4
- uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
id: upload-artf
if: ${{ hashFiles('format_patch.txt') != '' }}
with:
Expand All @@ -32,13 +32,13 @@ jobs:

# This does not work for PRs from forks.
- name: Post artifact in issue comment
uses: mshick/[email protected]
uses: mshick/add-pr-comment@7c0890544fb33b0bdd2e59467fbacb62e028a096 # v2.8.1
if: ${{ (hashFiles('format_patch.txt') != '') && (github.event.pull_request.head.repo.full_name == github.repository) }}
with:
message: |
Your PR updated files that did not respect package clang formatting settings. Please apply the patch found [here](${{ steps.upload-artf.outputs.artifact-url }})

- uses: actions/github-script@v3
- uses: actions/github-script@ffc2c79a5b2490bd33e0a41c1de74b877714d736 # v3.2.0
if: ${{ hashFiles('format_patch.txt') != '' }}
with:
script: |
Expand Down
27 changes: 27 additions & 0 deletions .github/workflows/dependency-review.yml
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 Runner
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
with:
egress-policy: audit

- name: 'Checkout Repository'
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
- name: 'Dependency Review'
uses: actions/dependency-review-action@0efb1d1d84fc9633afcdaad14c485cbbc90ef46c # v2.5.1
5 changes: 4 additions & 1 deletion .github/workflows/detect-git-lfs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@ name: Check for git LFS pointers
on:
pull_request:

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Check out code
uses: actions/checkout@v3
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
with:
fetch-depth: 0

Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/detect-mpi-comm-world.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@ name: Check MPI_COMM_WORLD
on:
pull_request:

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Check out code
uses: actions/checkout@v3
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
with:
fetch-depth: 0

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/flag_prs_to_master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ jobs:

steps:
- name: Add label
uses: actions-ecosystem/action-add-labels@v1
uses: actions-ecosystem/action-add-labels@18f1af5e3544586314bbe15c0273249c770b2daf # v1.1.3
if: "!contains(github.event.sender.login,'trilinos-autotester')"
with:
labels: "AT: WIP"
- name: Add comment
uses: mshick/add-pr-comment@v2
uses: mshick/add-pr-comment@b8f338c590a895d50bcbfa6c5859251edc8952fc # v2.8.2
if: "!contains(github.event.sender.login,'trilinos-autotester')"
with:
message: |
Expand Down
71 changes: 71 additions & 0 deletions .github/workflows/scorecards.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# 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: ["master"]

# 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

steps:
- name: "Checkout code"
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
with:
persist-credentials: false

- name: "Run analysis"
uses: ossf/scorecard-action@99c53751e09b9529366343771cc321ec74e9bd3d # v2.0.6
with:
results_file: results.sarif
results_format: sarif
# (Optional) "write" PAT token. Uncomment the `repo_token` line below if:
# - you want to enable the Branch-Protection check on a *public* repository, or
# - you are installing Scorecards on a *private* repository
# To create the PAT, follow the steps in https://github.com/ossf/scorecard-action#authentication-with-pat.
# repo_token: ${{ secrets.SCORECARD_TOKEN }}

# Public repositories:
# - Publish results to OpenSSF REST API for easy access by consumers
# - Allows the repository to include the Scorecard badge.
# - See https://github.com/ossf/scorecard-action#publishing-results.
# For private repositories:
# - `publish_results` will always be set to `false`, regardless
# of the value entered here.
publish_results: true

# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
# format to the repository Actions tab.
- name: "Upload artifact"
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
with:
name: SARIF file
path: results.sarif
retention-days: 5

# Upload the results to GitHub's code scanning dashboard.
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@a56a03b370b87b26fde6d680755f818cfda0372b # v2.24.5
with:
sarif_file: results.sarif
2 changes: 1 addition & 1 deletion .github/workflows/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
pull-requests: write # for actions/stale to close stale PRs
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v4
- uses: actions/stale@a20b814fb01b71def3bd6f56e7494d667ddf28da # v4.1.1
with:
debug-only: false
ascending: true
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/title_to_mention.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ jobs:

steps:
- name: Mention MueLu
uses: peter-evans/create-or-update-comment@v2
uses: peter-evans/create-or-update-comment@67dcc547d311b736a8e6c5c236542148a47adc3d # v2.1.1
if: (contains(github.event.action, 'labeled') && contains(github.event.label.name, 'MueLu')) || (contains(github.event.action, 'opened') && contains(github.event.issue.title, 'MueLu'))
with:
issue-number: ${{ github.event.issue.number }}
body: |
Automatic mention of the @trilinos/muelu team
- name: Mention Ifpack2
uses: peter-evans/create-or-update-comment@v2
uses: peter-evans/create-or-update-comment@67dcc547d311b736a8e6c5c236542148a47adc3d # v2.1.1
if: (contains(github.event.action, 'labeled') && contains(github.event.label.name, 'Ifpack2')) || (contains(github.event.action, 'opened') && contains(github.event.issue.title, 'Ifpack2'))
with:
issue-number: ${{ github.event.issue.number }}
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/tpetra_muelu_label_to_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ permissions:
jobs:
assign_one_project:
permissions:
issues: write # for actions/github-script@v6
issues: write # for actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1
repository-projects: write # for srggrs/assign-one-project-github-action to assign issues and PRs to repo project
name: Assign to MueLu or Tpetra Project
runs-on: ubuntu-latest
steps:
- name: Add MueLu Label
uses: actions/github-script@v6
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1
if: contains(github.event.issue.title, 'MueLu')
with:
script: |
Expand All @@ -30,7 +30,7 @@ jobs:
labels: ["pkg: MueLu"]
})
- name: Add Tpetra Label
uses: actions/github-script@v6
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1
if: contains(github.event.issue.title, 'Tpetra')
with:
script: |
Expand All @@ -41,13 +41,13 @@ jobs:
labels: ["pkg: Tpetra"]
})
- name: Add to MueLu Project
uses: srggrs/[email protected]
uses: srggrs/assign-one-project-github-action@37de3321023f8c12ea85372d748ab2017b995bfd # 1.3.0
if: contains(github.event.label.name, 'MueLu') || contains(github.event.issue.title, 'MueLu')
with:
project: 'https://github.com/trilinos/Trilinos/projects/5'
column_name: 'Backlog'
- name: Add to Tpetra Project
uses: srggrs/[email protected]
uses: srggrs/assign-one-project-github-action@37de3321023f8c12ea85372d748ab2017b995bfd # 1.3.0
if: contains(github.event.label.name, 'Tpetra') || contains(github.event.issue.title, 'Tpetra')
with:
project: 'https://github.com/trilinos/Trilinos/projects/2'
Expand Down
Loading