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 #905

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
5 changes: 5 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,8 @@ updates:
open-pull-requests-limit: 1
labels:
- "dependencies"

- package-ecosystem: docker
directory: /
schedule:
interval: daily
7 changes: 6 additions & 1 deletion .github/workflows/EVENT_merge_to_master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,13 @@ jobs:
name: Success
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
with:
egress-policy: audit

- name: Set branch status to success
uses: actions/github-script@v3
uses: actions/github-script@ffc2c79a5b2490bd33e0a41c1de74b877714d736 # v3.2.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
Expand Down
25 changes: 20 additions & 5 deletions .github/workflows/EVENT_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,17 @@ jobs:
validate_tag:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Harden Runner
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
with:
egress-policy: audit

- name: Harden Runner
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
with:
egress-policy: audit

- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
ref: ${{ github.ref }}

Expand Down Expand Up @@ -61,12 +71,12 @@ jobs:
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
ref: ${{ github.ref }}

- name: Set up Python
uses: actions/setup-python@v5
uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1
with:
python-version: "3.9"

Expand All @@ -89,12 +99,17 @@ jobs:
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
- name: Harden Runner
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
with:
egress-policy: audit

- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
ref: ${{ github.ref }}

- name: Set up Python
uses: actions/setup-python@v5
uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1
with:
python-version: "3.9"
- run: pip install pip --upgrade
Expand Down
12 changes: 10 additions & 2 deletions .github/workflows/EVENT_tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,26 @@ concurrency:
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

permissions:
contents: read

jobs:
create_release:
name: Create Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Harden Runner
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
with:
egress-policy: audit

- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
name: Checkout
with:
ref: ${{ github.head_ref || github.ref }}

- name: Create release
uses: actions/create-release@v1
uses: actions/create-release@0cb9c9b65d5d1901c1f53e5e66eaf4afd303e70e # v1.1.4
env:
GITHUB_TOKEN: ${{ env.GH_TOKEN }}
with:
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/EVENT_update-linear-labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,14 @@ jobs:
name: Update Linear
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Harden Runner
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
with:
egress-policy: audit

- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- uses: v7labs/update-linear-labels-action@v1
- uses: v7labs/update-linear-labels-action@0d527ddba6f2f0e0c28c3ec5c8a26767caf13ee3 # v1
with:
label_name: "DarwinPy"
branch_name: "${{ github.head_ref }}"
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/JOB_check-master-can-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,13 @@ jobs:
check-master-can-release:
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
with:
egress-policy: audit

- name: Check master is passing
uses: actions/github-script@v3
uses: actions/github-script@ffc2c79a5b2490bd33e0a41c1de74b877714d736 # v3.2.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
Expand All @@ -25,7 +30,7 @@ jobs:
}

- name: Check there are commits in master since last release
uses: actions/github-script@v3
uses: actions/github-script@ffc2c79a5b2490bd33e0a41c1de74b877714d736 # v3.2.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/JOB_debug_contexts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,18 @@
on:
workflow_call:

permissions:
contents: read

jobs:
Debugging:
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
with:
egress-policy: audit

- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/JOB_e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,13 @@ jobs:
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- name: Harden Runner
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
with:
egress-policy: audit

- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1
with:
python-version: ${{ matrix.python-version }}
- name: Upgrade pip
Expand Down
12 changes: 10 additions & 2 deletions .github/workflows/JOB_format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,24 @@ on:
required: true
type: string

permissions:
contents: read

jobs:
format:
if: ${{ inputs.files != '' }}
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
with:
egress-policy: audit

- name: Check out source repository
uses: actions/checkout@v4
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Set up Python environment
uses: actions/setup-python@v5
uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1
with:
python-version: "3.11"

Expand Down
11 changes: 8 additions & 3 deletions .github/workflows/JOB_generate_documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,17 @@ jobs:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v4
- name: Harden Runner
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
with:
egress-policy: audit

- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
ref: ${{ github.head_ref || github.ref }}

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1
with:
python-version: ${{ matrix.python-version }}

Expand All @@ -53,7 +58,7 @@ jobs:
sphinx-build -b html source/ docs/
- name: Setup access to AWS
id: aws_assume_role
uses: aws-actions/configure-aws-credentials@v4
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
with:
role-to-assume: ${{ secrets.DARWIN_PY_AWS_GITHUB_CICD_ROLE }}
role-session-name: ${{ env.AWS_SESSION_NAME }}
Expand Down
10 changes: 9 additions & 1 deletion .github/workflows/JOB_get_changed_files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ on:
env:
GH_TOKEN: ${{ github.token }}

permissions:
contents: read

jobs:
get_changed_files:
name: Get changed files
Expand All @@ -30,7 +33,12 @@ jobs:
yaml_changed_files: ${{ steps.changed_yaml_files.outputs.yaml_changed_files }}
json_changed_files: ${{ steps.changed_json_files.outputs.json_changed_files }}
steps:
- uses: actions/checkout@v4
- name: Harden Runner
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
with:
egress-policy: audit

- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
ref: ${{ github.head_ref || github.ref }}
- name: Get changed files
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/JOB_lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,16 @@ jobs:
if: ${{ inputs.files != '' }}
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
with:
egress-policy: audit

- name: Check out source repository
uses: actions/checkout@v4
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Set up Python environment
uses: actions/setup-python@v5
uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1
with:
python-version: "3.10"

Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/JOB_slack_message.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,19 @@ on:
env:
PREFIX: ${{ vars.SLACK_TEAM_TAG }}

permissions:
contents: read

jobs:
slack-notify:
name: Slack Notification
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
with:
egress-policy: audit

- name: Require secrets inherit
run: |
if [ -z "${{ secrets.SLACK_WEBHOOK }}" ]; then
Expand Down
12 changes: 10 additions & 2 deletions .github/workflows/JOB_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ run-name: Tests
on:
workflow_call:

permissions:
contents: read

jobs:
test:
name: "Run Testing OS: ${{ matrix.os }} Python: ${{ matrix.python-version }}"
Expand All @@ -24,12 +27,17 @@ jobs:
python-version: "3.9"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Harden Runner
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
with:
egress-policy: audit

- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
ref: ${{ github.head_ref || github.ref }}

- name: Install Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1
with:
python-version: ${{ matrix.python-version }}

Expand Down
12 changes: 10 additions & 2 deletions .github/workflows/JOB_typecheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,24 @@ on:
description: "Files to lint"
required: true

permissions:
contents: read

jobs:
typecheck:
if: ${{ inputs.files != '' }}
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
with:
egress-policy: audit

- name: Check out source repository
uses: actions/checkout@v4
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Set up Python environment
uses: actions/setup-python@v5
uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1
with:
python-version: "3.10"

Expand Down
Loading