Skip to content
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
6 changes: 3 additions & 3 deletions .github/workflows/ansible-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ jobs:
sudo apt install -y git

- name: Checkout repo
uses: actions/checkout@v7
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1

- name: Install tox, tox-lsr
run: |
set -euxo pipefail
pip3 install "git+https://github.com/linux-system-roles/tox-lsr@3.20.1"
pip3 install "git+https://github.com/linux-system-roles/tox-lsr@d594be24ed56e586a5796720d51c261e40c20496"

- name: Set up Python
uses: actions/setup-python@v7
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7
with:
python-version: ${{ matrix.versions.python }}

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ansible-managed-var-comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ jobs:
sudo apt install -y git

- name: Checkout repo
uses: actions/checkout@v7
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1

- name: Install tox, tox-lsr
run: |
set -euxo pipefail
pip3 install "git+https://github.com/linux-system-roles/tox-lsr@3.20.1"
pip3 install "git+https://github.com/linux-system-roles/tox-lsr@d594be24ed56e586a5796720d51c261e40c20496"

- name: Run ansible-plugin-scan
run: |
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ansible-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ jobs:
sudo apt install -y git

- name: Checkout repo
uses: actions/checkout@v7
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1

- name: Install tox, tox-lsr
run: |
set -euxo pipefail
pip3 install "git+https://github.com/linux-system-roles/tox-lsr@3.20.1"
pip3 install "git+https://github.com/linux-system-roles/tox-lsr@d594be24ed56e586a5796720d51c261e40c20496"

- name: Set up Python
uses: actions/setup-python@v7
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7
with:
python-version: ${{ matrix.versions.python }}

Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/build_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
sudo apt install -y git

- name: Check out code
uses: actions/checkout@v7
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -eu
printf '%s\n' '--- workflow files ---'
for f in .github/workflows/build_docs.yml .github/workflows/changelog_to_tag.yml .github/workflows/test_converting_readme.yml; do
  printf '\n--- %s ---\n' "$f"
  sed -n '1,140p' "$f"
done
printf '\n--- checkout and credential-related usage ---\n'
rg -n -C 3 'actions/checkout|persist-credentials|git (ls-remote|fetch|push)|GITHUB_TOKEN|github.token|token:' .github/workflows

Repository: linux-system-roles/network

Length of output: 22448


🌐 Web query:

actions/checkout persist-credentials false official README token local git config

💡 Result:

In the actions/checkout GitHub Action, the persist-credentials input determines whether the authentication token (or SSH key) used to clone the repository is configured in the local git configuration [1][2]. When persist-credentials is set to true (the default), the action configures the authentication credentials into the local git environment [1][2]. This allows your workflow scripts to run authenticated git commands (such as git push or git pull) without manually providing the token or key again [1][2]. These credentials are automatically removed during the post-job cleanup phase [1][2]. When you set persist-credentials: false, the action will not configure these credentials in the local git configuration [1][2]. This is often used to prevent the runner from having persistent authenticated access to the repository, which can be a security consideration if you are running untrusted scripts or want to strictly limit the scope of the token's availability [3]. It is important to note that in newer versions of actions/checkout (starting with v6), the way credentials are persisted has been updated [4]. Instead of being written directly into the main.git/config file, credentials are now stored in a separate configuration file in the runner's temporary directory ($RUNNER_TEMP) and included using Git's includeIf mechanism [4]. This change improves security by isolating the credentials from the primary repository configuration [4]. If you set persist-credentials: false, your scripts will not have the repository's access token available via the local git configuration, meaning git commands requiring authentication will fail unless you provide alternative authentication methods [1][2].

Citations:


🌐 Web query:

ad-m github-push-action github_token authentication README official

💡 Result:

For the ad-m/github-push-action, authentication is primarily handled via the token input, which supports the default GITHUB_TOKEN or a personal access token (PAT) [1][2][3]. Key points regarding authentication and configuration: 1. Recommended Input: The preferred input name is token, which aligns with common conventions used by other actions like actions/checkout [3][4]. 2. Backward Compatibility: The github_token input remains supported as a non-breaking configuration option [1][2]. It defaults to ${{ github.token }} [3]. 3. Required Permissions: To push changes to a repository, the GITHUB_TOKEN must be configured with read and write permissions [1][3]. This is managed in the repository settings under Actions > General > Workflow permissions [1]. 4. Important Checkout Configuration: If you are using actions/checkout to prepare your workspace, you must set persist-credentials: false in the checkout step to prevent it from persisting the default credentials, which would otherwise override the token you intend to use for the push [5][3]. 5. Cross-Repository Pushing: If you need to push to a different repository, you must use a personal access token (PAT) or a GitHub App Token and pass it to the token input [1][5][6]. For further implementation details and examples, including how to set up GitHub App Tokens, you can refer to the official repository README [1][6].

