-
Notifications
You must be signed in to change notification settings - Fork 20
ci: Use generalized action to test against different distributions #239
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
Changes from all commits
5188e52
425f312
f045592
41b1626
b6e1feb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| name: Ansible CI | ||
| on: [push, pull_request] | ||
|
|
||
| env: | ||
| ANSIBLE_INJECT_FACT_VARS: "false" | ||
|
|
||
| jobs: | ||
| test: | ||
| if: | | ||
| !((github.event_name == 'pull_request' && contains(github.event.pull_request.title, '[citest_skip]')) || | ||
| (github.event_name == 'push' && contains(github.event.head_commit.message, '[citest_skip]'))) | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| os_image: | ||
| - alpine:latest | ||
| - quay.io/centos/centos:stream8 | ||
| - quay.io/centos/centos:stream9 | ||
| - quay.io/centos/centos:stream10 | ||
| - debian:bullseye | ||
| - debian:bookworm | ||
| - debian:latest | ||
| - fedora:latest | ||
| - ubuntu:22.04 | ||
| - ubuntu:24.04 | ||
| - ubuntu:latest | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v6 | ||
|
Comment on lines
+30
to
+31
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Verify checkout steps explicitly disable credential persistence
rg -nP --type=yaml 'uses:\s*actions/checkout@' .github/workflows -C2
rg -nP --type=yaml 'persist-credentials:\s*false' .github/workflowsRepository: linux-system-roles/ssh Length of output: 5617 Add 🧰 Tools🪛 zizmor (1.25.2)[warning] 30-31: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false (artipacked) [error] 31-31: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy) (unpinned-uses) 🤖 Prompt for AI Agents
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The .github/workflow/*.yml files are generated from the common source in https://github.com/linux-system-roles/.github/tree/main/playbooks/templates/.github/workflows There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
gh issue create \
--repo linux-system-roles/.github \
--title "ci: Add persist-credentials: false and pin actions/checkout to a hash in workflow templates" \
--body "## Summary
The \`.github/workflows/\` YAML files generated from the templates in this repository have two security-related findings flagged by [zizmor](https://github.com/woodruffw/zizmor) in [linux-system-roles/ssh#239](https://github.com/linux-system-roles/ssh/pull/239).
These findings apply to the template source used to generate the workflow files, so fixes should be made here.
---
## Finding 1 — Credential persistence (artipacked)
**Severity:** Warning
**Rule:** \`artipacked\`
The \`actions/checkout\` step does not set \`persist-credentials: false\`. This means GitHub credentials (the \`GITHUB_TOKEN\`) are written to the local git config and remain available to all subsequent steps and any action invoked after checkout, which is a wider-than-necessary credential scope.
**Suggested fix:**
\`\`\`yaml
- name: Checkout code
uses: actions/checkout@<hash>
with:
persist-credentials: false
\`\`\`
---
## Finding 2 — Unpinned action reference (unpinned-uses)
**Severity:** Error
**Rule:** \`unpinned-uses\`
\`actions/checkout@v6\` is referenced by a mutable tag rather than an immutable commit hash. A compromised or altered tag could introduce unexpected code into CI.
**Suggested fix:** Pin to the full commit SHA of the desired release, e.g.:
\`\`\`yaml
uses: actions/checkout@<full-sha> # v6
\`\`\`
---
## References
- PR where this was flagged: https://github.com/linux-system-roles/ssh/pull/239#discussion_r3320114000
- Raised by: `@richm`
"Length of output: 1770
linux-system-roles/.github#170 ✏️ Learnings added
|
||
|
|
||
| - name: Test Ansible SSH Role | ||
| uses: Jakuje/check-ansible-action@main | ||
|
Comment on lines
+31
to
+34
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Verify all workflow `uses:` refs are SHA-pinned
rg -nP --type=yaml '^\s*uses:\s*[^@]+@(?!(?:[0-9a-fA-F]{40})\b).+$' .github/workflowsRepository: linux-system-roles/ssh Length of output: 2927 Pin third-party GitHub Actions to immutable commit SHAs in In
Suggested hardening diff- - name: Checkout code
- uses: actions/checkout@v6
+ - name: Checkout code
+ uses: actions/checkout@<full-commit-sha-for-v6>
- - name: Test Ansible SSH Role
- uses: Jakuje/check-ansible-action@main
+ - name: Test Ansible SSH Role
+ uses: Jakuje/check-ansible-action@<full-commit-sha>🧰 Tools🪛 zizmor (1.25.2)[error] 31-31: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy) (unpinned-uses) [error] 34-34: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy) (unpinned-uses) 🤖 Prompt for AI Agents
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The .github/workflow/*.yml files are generated from the common source in https://github.com/linux-system-roles/.github/tree/main/playbooks/templates/.github/workflows There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
gh issue create \
--repo linux-system-roles/.github \
--title "Pin GitHub Actions to immutable commit SHAs in workflow templates" \
--body "## Summary
The workflow templates under \`playbooks/templates/.github/workflows/\` (which generate \`.github/workflows/ansible-check.yml\` and related files in downstream roles such as [linux-system-roles/ssh#239](https://github.com/linux-system-roles/ssh/pull/239)) currently reference GitHub Actions using floating tags rather than immutable commit SHAs.
## Examples flagged
\`\`\`yaml
uses: actions/checkout@v6
uses: Jakuje/check-ansible-action@main
\`\`\`
## Risk
Floating tags (e.g., \`@v6\`, \`@main\`) can be moved upstream at any time, meaning CI behavior can change — or be hijacked — without any change to this repository. Pinning to full commit SHAs provides a stable, auditable reference.
## Suggested fix
Replace floating tag references with the corresponding full 40-character commit SHAs, for example:
\`\`\`yaml
uses: actions/checkout@<full-sha-for-v6>
uses: Jakuje/check-ansible-action@<full-sha-for-current-main>
\`\`\`
Tools such as [Dependabot](https://docs.github.com/en/code-security/dependabot/working-with-dependabot/keeping-your-actions-up-to-date-with-dependabot) or [zizmor](https://github.com/woodruffw/zizmor) can help automate this.
## References
- Flagged by CodeRabbit static analysis (zizmor rule \`unpinned-uses\`) in [linux-system-roles/ssh#239 (comment)](https://github.com/linux-system-roles/ssh/pull/239#discussion_r3320114005)
- Requested by `@richm`
"Length of output: 1660
✏️ Learnings added
|
||
| with: | ||
| image: ${{ matrix.os_image }} | ||
| group: local | ||
| hosts: localhost | ||
| targets: "tests/tests_*.yml" | ||
This file was deleted.
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| --- | ||
| __ssh_packages: ['openssh-client-default'] | ||
|
|
||
| __ssh_supports_drop_in: true | ||
| __ssh_drop_in_name: "00-ansible" | ||
|
|
||
| # This default lists the main configuration file defaults | ||
| __ssh_defaults: | ||
| Include: /etc/ssh/ssh_config.d/*.conf |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| --- | ||
| __ssh_packages: ['openssh-client'] | ||
|
|
||
| # This system supports drop in directory so defaults are adjusted | ||
| __ssh_supports_drop_in: true | ||
| __ssh_drop_in_name: "00-ansible" | ||
|
|
||
| # This default lists the main configuration file defaults | ||
| __ssh_defaults: | ||
| Include: /etc/ssh/ssh_config.d/*.conf | ||
| Host: | ||
| - Condition: "*" | ||
| SendEnv: LANG LC_* COLORTERM NO_COLOR | ||
| HashKnownHosts: true | ||
| GSSAPIAuthentication: true |
Uh oh!
There was an error while loading. Please reload this page.