Skip to content

Commit

Permalink
fix: ensure every action disables git credential persistence (#821)
Browse files Browse the repository at this point in the history
* Ensure every action disables Git credential persistence

Reduces the possibility of inadvertently leaking the credentials in consuming workflows.

Signed-off-by: Jack Baldry <[email protected]>

* Update READMEs to encourage not persisting credentials

Signed-off-by: Jack Baldry <[email protected]>

---------

Signed-off-by: Jack Baldry <[email protected]>
  • Loading branch information
jdbaldry authored Feb 27, 2025
1 parent 09fb633 commit 31ebf3f
Show file tree
Hide file tree
Showing 15 changed files with 24 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ will ensure actions in this repo are always used at the same commit. To do this:
# action), so if multiple actions check `shared-workflows` out, they don't
# overwrite each other
path: _shared-workflows-your-action
persist-credentials: false

- name: Use another action
uses: ./_shared-workflows-your-action/actions/some-action
Expand Down
1 change: 1 addition & 0 deletions actions/argo-lint/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ runs:
repository: ${{ env.action_repo }}
ref: ${{ env.action_ref }}
path: _shared-workflows-argo-lint
persist-credentials: false

- name: Setup Argo
uses: ./_shared-workflows-argo-lint/actions/setup-argo
Expand Down
2 changes: 2 additions & 0 deletions actions/build-push-to-dockerhub/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ jobs:
steps:
- id: checkout
uses: actions/checkout@v4
with:
persist-credentials: false

- id: push-to-dockerhub
uses: grafana/shared-workflows/actions/[email protected]
Expand Down
1 change: 1 addition & 0 deletions actions/build-push-to-dockerhub/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ runs:
repository: ${{ env.action_repo }}
ref: ${{ env.action_ref }}
path: _shared-workflows-build-push-to-dockerhub
persist-credentials: false

- name: Login to DockerHub
if: ${{ inputs.push == 'true' }}
Expand Down
1 change: 1 addition & 0 deletions actions/dockerhub-login/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ runs:
repository: ${{ env.action_repo }}
ref: ${{ env.action_ref }}
path: _shared-workflows-dockerhub-login
persist-credentials: false

- name: Get secrets for DockerHub login
id: get-secrets
Expand Down
3 changes: 3 additions & 0 deletions actions/generate-openapi-clients/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v1.0.1
with:
persist-credentials: false

- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v1.0.1
with:
go-version: 1.18
Expand Down
4 changes: 3 additions & 1 deletion actions/lint-pr-title/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ jobs:
lint-pr-title:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
persist-credentials: false
- id: lint-pr-title
uses: grafana/shared-workflows/actions/[email protected]
Expand Down
2 changes: 2 additions & 0 deletions actions/push-to-gar-docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ jobs:
steps:
- id: checkout
uses: actions/checkout@v4
with:
persist-credentials: false

- id: push-to-gar
uses: grafana/shared-workflows/actions/[email protected]
Expand Down
1 change: 1 addition & 0 deletions actions/push-to-gar-docker/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ runs:
repository: ${{ env.action_repo }}
ref: ${{ env.action_ref }}
path: shared-workflows
persist-credentials: false

- name: Get repository name
id: get-repository-name
Expand Down
3 changes: 3 additions & 0 deletions actions/push-to-gcs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ jobs:
runs-on: ubuntu-x64-small
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false

- uses: grafana/shared-workflows/actions/login-to-gcs@main
id: login-to-gcs

Expand Down
1 change: 1 addition & 0 deletions actions/push-to-gcs/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ runs:
repository: ${{ env.action_repo }}
ref: ${{ env.action_ref }}
path: shared-workflows
persist-credentials: false
- name: Resolve GCP project
id: resolve-project
shell: bash
Expand Down
1 change: 1 addition & 0 deletions actions/techdocs-rewrite-relative-links/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Then this link inside the file will be changed to ...
repository: grafana/shared-workflows
ref: techdocs-rewrite-relative-links-v1.0.1
path: _shared-workflows
persist-credentials: false

- name: Rewrite relative links
uses: ./_shared-workflows/actions/techdocs-rewrite-relative-links
Expand Down
1 change: 1 addition & 0 deletions actions/techdocs-rewrite-relative-links/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ runs:
repository: ${{ env.action_repo }}
ref: ${{ env.action_ref }}
path: ${{ inputs.checkout-action-repository-path }}
persist-credentials: false

- name: Setup go
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
Expand Down
1 change: 1 addition & 0 deletions actions/trigger-argo-workflow/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ runs:
repository: ${{ env.action_repo }}
ref: ${{ env.action_ref }}
path: _shared-workflows-trigger-argo-workflow
persist-credentials: false

- name: Setup argo
uses: ./_shared-workflows-trigger-argo-workflow/actions/setup-argo
Expand Down
2 changes: 2 additions & 0 deletions actions/validate-policy-bot-config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Validate Policy Bot configuration
uses: grafana/shared-workflows/actions/[email protected]
```
Expand Down

0 comments on commit 31ebf3f

Please sign in to comment.