Citations:


🏁 Script executed:

#!/bin/bash
set -eu
python3 - <<'PY'
from pathlib import Path
import re

files = [
    Path(".github/workflows/build_docs.yml"),
    Path(".github/workflows/changelog_to_tag.yml"),
    Path(".github/workflows/test_converting_readme.yml"),
]

for path in files:
    lines = path.read_text().splitlines()
    print(f"--- {path} ---")
    for i, line in enumerate(lines):
        if "uses: actions/checkout@" not in line:
            continue
        end = len(lines)
        for j in range(i + 1, len(lines)):
            if re.match(r"\s*-\s+", lines[j]):
                end = j
                break
        block = lines[i:end]
        persist = [x.strip() for x in block if "persist-credentials:" in x]
        later_git = [
            (k + 1, x.strip())
            for k, x in enumerate(lines[i:end], i)
            if re.search(r"\bgit\s+(ls-remote|fetch|push)\b", x)
        ]
        print(f"checkout line {i+1}: persist={persist or ['default']}; git commands in step block={later_git}")
PY

Repository: linux-system-roles/network

Length of output: 650


🏁 Script executed:

#!/bin/bash
set -eu
python3 - <<'PY'
from pathlib import Path
import re

files = [
    Path(".github/workflows/build_docs.yml"),
    Path(".github/workflows/changelog_to_tag.yml"),
    Path(".github/workflows/test_converting_readme.yml"),
]

step_start = re.compile(r"^\s{6}-\s+(?:name:|uses:)")
for path in files:
    lines = path.read_text().splitlines()
    steps = []
    start = None
    for index, line in enumerate(lines):
        if step_start.match(line):
            if start is not None:
                steps.append((start, index))
            start = index
    if start is not None:
        steps.append((start, len(lines)))

    print(f"--- {path} ---")
    for start, end in steps:
        block = lines[start:end]
        checkout = next((x for x in block if "uses: actions/checkout@" in x), None)
        if checkout:
            persist = next((x.strip() for x in block if "persist-credentials:" in x), "persist-credentials: default")
            print(f"checkout line {start + 1}: {persist}")
        commands = [
            f"{i + 1}: {line.strip()}"
            for i, line in enumerate(block)
            if re.search(r"\bgit\s+(ls-remote|fetch|push)\b", line)
        ]
        if commands:
            print("  credential-dependent Git commands:")
            print("  " + "\n  ".join(commands))
PY

Repository: linux-system-roles/network

Length of output: 736


Disable credential persistence on all five checkout steps.

Set persist-credentials: false for each listed checkout. Provide authentication explicitly for git ls-remote, git push, and git fetch --all --tags. The existing github_token input keeps the final github-push-action push authenticated.

📍 Affects 3 files
  • .github/workflows/build_docs.yml#L28-L28 (this comment)
  • .github/workflows/build_docs.yml#L51-L56
  • .github/workflows/changelog_to_tag.yml#L25-L25
  • .github/workflows/test_converting_readme.yml#L32-L32
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/build_docs.yml at line 28, Disable credential persistence
on all checkout steps: update .github/workflows/build_docs.yml lines 28-28 and
51-56, .github/workflows/changelog_to_tag.yml line 25, and
.github/workflows/test_converting_readme.yml line 32 with persist-credentials:
false. Add explicit authentication to the git ls-remote, git push, and git fetch
--all --tags commands, while preserving the existing github_token input for
github-push-action.

Source: Linters/SAST tools

with:
fetch-depth: 0
- name: Ensure the docs branch
Expand All @@ -48,12 +48,12 @@ jobs:
fi

- name: Checkout the docs branch
uses: actions/checkout@v7
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
ref: docs

- name: Fetch README.md and .pandoc_template.html5 template from the workflow branch
uses: actions/checkout@v7
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
sparse-checkout: |
README.md
Expand Down Expand Up @@ -91,7 +91,7 @@ jobs:
run: cp ${{ env.RELEASE_VERSION }}/README.html docs/index.html

