Skip to content

ci: apply security best practices #254

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

Closed
wants to merge 1 commit into from
Closed
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/PRTargetWorkflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,19 @@ on:
- synchronize
- reopened

permissions:
contents: read

jobs:
pr-target-check:
runs-on: ubuntu-latest

steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0
with:
egress-policy: audit

- name: Check out code
uses: actions/checkout@v4

Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/anomalous-outbound-calls.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
name: Anomalous Outbound Calls
on:
workflow_dispatch:
permissions:
contents: read

jobs:
unexpected-outbound-calls:
name: AnomalousOutboundCalls
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@v2
uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0
with:
egress-policy: audit
- run: "curl https://pastebin.com -L || true"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/arc-codecov-simulation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: self-hosted
steps:
- name: Harden Runner
uses: step-security/harden-runner@v2
uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0
with:
egress-policy: block
allowed-endpoints: >
Expand All @@ -28,7 +28,7 @@ jobs:
cd ./src/exfiltration-demo
npm install
- name: Publish to Registry
uses: elgohr/Publish-Docker-Github-Action@v5
uses: elgohr/Publish-Docker-Github-Action@eb53b3ec07136a6ebaed78d8135806da64f7c7e2 # v5
with:
name: ${{ github.repository }}/prod:latest
username: ${{ github.actor }}
Expand Down
13 changes: 13 additions & 0 deletions .github/workflows/arc-secure-by-default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,18 @@ name: "ARC: Secure-By-Default Cluster-Level Policy"
on:
workflow_dispatch:

permissions:
contents: read

jobs:
direct-ip-hosted:
runs-on: ubuntu-latest
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0
with:
egress-policy: audit

- uses: actions/checkout@v3

# Codecov Scenario: Exfiltrate data to attacker's IP address
Expand All @@ -14,6 +22,11 @@ jobs:
direct-ip-arc:
runs-on: self-hosted
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0
with:
egress-policy: audit

- uses: actions/checkout@v3

# Codecov Scenario: Exfiltrate data to attacker's IP address
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/arc-solarwinds-simulation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ jobs:
arc-solarwinds-simulation:
runs-on: self-hosted
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0
with:
egress-policy: audit

- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
Expand All @@ -15,7 +20,7 @@ jobs:
cd ./src/backdoor-demo
npm install
- name: Publish to Registry
uses: elgohr/Publish-Docker-Github-Action@v5
uses: elgohr/Publish-Docker-Github-Action@eb53b3ec07136a6ebaed78d8135806da64f7c7e2 # v5
with:
name: ${{ github.repository }}/prod:latest
username: ${{ github.actor }}
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/arc-zero-effort-observability.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ jobs:
build:
runs-on: self-hosted
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0
with:
egress-policy: audit

- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
Expand All @@ -15,7 +20,7 @@ jobs:
cd ./src/exfiltration-demo
npm install
- name: Publish to Registry
uses: elgohr/Publish-Docker-Github-Action@v5
uses: elgohr/Publish-Docker-Github-Action@eb53b3ec07136a6ebaed78d8135806da64f7c7e2 # v5
with:
name: ${{ github.repository }}/prod:latest
username: ${{ github.actor }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/baseline_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: step-security/harden-runner@int-sh
- uses: step-security/harden-runner@668ad3cce4bd0191ec8fdd9868adcb7521a9dacd # int-sh
with:
egress-policy: audit

- uses: crazy-max/ghaction-github-status@v4
- uses: crazy-max/ghaction-github-status@6aadd1a8de5ca43c8e17a0633ef90e2178da5228 # v4.1.0

- uses: actions/checkout@v3

Expand All @@ -22,12 +22,12 @@ jobs:

- name: get-npm-version
id: package-version
uses: martinbeentjes/[email protected]
uses: martinbeentjes/npm-get-version-action@3cf273023a0dda27efcd3164bdfb51908dd46a5b # v1.3.1
with:
path: src/exfiltration-demo

- name: Publish to Registry
uses: elgohr/Publish-Docker-Github-Action@v5
uses: elgohr/Publish-Docker-Github-Action@eb53b3ec07136a6ebaed78d8135806da64f7c7e2 # v5
with:
name: ${{ github.repository }}/prod:latest
username: ${{ github.actor }}
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/block-dns-exfiltration.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
name: Block DNS Exfiltration With Harden-Runner
on:
workflow_dispatch:
permissions:
contents: read

jobs:
build:
name: Deploy
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@v2
uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0
with:
egress-policy: block
allowed-endpoints: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/changed-files-vulnerability-with-hr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
name: Test changed-files
steps:
- name: Harden Runner
uses: step-security/harden-runner@v2
uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0
with:
disable-sudo: true
egress-policy: block
Expand All @@ -29,7 +29,7 @@ jobs:
# Example 1
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v40
uses: tj-actions/changed-files@af292f1e845a0377b596972698a8598734eb2796 # v40.0.0

- name: List all changed files
run: |
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/changed-files-vulnerability-without-hr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,19 @@ jobs:
runs-on: ubuntu-latest
name: Test changed-files
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0
with:
egress-policy: audit

- uses: actions/checkout@v4
with:
fetch-depth: 0

# Example 1
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v40
uses: tj-actions/changed-files@af292f1e845a0377b596972698a8598734eb2796 # v40.0.0

- name: List all changed files
run: |
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/hosted-file-monitor-with-hr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: step-security/harden-runner@v2
- uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0
with:
egress-policy: audit

Expand All @@ -17,13 +17,13 @@ jobs:
cd ./src/backdoor-demo
npm install

- uses: madhead/semver-utils@latest
- uses: madhead/semver-utils@36d1e0ed361bd7b4b77665de8093092eaeabe6ba # latest
id: version
with:
version: 1.2.3

- name: Publish to Registry
uses: elgohr/Publish-Docker-Github-Action@v5
uses: elgohr/Publish-Docker-Github-Action@eb53b3ec07136a6ebaed78d8135806da64f7c7e2 # v5
with:
name: ${{ github.repository }}/prod:latest
username: ${{ github.actor }}
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/hosted-file-monitor-without-hr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,25 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0
with:
egress-policy: audit

- uses: actions/checkout@v3

- name: npm install
run: |
cd ./src/backdoor-demo
npm install

- uses: madhead/semver-utils@latest
- uses: madhead/semver-utils@36d1e0ed361bd7b4b77665de8093092eaeabe6ba # latest
id: version
with:
version: 1.2.3

- name: Publish to Registry
uses: elgohr/Publish-Docker-Github-Action@v5
uses: elgohr/Publish-Docker-Github-Action@eb53b3ec07136a6ebaed78d8135806da64f7c7e2 # v5
with:
name: ${{ github.repository }}/prod:latest
username: ${{ github.actor }}
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/hosted-https-monitoring-hr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,23 @@ name: "Hosted: HTTPS Monitoring with Harden-Runner"
on:
workflow_dispatch:

permissions:
contents: read

jobs:
build:
permissions:
contents: read # for JasonEtco/create-an-issue to read template files
issues: write # for JasonEtco/create-an-issue to create new issues
runs-on: ubuntu-latest
steps:
- uses: step-security/harden-runner@v2
- uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0
with:
egress-policy: audit

- uses: actions/checkout@v3

- uses: JasonEtco/create-an-issue@v2
- uses: JasonEtco/create-an-issue@1b14a70e4d8dc185e5cc76d3bec9eab20257b2c5 # v2.9.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/hosted-network-filtering-hr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@v2
uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0
with:
disable-sudo: true
egress-policy: block
Expand All @@ -17,7 +17,7 @@ jobs:
registry.npmjs.org:443
www.githubstatus.com:443

- uses: crazy-max/ghaction-github-status@v4
- uses: crazy-max/ghaction-github-status@6aadd1a8de5ca43c8e17a0633ef90e2178da5228 # v4.1.0

- uses: actions/checkout@v3

Expand All @@ -28,17 +28,17 @@ jobs:

- name: get-npm-version
id: package-version
uses: martinbeentjes/[email protected]
uses: martinbeentjes/npm-get-version-action@3cf273023a0dda27efcd3164bdfb51908dd46a5b # v1.3.1
with:
path: src/exfiltration-demo

- uses: madhead/semver-utils@latest
- uses: madhead/semver-utils@36d1e0ed361bd7b4b77665de8093092eaeabe6ba # latest
id: version
with:
version: 1.2.3

- name: Publish to Registry
uses: elgohr/Publish-Docker-Github-Action@v5
uses: elgohr/Publish-Docker-Github-Action@eb53b3ec07136a6ebaed78d8135806da64f7c7e2 # v5
with:
name: ${{ github.repository }}/prod:latest
username: ${{ github.actor }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/hosted-network-monitoring-hr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
with:
egress-policy: audit

- uses: crazy-max/ghaction-github-status@v4
- uses: crazy-max/ghaction-github-status@6aadd1a8de5ca43c8e17a0633ef90e2178da5228 # v4.1.0

- uses: actions/checkout@v3

Expand All @@ -21,12 +21,12 @@ jobs:

- name: get-npm-version
id: package-version
uses: martinbeentjes/[email protected]
uses: martinbeentjes/npm-get-version-action@3cf273023a0dda27efcd3164bdfb51908dd46a5b # v1.3.1
with:
path: src/exfiltration-demo

- name: Publish to Registry
uses: elgohr/Publish-Docker-Github-Action@v5
uses: elgohr/Publish-Docker-Github-Action@eb53b3ec07136a6ebaed78d8135806da64f7c7e2 # v5
with:
name: ${{ github.repository }}/prod:latest
username: ${{ github.actor }}
Expand Down
11 changes: 8 additions & 3 deletions .github/workflows/hosted-network-without-hr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: crazy-max/ghaction-github-status@v4
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0
with:
egress-policy: audit

- uses: crazy-max/ghaction-github-status@6aadd1a8de5ca43c8e17a0633ef90e2178da5228 # v4.1.0

- uses: actions/checkout@v3

Expand All @@ -17,12 +22,12 @@ jobs:

- name: get-npm-version
id: package-version
uses: martinbeentjes/[email protected]
uses: martinbeentjes/npm-get-version-action@3cf273023a0dda27efcd3164bdfb51908dd46a5b # v1.3.1
with:
path: src/exfiltration-demo

- name: Publish to Registry
uses: elgohr/Publish-Docker-Github-Action@v5
uses: elgohr/Publish-Docker-Github-Action@eb53b3ec07136a6ebaed78d8135806da64f7c7e2 # v5
with:
name: ${{ github.repository }}/prod:latest
username: ${{ github.actor }}
Expand Down
Loading
Loading