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

chore(ci): lockdown untrusted workflows to sha #130

Merged
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
46 changes: 23 additions & 23 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ name: Build .NET

on:
push:
branches: [ develop, main ]
branches: [develop, main]
pull_request:
branches: [ develop, main ]
branches: [develop, main]

defaults:
run:
working-directory: ./libraries
Expand All @@ -15,23 +15,23 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Setup .NET 6.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.302
- name: Install solution dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Test & Code Coverage
run: dotnet test --collect:"XPlat Code Coverage" -r ./codecov --no-restore --verbosity normal
- name: Codecov
uses: codecov/codecov-action@v2.1.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: unittests
fail_ci_if_error: true
name: codecov-lambda-powertools-dotnet
verbose: true
directory: ./libraries/codecov
- uses: actions/checkout@v3
- name: Setup .NET 6.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.302
- name: Install solution dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Test & Code Coverage
run: dotnet test --collect:"XPlat Code Coverage" -r ./codecov --no-restore --verbosity normal
- name: Codecov
uses: codecov/codecov-action@81cd2dc8148241f03f5839d295e000b8f761e378 # 3.1.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: unittests
fail_ci_if_error: true
name: codecov-lambda-powertools-dotnet
verbose: true
directory: ./libraries/codecov
6 changes: 3 additions & 3 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ jobs:
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v2.2.2
uses: actions/setup-python@v4
with:
python-version: "3.8"
- name: Capture branch and tag
Expand All @@ -31,7 +31,7 @@ jobs:
apidocs:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Configure and build api docs generator
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ jobs:
update_release_draft:
runs-on: ubuntu-latest
steps:
- uses: release-drafter/release-drafter@v5
- uses: release-drafter/release-drafter@ac463ffd9cc4c6ad5682af93dc3e3591c4657ee3 # v5.20.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32 changes: 32 additions & 0 deletions .github/workflows/secure_workflows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Lockdown untrusted workflows

on:
push:
paths:
- ".github/workflows/**"
pull_request:
paths:
- ".github/workflows/**"

jobs:
enforce_pinned_workflows:
name: Harden Security
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Ensure 3rd party workflows have SHA pinned
uses: zgosalvez/github-actions-ensure-sha-pinned-actions@6ca5574367befbc9efdb2fa25978084159c5902d # v1.3.0
with:
# Trusted GitHub Actions and/or organizations
allowlist: |
aws-actions/
actions/checkout
actions/github-script
actions/setup-dotnet
actions/setup-python
actions/upload-artifact
actions/download-artifact
github/codeql-action/init
github/codeql-action/analyze
dependabot/fetch-metadata