- name: Upload README.html as an artifact
uses: actions/upload-artifact@v7
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: README.html
path: ${{ env.RELEASE_VERSION }}/README.html
Expand All @@ -104,7 +104,7 @@ jobs:
git commit -m "Update README.html for ${{ env.RELEASE_VERSION }}"

- name: Push changes
uses: ad-m/github-push-action@master
uses: ad-m/github-push-action@881a6320fdb16eb5318c5054f31c218aec2b324c # master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: docs
8 changes: 4 additions & 4 deletions .github/workflows/changelog_to_tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
sudo apt install -y git

- name: checkout PR
uses: actions/checkout@v7
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1

- name: Get tag and message from the latest CHANGELOG.md commit
id: tag
Expand Down Expand Up @@ -69,23 +69,23 @@ jobs:
echo "tagname=$_tagname" >> "$GITHUB_OUTPUT"
echo "branch=$_branch" >> "$GITHUB_OUTPUT"
- name: Create tag
uses: mathieudutour/github-tag-action@v6.2
uses: mathieudutour/github-tag-action@a22cf08638b34d5badda920f9daf6e72c477b07b # v6.2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
custom_tag: ${{ steps.tag.outputs.tagname }}
tag_prefix: ''

- name: Create Release
id: create_release
uses: ncipollo/release-action@v1
uses: ncipollo/release-action@339a81892b84b4eeb0f6e744e4574d79d0d9b8dd # v1
with:
tag: ${{ steps.tag.outputs.tagname }}
name: Version ${{ steps.tag.outputs.tagname }}
bodyFile: ./.tagmsg.txt
makeLatest: true

- name: Publish role to Galaxy
uses: robertdebock/galaxy-action@1.2.1
uses: robertdebock/galaxy-action@7d89099e09f4385ec4b53eb58c0d120f1ad806dd # 1.2.1
with:
galaxy_api_key: ${{ secrets.galaxy_api_key }}
git_branch: ${{ steps.tag.outputs.branch }}
8 changes: 4 additions & 4 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,18 @@ jobs:
sudo apt update
sudo apt install -y git
- name: Checkout
uses: actions/checkout@v7
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1

- name: Initialize CodeQL
uses: github/codeql-action/init@v4.37.4
uses: github/codeql-action/init@f205ea1c3313d32999d8d6a48b4f6530d4437b38 # v4.37.4
with:
languages: ${{ matrix.language }}
queries: +security-and-quality

- name: Autobuild
uses: github/codeql-action/autobuild@v4.37.4
uses: github/codeql-action/autobuild@f205ea1c3313d32999d8d6a48b4f6530d4437b38 # v4.37.4

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v4.37.4
uses: github/codeql-action/analyze@f205ea1c3313d32999d8d6a48b4f6530d4437b38 # v4.37.4
with:
category: "/language:${{ matrix.language }}"
4 changes: 2 additions & 2 deletions .github/workflows/codespell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1

- name: Codespell
uses: codespell-project/actions-codespell@v2
uses: codespell-project/actions-codespell@406322ec52dd7b488e48c1c4b82e2a8b3a1bf630 # v2
2 changes: 1 addition & 1 deletion .github/workflows/markdownlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
sudo apt install -y git

- name: Check out code
uses: actions/checkout@v7
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -eu

for f in .github/workflows/markdownlint.yml .github/workflows/woke.yml; do
  echo "===== $f ====="
  wc -l "$f"
  cat -n "$f"
done

echo "===== reported references ====="
rg -n -C 3 --fixed-strings \
  -e 'docker://avtodev/markdown-lint:master' \
  -e 'tox-lsr/main' \
  -e 'actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1' \
  -e 'linux-system-roles/lsr-woke-action@c9aa70dcf848deb3e1bf4fdea085ce49bf02341b' \
  .github

Repository: linux-system-roles/network

Length of output: 12853


🏁 Script executed:

#!/bin/bash
set -u

echo "===== tox-lsr main branch ====="
curl -fsSL \
  -H 'Accept: application/vnd.github+json' \
  'https://api.github.com/repos/linux-system-roles/tox-lsr/commits/main' |
  jq -r '{sha: .sha, message: .commit.message}'

echo "===== lsr-woke-action pinned commit ====="
curl -fsSL \
  -H 'Accept: application/vnd.github+json' \
  'https://api.github.com/repos/linux-system-roles/lsr-woke-action/commits/c9aa70dcf848deb3e1bf4fdea085ce49bf02341b' |
  jq -r '{sha: .sha, message: .commit.message}'

