Skip to content

Commit

Permalink
Harden runner egress policy improvement (#482)
Browse files Browse the repository at this point in the history
* Specify license for multiformats deps

* Specify hraden-runner egress policy to audit

* ci: change engress policy to audit for license workflow

* Bump snap core18 to core20, relates to https://github.com/snapcore/snapcraft/releases/tag/8.0.0

* ci: enable actions permission for trivy job to make runner green

* ci: change engress policy to audit for trivy jobs
  • Loading branch information
waybackarchiver authored Feb 11, 2024
1 parent 5de16ff commit f54c4fa
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 12 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ jobs:
with:
language: ${{ matrix.language }}
config-file: './.github/codeql/codeql-config.yml'
egress-policy: audit

nancy:
name: Sonatype Nancy
Expand Down Expand Up @@ -85,3 +86,4 @@ jobs:
with:
scan-type: 'fs'
sarif: 'filesystem.sarif'
egress-policy: audit
8 changes: 7 additions & 1 deletion .github/workflows/builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ jobs:
go-mips64: ${{ matrix.mips64 }}
go-mipsle: ${{ matrix.mipsle }}
artifact-path: ./build/binary/wayback*
egress-policy: audit
secrets:
wayback-ipfs-apikey: ${{ secrets.WAYBACK_IPFS_APIKEY }}

Expand All @@ -122,6 +123,7 @@ jobs:
go-arch: ${{ matrix.arch }}
go-arm: ${{ matrix.arm }}
artifact-path: build/package/wayback*.deb
egress-policy: audit
secrets:
wayback-ipfs-apikey: ${{ secrets.WAYBACK_IPFS_APIKEY }}

Expand All @@ -132,6 +134,7 @@ jobs:
product: wayback
params: 'make rpm'
artifact-path: build/package/wayback*.rpm
egress-policy: audit
secrets:
wayback-ipfs-apikey: ${{ secrets.WAYBACK_IPFS_APIKEY }}

Expand All @@ -145,6 +148,7 @@ jobs:
build/aur/.SRCINFO
build/aur/PKGBUILD
build/aur/wayback*.pkg.tar.zst
egress-policy: audit
secrets:
wayback-ipfs-apikey: ${{ secrets.WAYBACK_IPFS_APIKEY }}

Expand All @@ -153,8 +157,9 @@ jobs:
uses: wabarc/.github/.github/workflows/reusable-builder-snap.yml@main
with:
product: wayback
channel: edge
channel: stable
publish: ${{ github.repository == 'wabarc/wayback' && github.event_name == 'push' }}
egress-policy: audit
secrets:
wayback-ipfs-apikey: ${{ secrets.WAYBACK_IPFS_APIKEY }}
snapcraft-token: ${{ secrets.SNAPCRAFT_TOKEN }}
Expand All @@ -167,5 +172,6 @@ jobs:
version: edge
params: 'make build'
artifact-path: org.wabarc.wayback-*.x86_64.flatpak
egress-policy: audit
secrets:
wayback-ipfs-apikey: ${{ secrets.WAYBACK_IPFS_APIKEY }}
14 changes: 8 additions & 6 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ jobs:
- name: Harden Runner
uses: step-security/harden-runner@2e205a28d0e1da00c5f53b161f4067b052c61f34 # v1.5.0
with:
egress-policy: block
egress-policy: audit
disable-telemetry: true
allowed-endpoints: >
ghcr.io:443
github.com:443
api.github.com:443
pkg-containers.githubusercontent.com:443
*.githubusercontent.com
docker.io:443
auth.docker.io:443
index.docker.io:443
Expand Down Expand Up @@ -201,14 +201,14 @@ jobs:
- name: Harden Runner
uses: step-security/harden-runner@2e205a28d0e1da00c5f53b161f4067b052c61f34 # v1.5.0
with:
egress-policy: block
egress-policy: audit
disable-telemetry: true
allowed-endpoints: >
ghcr.io:443
github.com:443
api.github.com:443
docker.io:443
pkg-containers.githubusercontent.com:443
*.githubusercontent.com
auth.docker.io:443
registry-1.docker.io:443
production.cloudflare.docker.com:443
Expand Down Expand Up @@ -331,11 +331,12 @@ jobs:
permissions:
contents: read # for actions/checkout to fetch code
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
#actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
with:
scan-type: 'image'
image-ref: '${{ needs.publish.outputs.image }}:${{ needs.publish.outputs.version }}'
sarif: 'container-standalone.sarif'
egress-policy: 'audit'

trivy-bundle:
name: Trivy for bundle
Expand All @@ -344,8 +345,9 @@ jobs:
permissions:
contents: read # for actions/checkout to fetch code
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
#actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
with:
scan-type: 'image'
image-ref: '${{ needs.allinone.outputs.image }}:${{ needs.allinone.outputs.version }}'
sarif: 'container-bundle.sarif'
egress-policy: 'audit'
2 changes: 2 additions & 0 deletions .github/workflows/license.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,5 @@ jobs:
license:
name: License Checker
uses: wabarc/.github/.github/workflows/reusable-license.yml@main
with:
egress-policy: audit
2 changes: 2 additions & 0 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ jobs:
golangci:
name: golangci-lint
uses: wabarc/.github/.github/workflows/reusable-golangci.yml@main
with:
egress-policy: audit

shellcheck:
name: ShellCheck
Expand Down
11 changes: 11 additions & 0 deletions .licenserc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,14 @@ header:
- 'mkdocs.yml'

comment: on-failure

dependency:
files:
- go.mod
licenses:
- name: github.com/multiformats/go-base36
version: v0.2.0
license: Apache-2.0 OR MIT
- name: github.com/multiformats/go-multicodec
version: v0.9.0
license: Apache-2.0 OR MIT
21 changes: 16 additions & 5 deletions snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,34 @@ description: |
A toolkit for snapshot webpage to the Wayback Machine.
Website https://github.com/wabarc/wayback
base: core18
base: core20
grade: stable
confinement: strict
compression: lzo

architectures:
#- build-on: [i386, amd64, arm64, armhf, ppc64el, s390x]
- build-on: amd64
- amd64
- arm64
- armhf
- i386

parts:
wayback:
plugin: go
source: https://github.com/wabarc/wayback.git
go-importpath: github.com/wabarc/wayback/cmd/wayback
override-build: |
make build
install $SNAPCRAFT_PART_BUILD/build/binary/wayback -D $SNAPCRAFT_PART_INSTALL/bin/wayback
mkdir -p $SNAPCRAFT_PART_INSTALL/bin
if [ ! -e $SNAPCRAFT_PART_INSTALL/bin/wayback ]; then
ln -s $SNAPCRAFT_PART_INSTALL/bin/wayback $SNAPCRAFT_PART_INSTALL/bin/wayback
fi
build-packages:
- build-essential

apps:
wayback:
command: wayback
command: bin/wayback
plugs:
- home
- network
Expand Down

0 comments on commit f54c4fa

Please sign in to comment.