Skip to content

Commit

Permalink
chore: restrict token permissions #566 (#567)
Browse files Browse the repository at this point in the history
  • Loading branch information
srinandan authored Nov 5, 2024
1 parent d2e2996 commit bf2226b
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
# supported CodeQL languages.
#
name: "CodeQL"

permissions: read-all
on:
push:
branches: [ "main" ]
Expand Down
17 changes: 9 additions & 8 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ name: apigeecli Container Release
# separate terms of service, privacy policy, and support
# documentation.

permissions: read-all
on:
push:
# Publish semver tags as releases.
Expand Down Expand Up @@ -54,19 +55,19 @@ jobs:
# https://github.com/sigstore/cosign-installer
- name: Install cosign
if: github.event_name != 'pull_request'
uses: sigstore/cosign-installer@v3.5.0
uses: sigstore/cosign-installer@dc72c7d5c4d10cd6bcb8cf6e3fd625a9e5e537da # v3.7.0

- name: Set up QEMU
uses: docker/[email protected]
uses: docker/setup-qemu-action@e81a89b1732b9c48d79cd809d8d81d79c4647a18 #v2.1.0

- name: Setup Docker buildx
uses: docker/[email protected]
uses: docker/setup-buildx-action@4b4e9c3e2d4531116a6f8ba8e71fc6e2cb6e6c8c #v2.5.0

# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/[email protected]
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a #v2.1.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
Expand All @@ -76,7 +77,7 @@ jobs:
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/[email protected]
uses: docker/metadata-action@c4ee3adeed93b1fa6a762f209fb01608c1a22f1e #v4.4.0
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
Expand All @@ -90,7 +91,7 @@ jobs:
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v6
uses: docker/build-push-action@c382f710d39a5bb4e430307530a720f50c2d3318 #v6
with:
context: .
file: Dockerfile
Expand Down Expand Up @@ -121,14 +122,14 @@ jobs:
cosign sign --yes ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ steps.build-and-push.outputs.digest }}
- name: Generate SBOM
uses: anchore/sbom-action@v0
uses: anchore/sbom-action@fc46e51fd3cb168ffb36c6d1915723c47db58abb #0.17.7
with:
format: 'spdx-json'
output-file: 'sbom.spdx.json'
image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ steps.build-and-push.outputs.digest }}

- name: Publish SBOM
uses: anchore/sbom-action/publish-sbom@v0
uses: anchore/sbom-action/publish-sbom@fc46e51fd3cb168ffb36c6d1915723c47db58abb #0.17.7
with:
sbom-artifact-match: ".*\\.spdx$"

Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,14 @@
# limitations under the License.

name: golangci-lint
permissions: read-all
on:
push:
branches:
- main
pull_request:
branches:
- '**'
permissions:
contents: read
jobs:
golangci:
name: lint
Expand All @@ -33,7 +32,7 @@ jobs:
cache: false
- uses: actions/checkout@v4
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
uses: golangci/golangci-lint-action@971e284b6050e8a5849b72094c50ab08da042db8 #v6.1.1
with:
version: latest
args: --timeout=4m
2 changes: 1 addition & 1 deletion .github/workflows/gorelease-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.

name: apigeecli Binary Release

permissions: read-all
on:
push:
# Publish semver tags as releases.
Expand Down

0 comments on commit bf2226b

Please sign in to comment.