echo "===== markdown-lint Docker Hub tag ====="
curl -fsSL \
  'https://hub.docker.com/v2/repositories/avtodev/markdown-lint/tags/master' |
  jq -r '{name: .name, digest: .digest, last_updated: .last_updated, images: [.images[]? | {digest: .digest, architecture: .architecture, os: .os}]}'

Repository: linux-system-roles/network

Length of output: 798


🏁 Script executed:

#!/bin/bash
set -eu

tox_sha='d594be24ed56e586a5796720d51c261e40c20496'
image_digest='sha256:040db72e30eae54299c0b8f87dfe24dadaf2d9a36c037408f5c9686cab0e105d'

grep -Fq 'uses: docker://avtodev/markdown-lint:master' .github/workflows/markdownlint.yml
grep -Fq 'https://raw.githubusercontent.com/linux-system-roles/tox-lsr/main/src/tox_lsr/config_files/woke.yml' .github/workflows/woke.yml

resolved_tox_sha="$(
  curl -fsSL \
    -H 'Accept: application/vnd.github+json' \
    "https://api.github.com/repos/linux-system-roles/tox-lsr/commits/$tox_sha" |
  jq -r '.sha'
)"
test "$resolved_tox_sha" = "$tox_sha"

manifest_headers="$(
  curl -fsSLI \
    -H 'Accept: application/vnd.docker.distribution.manifest.v2+json' \
    'https://registry-1.docker.io/v2/avtodev/markdown-lint/manifests/master'
)"
printf '%s\n' "$manifest_headers" | grep -Fiq "docker-content-digest: $image_digest"

printf '%s\n' "mutable workflow references present"
printf '%s\n' "tox-lsr main resolves to $resolved_tox_sha"
printf '%s\n' "markdown-lint master resolves to $image_digest"

Repository: linux-system-roles/network

Length of output: 215


🏁 Script executed:

#!/bin/bash
set -eu

repository='avtodev/markdown-lint'
expected='sha256:040db72e30eae54299c0b8f87dfe24dadaf2d9a36c037408f5c9686cab0e105d'

auth_header="$(
  curl -fsSL \
    'https://auth.docker.io/token?service=registry.docker.io&scope=repository:avtodev/markdown-lint:pull' |
  jq -r '.token' |
  sed 's/^/Authorization: Bearer /'
)"

headers="$(
  curl -fsSLI \
    -H "$auth_header" \
    -H 'Accept: application/vnd.docker.distribution.manifest.list.v2+json' \
    -H 'Accept: application/vnd.docker.distribution.manifest.v2+json' \
    "https://registry-1.docker.io/v2/$repository/manifests/master"
)"

printf '%s\n' "$headers"
printf '%s\n' "$headers" |
  tr -d '\r' |
  grep -Fiq "docker-content-digest: $expected"

printf '%s\n' "registry digest matches $expected"

Repository: linux-system-roles/network

Length of output: 880


Pin the remaining external references immutably.

  • Replace docker://avtodev/markdown-lint:master with docker://avtodev/markdown-lint@sha256:040db72e30eae54299c0b8f87dfe24dadaf2d9a36c037408f5c9686cab0e105d.
  • Replace the tox-lsr/main URL with the same path at commit d594be24ed56e586a5796720d51c261e40c20496.

The lsr-woke-action reference is already pinned to a commit SHA.

📍 Affects 2 files
  • .github/workflows/markdownlint.yml#L31-L31 (this comment)
  • .github/workflows/woke.yml#L14-L18
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/markdownlint.yml at line 31, Update the external
references in .github/workflows/markdownlint.yml lines 31-31 and
.github/workflows/woke.yml lines 14-18: replace
docker://avtodev/markdown-lint:master with the specified sha256 digest and
replace the tox-lsr/main URL with commit
d594be24ed56e586a5796720d51c261e40c20496. Leave the already-pinned
lsr-woke-action reference unchanged.


# CHANGELOG.md is generated automatically from PR titles and descriptions
# It might have issues but they are not critical
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-title-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
commit-checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
fetch-depth: 0
Comment on lines +21 to 23

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -eu

printf '%s\n' '--- workflow ---'
cat -n .github/workflows/pr-title-lint.yml

