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

Add Step Security Hardening auditing for GHA runners #503

Merged
merged 7 commits into from
Jul 2, 2024
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
8 changes: 8 additions & 0 deletions .github/workflows/auto-merge-dependabot-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ jobs:
is_bot1: ${{ github.actor == 'dependabot[bot]' }}
is_bot2: ${{ github.actor == 'dependabot-preview[bot]' }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1
with:
disable-sudo: true
egress-policy: audit
disable-telemetry: false
tomwillis608 marked this conversation as resolved.
Show resolved Hide resolved
allowed-endpoints: >
api.github.com:443
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@5e5f99653a5b510e8555840e80cbf1514ad4af38 # v2.1.0
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/benchmark.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ jobs:
- name: Harden Runner
uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1
with:
disable-sudo: true
egress-policy: audit
disable-telemetry: false
allowed-endpoints: >
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/codeql.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@ jobs:
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

steps:
- name: Harden Runner
uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1
with:
disable-sudo: true
egress-policy: audit
disable-telemetry: false
allowed-endpoints: >
api.github.com:443
github.com:44

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

Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ jobs:
labeler:
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1
with:
disable-sudo: true
egress-policy: audit
disable-telemetry: false

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

Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ jobs:
name: Release
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1
with:
disable-sudo: true
egress-policy: audit
disable-telemetry: false

- name: Check out the repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.ref_name }}
cancel-in-progress: true

permissions:
contents: read

jobs:
tests:
name: ${{ matrix.session }} ${{ matrix.python }} / ${{ matrix.os }}
Expand Down Expand Up @@ -37,6 +40,17 @@ jobs:
PRE_COMMIT_COLOR: "always"

steps:
- name: Harden Runner
uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1
with:
disable-sudo: true
egress-policy: audit
disable-telemetry: false
allowed-endpoints: >
files.pythonhosted.org:443
github.com:443
pypi.org:443

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

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# 15. Use Step Security for GitHub Actions Runner Hardening

## Date

2024-06-21

## Status

Approved

## Context

Our CI/CD pipelines utilize GitHub Actions to automate builds, tests, and deployments. Ensuring the security of these
pipelines is crucial to protect our codebase and sensitive data from potential security threats.

## Decision

Our CI/CD pipelines utilize GitHub Actions to automate builds, tests, and deployments. Ensuring the security of these
pipelines is crucial to protect our codebase and sensitive data from potential security threats.

## Options Considered

1. **Do Nothing**: Continue using GitHub Actions without additional security measures.
2. **Custom Security Implementation**: Develop our own security hardening scripts and policies.
3. **Use Step Security**: Implement Step Security’s GitHub Action runner hardening.

## Decision Drivers

- **Security**: We need to enhance the security of our GitHub Actions runners to protect against unauthorized access and
- vulnerabilities.
- **Simplicity**: We prefer a solution that is easy to implement and maintain without extensive custom development.
- **Compliance**: We need to meet specific security compliance requirements.
- **Cost**: We aim for a cost-effective solution.

## Decision Outcome

We have chosen to use Step Security’s GitHub Action runner hardening. This decision is based on the following reasons:

- **Enhanced Security**: Step Security provides a comprehensive set of security features that address our needs for
- environment isolation, least privilege, network restrictions, and more.
- **Ease of Use**: The solution integrates seamlessly with our existing GitHub Actions workflows with minimal
- configuration effort.
- **Compliance and Auditability**: Step Security provides detailed audit logs and helps ensure compliance with
- security standards.
- **Cost-Effective**: Using a third-party solution saves us time and resources compared to developing and maintaining
- custom security scripts.

## Consequences

### Positive

- Improved Security: Our CI/CD pipelines will have enhanced protection against security threats.
- Simplified Compliance: Easier to meet security compliance requirements.
- Reduced Development Effort: Leveraging a third-party solution saves time and resources.

### Negative

- Dependency on Third-Party: We will rely on Step Security for updates and maintenance of the security features.

## Review

This decision will be reviewed periodically to ensure it continues to meet our security and operational needs.
Loading