printf '%s\n' '--- candidate files and references ---'
git ls-files | rg '(^|/)(pr_title_lint\.py|.*pr.*title.*lint.*|.*workflow.*)$' || true
rg -n --hidden --glob '!.git' 'pr_title_lint\.py|persist-credentials|git (fetch|push|pull|clone)|GITHUB_TOKEN|github\.token|actions/checkout' .github . 2>/dev/null | head -300

Repository: linux-system-roles/network

Length of output: 9071


🏁 Script executed:

#!/bin/bash
set -eu

python3 - <<'PY'
from pathlib import Path
import re

path = Path(".github/workflows/pr-title-lint.yml")
text = path.read_text()

checkout = re.search(
    r"uses:\s*actions/checkout@[^\n]+\n(?P<with>(?:\s+.*\n)*)",
    text,
)
with_block = checkout.group("with") if checkout else ""
has_persist_false = bool(re.search(r"^\s+persist-credentials:\s*false\s*$", with_block, re.M))
downloads_script = bool(re.search(r"curl\s+-o\s+pr_title_lint\.py\s+https://raw\.githubusercontent\.com/", text))
executes_script = bool(re.search(r"python3\s+pr_title_lint\.py\b", text))
has_authenticated_git = bool(re.search(r"^\s*(?:run:.*\b|-\s+run:.*\b)(?:git\s+(?:fetch|pull|push|clone)|gh\s+)", text, re.M))

print({
    "checkout_present": checkout is not None,
    "persist_credentials_false": has_persist_false,
    "downloads_external_python": downloads_script,
    "executes_downloaded_python": executes_script,
    "later_authenticated_git_command": has_authenticated_git,
    "contents_read_permission": bool(re.search(r"^\s+contents:\s*read\s*$", text, re.M)),
})
PY

Repository: linux-system-roles/network

Length of output: 374


🌐 Web query:

official actions/checkout README persist-credentials default local git config

💡 Result:

In the official actions/checkout GitHub Action, the persist-credentials input determines whether the authentication token or SSH key used to fetch the repository is configured within the local git environment [1][2]. Key details include: Default Behavior: The default value for persist-credentials is true [1][2]. When enabled, the action configures the provided token or SSH key in the local git environment, which allows subsequent steps in the same job to execute authenticated git commands (e.g., git push or git fetch) without additional configuration [1][2]. Security and Cleanup: The credentials are removed during the post-job cleanup process [1][2]. Recent updates have improved security by storing these credentials in a file under $RUNNER_TEMP instead of directly within the local.git/config file, requiring a minimum Actions Runner version of v2.329.0 for this approach [3][4]. Opting Out: To prevent the action from configuring credentials in the local git environment, you can explicitly set persist-credentials to false in your workflow step [1][5]: - uses: actions/checkout@v4 with: persist-credentials: false While there has been community discussion and proposals regarding changing this default to false for security reasons, it remains true by default in the current version [6][7].

Citations:


🏁 Script executed:

#!/bin/bash
set -eu

sha='3d3c42e5aac5ba805825da76410c181273ba90b1'
base="https://raw.githubusercontent.com/actions/checkout/${sha}"

printf '%s\n' '--- pinned action.yml ---'
curl -fsSL "$base/action.yml" | sed -n '1,180p'

printf '%s\n' '--- pinned package/source references ---'
curl -fsSL "$base/action.yml" | rg -n 'runs:|main:|persist-credentials|version' || true
curl -fsSL "https://api.github.com/repos/actions/checkout/commits/${sha}" |
  jq -r '{sha: .sha, message: .commit.message, date: .commit.committer.date}'

Repository: linux-system-roles/network

Length of output: 5912


🌐 Web query:

actions/checkout 3d3c42e5aac5ba805825da76410c181273ba90b1 persist-credentials RUNNER_TEMP

💡 Result:

The commit SHA 3d3c42e5aac5ba805825da76410c181273ba90b1 corresponds to a version of the actions/checkout GitHub Action, specifically associated with the v7.0.1 release [1][2][3]. Regarding the technical context of persist-credentials and RUNNER_TEMP: 1. Refactored Credential Management: Starting with version v6.0.0, actions/checkout changed how it handles the persist-credentials input [4][5][6]. Previously, credentials were stored directly in the repository's .git/config file [4][5]. 2. Move to RUNNER_TEMP: The action now persists Git credentials in a separate configuration file located in the directory specified by the RUNNER_TEMP environment variable [4][5]. 3. Mechanism: This change improves security by isolating credentials from the repository's main Git configuration [4][7]. The action utilizes Git's includeIf.gitdir mechanism to conditionally include these credentials only when operating within the relevant Git directory [4][7]. 4. Requirements: Because this approach relies on specific file structures and Git features, it requires an Actions Runner version of v2.329.0 or higher to function correctly, particularly in scenarios involving Docker container actions [4][5][6]. The input persist-credentials remains a boolean option (defaulting to true) that controls whether the action configures the authentication token or SSH key into the local Git configuration [8][6]. When enabled, this allows subsequent steps in your workflow to run authenticated Git commands [6].

Citations:


Disable checkout credential persistence.

Because the job executes downloaded Python code, set persist-credentials: false. The default is true, so the script can use the checkout token for authenticated Git operations. No later step requires this access.

Proposed fix
       - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
         with:
           fetch-depth: 0
+          persist-credentials: false
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
fetch-depth: 0
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
fetch-depth: 0
persist-credentials: false
🧰 Tools
🪛 zizmor (1.29.0)

[warning] 21-23: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false

(artipacked)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/pr-title-lint.yml around lines 21 - 23, Update the
actions/checkout step to set persist-credentials to false alongside fetch-depth,
ensuring the downloaded Python code cannot reuse the checkout token for
authenticated Git operations.

Source: Linters/SAST tools


Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/python-unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
sudo apt install -y git

- name: checkout PR
uses: actions/checkout@v7
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -eu
printf '%s\n' '--- workflow excerpts ---'
for f in .github/workflows/python-unit-test.yml .github/workflows/qemu-kvm-integration-tests.yml; do
  echo "### $f"
  nl -ba "$f" | sed -n '1,140p'
done
printf '%s\n' '--- checkout usage and workflow permissions ---'
rg -n -C 3 'actions/checkout|persist-credentials|permissions:|run:' .github/workflows/python-unit-test.yml .github/workflows/qemu-kvm-integration-tests.yml

Repository: linux-system-roles/network

Length of output: 10972


🏁 Script executed:

#!/bin/bash
set -eu
for f in .github/workflows/python-unit-test.yml .github/workflows/qemu-kvm-integration-tests.yml; do
  echo "### $f"
  wc -l "$f"
  sed -n '1,240p' "$f"
done

Repository: linux-system-roles/network

Length of output: 13217


🌐 Web query:

site:github.com/actions/checkout README persist-credentials false default

💡 Result:

The default value for the persist-credentials input in the actions/checkout GitHub Action is currently true [1][2][3]. When set to true (the default), the action configures the authentication token or SSH key in the local git configuration, which allows subsequent steps in the same job to execute authenticated git commands [1][3][4]. The credentials are removed during the post-job cleanup [1][2][4]. If you wish to prevent the action from persisting these credentials, you must explicitly set persist-credentials to false in your workflow file [1][2][5]. This opt-out is recommended to reduce the risk of exposing the GITHUB_TOKEN or other credentials to subsequent steps in a workflow [6][5]. Note that there have been ongoing discussions and pull requests within the actions/checkout repository aimed at changing this default to false to improve security [6][5].

Citations:


🏁 Script executed:

#!/bin/bash
set -eu
python3 - <<'PY'
from pathlib import Path
import re

files = [
    Path(".github/workflows/python-unit-test.yml"),
    Path(".github/workflows/qemu-kvm-integration-tests.yml"),
]

for path in files:
    text = path.read_text()
    checkout = re.search(
        r"(?m)^\s*-\s+name:.*\n\s+uses:\s+actions/checkout@[^ \n]+(?P<rest>.*(?:\n\s+.+)*)?",
        text,
    )
    # Use line-oriented parsing to avoid treating unrelated `with:` blocks as
    # checkout inputs.
    lines = text.splitlines()
    checkout_index = next(
        i for i, line in enumerate(lines)
        if re.match(r"\s*uses:\s*actions/checkout@", line)
    )
    next_step = next(
        (i for i in range(checkout_index + 1, len(lines))
         if re.match(r"\s*-\s+name:", lines[i])),
        len(lines),
    )
    checkout_block = lines[checkout_index:next_step]
    later_run = [
        (i + 1, line.strip())
        for i, line in enumerate(lines[next_step:], start=next_step)
        if re.match(r"\s*run:", line)
    ]
    permissions = []
    in_permissions = False
    for line in lines:
        if re.match(r"^permissions:\s*$", line):
            in_permissions = True
            continue
        if in_permissions and line and not line[0].isspace():
            in_permissions = False
        if in_permissions and re.match(r"^\s+[A-Za-z-]+:\s+\S+", line):
            permissions.append(line.strip())

    print(path)
    print("  checkout:", lines[checkout_index].strip())
    print("  checkout block:", [line.strip() for line in checkout_block])
    print("  persist-credentials present:",
          any("persist-credentials:" in line for line in checkout_block))
    print("  later run steps:", len(later_run), later_run[:5])
    print("  permissions:", permissions)
PY

Repository: linux-system-roles/network

Length of output: 921


Disable checkout credential persistence in both workflows. Add with: persist-credentials: false to both checkout steps. Subsequent repository commands otherwise can access the persisted GITHUB_TOKEN; the integration workflow also grants statuses: write.

  • .github/workflows/python-unit-test.yml#L46
  • .github/workflows/qemu-kvm-integration-tests.yml#L55
🧰 Tools
🪛 zizmor (1.29.0)

[warning] 45-46: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false

(artipacked)

📍 Affects 2 files
  • .github/workflows/python-unit-test.yml#L46-L46 (this comment)
  • .github/workflows/qemu-kvm-integration-tests.yml#L55-L55
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/python-unit-test.yml at line 46, Update the checkout steps
in .github/workflows/python-unit-test.yml:46-46 and
.github/workflows/qemu-kvm-integration-tests.yml:55-55 to include
with.persist-credentials set to false, disabling credential persistence in both
workflows.

Source: Linters/SAST tools


- name: Set up Python 2.7
if: ${{ matrix.pyver_os.ver == '2.7' }}
Expand All @@ -53,7 +53,7 @@ jobs:

- name: Set up Python 3
if: ${{ matrix.pyver_os.ver != '2.7' }}
uses: actions/setup-python@v7
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7
with:
python-version: ${{ matrix.pyver_os.ver }}

Expand All @@ -70,7 +70,7 @@ jobs:
tox=tox
virtualenv=virtualenv
fi
pip install "$tox" "$virtualenv" "git+https://github.com/linux-system-roles/tox-lsr@3.20.1"
pip install "$tox" "$virtualenv" "git+https://github.com/linux-system-roles/tox-lsr@d594be24ed56e586a5796720d51c261e40c20496"
# If you have additional OS dependency packages e.g. libcairo2-dev
# then put them in .github/config/ubuntu-requirements.txt, one
# package per line.
Expand All @@ -92,4 +92,4 @@ jobs:
TOXENV="$toxenvs" lsr_ci_runtox

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v7
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7
10 changes: 5 additions & 5 deletions .github/workflows/qemu-kvm-integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:

steps:
- name: Checkout repo
uses: actions/checkout@v7
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1

- name: Check if platform is supported
id: check_platform
Expand Down Expand Up @@ -111,7 +111,7 @@ jobs:
python3 -m pip install --upgrade pip
sudo apt update
sudo apt install -y --no-install-recommends git ansible-core genisoimage qemu-system-x86
pip3 install "git+https://github.com/linux-system-roles/tox-lsr@3.20.1"
pip3 install "git+https://github.com/linux-system-roles/tox-lsr@d594be24ed56e586a5796720d51c261e40c20496"

- name: Check for podman version 5 or higher
id: check_podman_version
Expand All @@ -128,7 +128,7 @@ jobs:

- name: Ensure use of podman 5
if: steps.check_platform.outputs.supported && steps.check_podman_version.outputs.need_podman_update == 1
uses: redhat-actions/podman-install@main
uses: redhat-actions/podman-install@3b6c60c447c93960c0b76faa0c66c6694bc71350 # main

- name: Configure tox-lsr
if: steps.check_platform.outputs.supported
Expand Down Expand Up @@ -212,7 +212,7 @@ jobs:

- name: Upload test logs on failure
if: failure()
uses: actions/upload-artifact@v7
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: "logs-${{ matrix.scenario.image }}-${{ matrix.scenario.env }}"
path: |
Expand All @@ -238,7 +238,7 @@ jobs:

- name: Set commit status as success with a description that platform is skipped
if: ${{ steps.check_platform.outputs.supported == '' }}
uses: myrotvorets/set-commit-status-action@master
uses: myrotvorets/set-commit-status-action@2774e1f040c82ed70a76b4b5cd53bb11ffaedd0a # master
with:
status: success
context: "${{ github.workflow }} / scenario (${{ matrix.scenario.image }}, ${{ matrix.scenario.env }}) (pull_request)"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/shellcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ jobs:
sudo apt install -y git

- name: Checkout repo
uses: actions/checkout@v7
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1

- name: Run ShellCheck
id: shellcheck_id
uses: ludeeus/action-shellcheck@master
uses: ludeeus/action-shellcheck@00b27aa7cb85167568cb48a3838b75f4265f2bca # master

- name: Show file paths scanned
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test_converting_readme.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
sudo apt install -y git

- name: Check out code
uses: actions/checkout@v7
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1

- name: Remove badges from README.md prior to converting to HTML
run: sed -i '1,8 {/^\[\!.*actions\/workflows/d}' README.md
Expand All @@ -43,7 +43,7 @@ jobs:
--output README.html README.md

- name: Upload README.html as an artifact
uses: actions/upload-artifact@v7
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: README.html
path: README.html
12 changes: 6 additions & 6 deletions .github/workflows/tft.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
GITHUB_CONTEXT: ${{ toJson(github) }}

- name: Checkout repo
uses: actions/checkout@v7
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1

- name: Get head sha of the PR
id: head_sha
Expand All @@ -49,7 +49,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Checkout PR
uses: actions/checkout@v7
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
ref: ${{ steps.head_sha.outputs.head_sha }}

Expand Down Expand Up @@ -136,7 +136,7 @@ jobs:

- name: Set commit status as pending
if: contains(needs.prepare_vars.outputs.supported_platforms, matrix.platform)
uses: myrotvorets/set-commit-status-action@master
uses: myrotvorets/set-commit-status-action@2774e1f040c82ed70a76b4b5cd53bb11ffaedd0a # master
with:
sha: ${{ needs.prepare_vars.outputs.head_sha }}
status: pending
Expand All @@ -146,7 +146,7 @@ jobs:

- name: Set commit status as success with a description that platform is skipped
if: "!contains(needs.prepare_vars.outputs.supported_platforms, matrix.platform)"
uses: myrotvorets/set-commit-status-action@master
uses: myrotvorets/set-commit-status-action@2774e1f040c82ed70a76b4b5cd53bb11ffaedd0a # master
with:
sha: ${{ needs.prepare_vars.outputs.head_sha }}
status: success
Expand All @@ -155,7 +155,7 @@ jobs:
targetUrl: ""

- name: Run test in testing farm
uses: sclorg/testing-farm-as-github-action@v4
uses: sclorg/testing-farm-as-github-action@230555baceb860aa468d216f1822974836b965d1 # v4
if: contains(needs.prepare_vars.outputs.supported_platforms, matrix.platform)
with:
git_ref: main
Expand Down Expand Up @@ -184,7 +184,7 @@ jobs:
tmt_plan_filter: "tag:playbooks_parallel,network"

- name: Set final commit status
uses: myrotvorets/set-commit-status-action@master
uses: myrotvorets/set-commit-status-action@2774e1f040c82ed70a76b4b5cd53bb11ffaedd0a # master
if: always() && contains(needs.prepare_vars.outputs.supported_platforms, matrix.platform)
with:
sha: ${{ needs.prepare_vars.outputs.head_sha }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/weekly_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
sudo apt install -y git

- name: Checkout latest code
uses: actions/checkout@v7
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
fetch-depth: 0
- name: Create or rebase commit, add dump_packages callback
Expand All @@ -50,7 +50,7 @@ jobs:
git push -f --set-upstream origin ${{ env.BRANCH_NAME }}

- name: Create and comment pull request
uses: actions/github-script@v9
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9
with:
github-token: ${{ secrets.GH_PUSH_TOKEN }}
script: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/woke.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1

- name: Run lsr-woke-action
# Originally, uses: get-woke/woke-action@v0
uses: linux-system-roles/lsr-woke-action@main
uses: linux-system-roles/lsr-woke-action@c9aa70dcf848deb3e1bf4fdea085ce49bf02341b # main
with:
woke-args: "-c https://raw.githubusercontent.com/linux-system-roles/tox-lsr/main/src/tox_lsr/config_files/woke.yml --count-only-error-for-failure"
# Cause the check to fail on any broke rules
Expand Down
Loading