Skip to content
This repository was archived by the owner on Aug 15, 2026. It is now read-only.

OSAC-1681: Add GitHub Actions e2e job - #371

Closed
omer-vishlitzky wants to merge 2 commits into
osac-project:mainfrom
omer-vishlitzky:osac-1681/add-e2e-job
Closed

OSAC-1681: Add GitHub Actions e2e job#371
omer-vishlitzky wants to merge 2 commits into
osac-project:mainfrom
omer-vishlitzky:osac-1681/add-e2e-job

Conversation

@omer-vishlitzky

@omer-vishlitzky omer-vishlitzky commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add e2e-test.yml caller workflow for PR-triggered E2E testing via GitHub Actions
  • Builds Ansible Execution Environment image on ubuntu-latest, pushes to GHCR with pr-<number> tag
  • Calls shared e2e.yml from osac-test-infra with:
    • Component image override (osac-aap)
    • AAP-specific overrides: aap-git-branch (PR head SHA) and aap-git-uri (fork URL for fork PRs)
  • Supports workflow_dispatch for manual execution

Depends on: osac-project/osac-test-infra PR (OSAC-1678) for the component-image and aap-git-branch inputs on e2e.yml

Jira

Test plan

  • Verify workflow triggers on PR to main
  • Verify EE image builds and pushes to GHCR
  • Verify e2e workflow is invoked with correct AAP overrides

Summary by CodeRabbit

  • Tests
    • Added automated end-to-end testing for pull requests targeting the main branch.
    • Builds a pull-request-specific test environment and runs validation automatically.
    • Added support for manually triggering end-to-end test runs.

Add e2e-test.yml caller workflow that builds the PR's Ansible EE image,
pushes to GHCR, and invokes the shared e2e workflow from osac-test-infra
with component image override and AAP-specific projectGitBranch/URI
overrides.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@openshift-ci-robot

openshift-ci-robot commented Jun 24, 2026

Copy link
Copy Markdown

@omer-vishlitzky: This pull request references OSAC-1681 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the task to target the "5.0.0" version, but no target version was set.

Details

In response to this:

Summary

  • Add e2e-test.yml caller workflow for PR-triggered E2E testing via GitHub Actions
  • Builds Ansible Execution Environment image on ubuntu-latest, pushes to GHCR with pr-<number> tag
  • Calls shared e2e.yml from osac-test-infra with:
  • Component image override (osac-aap)
  • AAP-specific overrides: aap-git-branch (PR head SHA) and aap-git-uri (fork URL for fork PRs)
  • Supports workflow_dispatch for manual execution

Depends on: osac-project/osac-test-infra PR (OSAC-1678) for the component-image and aap-git-branch inputs on e2e.yml

Jira

Test plan

  • Verify workflow triggers on PR to main
  • Verify EE image builds and pushes to GHCR
  • Verify e2e workflow is invoked with correct AAP overrides

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@coderabbitai

coderabbitai Bot commented Jun 24, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

Adds a GitHub Actions workflow that builds and publishes a pull-request-specific Ansible execution environment image, then passes it and pull-request metadata to a reusable end-to-end test workflow.

Changes

PR E2E workflow

Layer / File(s) Summary
Build and publish PR image
.github/workflows/e2e-test.yml
The workflow triggers for pull requests targeting main or manual dispatch, installs project tooling, authenticates to GHCR, and builds and pushes a PR-specific image.
Delegate end-to-end tests
.github/workflows/e2e-test.yml
A dependent job invokes the reusable E2E workflow with the built image tag and pull-request-derived repository details.

Estimated code review effort: 3 (Moderate) | ~15–30 minutes

Suggested labels: lgtm, approved

Suggested reviewers: rgolangh, akshaynadkarni

🚥 Pre-merge checks | ✅ 10 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Ai-Attribution ⚠️ Warning The new commit credits Claude with Co-Authored-By, but Red Hat guidance requires Assisted-by for AI assistance. Replace the AI trailer with Assisted-by: ... (or equivalent) and do not use Co-Authored-By for AI tools.
✅ Passed checks (10 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding a GitHub Actions end-to-end job.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
No-Hardcoded-Secrets ✅ Passed No hardcoded secrets found in .github/workflows/e2e-test.yml; only secrets.GITHUB_TOKEN is referenced, with no literal tokens/passwords or embedded credentials.
No-Weak-Crypto ✅ Passed e2e-test.yml only sets image tags and passes commit SHA metadata; no MD5/SHA1/DES/RC4/3DES/Blowfish/ECB, custom crypto, or secret comparisons found.
No-Injection-Vectors ✅ Passed New workflow uses quoted shell args and reusable-workflow inputs; no eval/exec, yaml.load, os.system, pickle.loads, or shell:true found.
Container-Privileges ✅ Passed The added workflow has no container/K8s manifest fields like privileged, hostPID/Network/IPC, SYS_ADMIN, or allowPrivilegeEscalation.
No-Sensitive-Data-In-Logs ✅ Passed No debug tracing or direct secret/PII logging found; GHCR auth pipes GITHUB_TOKEN to stdin, not to logs.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Fix failing CI checks
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@openshift-ci

openshift-ci Bot commented Jul 29, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: omer-vishlitzky
Once this PR has been reviewed and has the lgtm label, please assign rccrdpccl for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 8

🤖 Prompt for all review comments with 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.

Inline comments:
In @.github/workflows/e2e-test.yml:
- Around line 42-50: Add the repository’s existing SAST, dependency/SCA, and
container-image scanning checks between the “Build execution environment” step
and the “Push PR image” step in the workflow. Ensure the push is gated on all
scans completing successfully, reusing established pipeline checks and image
reference symbols such as steps.meta.outputs.image.
- Around line 49-50: Add a dedicated image-signing job after the PR image push
that signs the pushed image by digest using keyless cosign and requests only the
id-token: write permission. Update the E2E workflow’s image-consumption step to
verify that signature before running tests, preserving the existing image
reference and push flow.
- Line 19: Update all workflow action references in the e2e test workflow,
including actions/checkout and osac-test-infra/e2e-prepare, to immutable
40-character commit SHAs instead of tags or branches. Apply this consistently to
the action references at the indicated locations while preserving their existing
inputs and behavior.
- Around line 52-54: Update the e2e job invoking the reusable workflow to
explicitly set least-privilege permissions: apply workflow-wide permissions: {}
and grant only the required scope, such as packages: read when the private image
is pulled.
- Around line 18-19: Update the actions/checkout step named Checkout to set
persist-credentials to false, ensuring the repository token is not retained in
local Git configuration for subsequent PR-controlled steps.
- Around line 4-7: Update the workflow trigger configuration and component-image
reference: add concurrency for pull requests using a group keyed by the PR
number, canceling in-progress runs as appropriate, and replace the mutable
pr-<number> image tag with an immutable commit SHA or pushed digest reference.
Keep workflow_dispatch behavior intact.
- Around line 4-7: Update the workflow_dispatch configuration and the AAP
ref/repository URI references in this workflow so manual runs receive explicit
inputs or conditional fallback values when github.event.pull_request is
unavailable. Preserve the existing pull_request behavior and ensure both values
resolve correctly for either trigger.
- Around line 12-14: Update the workflow’s image publication flow to use a
trusted event or workflow path rather than pull_request_target, while retaining
packages: write for publishing access. Ensure fork-origin pull requests can
trigger the required trusted publication flow without granting them direct write
access.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: osac-project/coderabbit/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 344e0722-696d-4fdb-8520-f3f37e5f4854

📥 Commits

Reviewing files that changed from the base of the PR and between 7018ae1 and de7657a.

📒 Files selected for processing (1)
  • .github/workflows/e2e-test.yml

Comment on lines +4 to +7
on:
pull_request:
branches: [main]
workflow_dispatch: {}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== workflow files =="
git ls-files '.github/workflows/*' | sed -n '1,120p'

echo
echo "== e2e-test.yml =="
if [ -f .github/workflows/e2e-test.yml ]; then
  nl -ba .github/workflows/e2e-test.yml | sed -n '1,140p'
else
  echo "missing .github/workflows/e2e-test.yml"
fi

echo
echo "== component-image references in workflows =="
rg -n "component-image|GITHUB_SHA|github\.pull_request\.head\.sha|ghcr\.io|gh\.cr\.io|pull_request|workflow_dispatch|pull_request_target|concurrency" .github/workflows -S || true

echo
echo "== relevant reusable action refs in workflow =="
rg -n "uses:\s*[^#]+" .github/workflows/e2e-test.yml -S || true

echo
echo "== package metadata maybe =="
for f in package.json pyproject.toml composer.json pom.xml build.gradle settings.gradle; do
  [ -f "$f" ] && { echo "--- $f"; sed -n '1,160p' "$f"; }
done

Repository: osac-project/osac-aap

Length of output: 1931


🏁 Script executed:

#!/bin/bash
set -euo pipefail

python3 - <<'PY'
from pathlib import Path
p=Path('.github/workflows/e2e-test.yml')
if not p.exists():
    print('missing workflow')
    raise SystemExit
txt=p.read_text()
for needle in ['component-image', 'GITHUB_SHA', 'pull_request.head.sha', 'concurrency', 'workflow_dispatch', 'pull_request_target']:
    print(f'{needle}: {needle in txt}')
lines=txt.splitlines()
for i,l in enumerate(lines,1):
    if 'component-image' in l or 'GITHUB_SHA' in l or 'pull_request.head.sha' in l or 'concurrency' in l:
        print(f'{i}: {l}')
PY

Repository: osac-project/osac-aap

Length of output: 1931


Serialize PR runs and make the image reference immutable.

PR runs reuse pr-<number>, and this workflow has no concurrency control. A newer run can overwrite the image while an older E2E job is still consuming it, causing tests to execute against the wrong snapshot. Add a per-PR concurrency group and include the commit SHA or pushed digest in component-image.

🧰 Tools
🪛 zizmor (1.28.0)

[warning] 4-7: insufficient job-level concurrency limits (concurrency-limits): workflow is missing concurrency setting

(concurrency-limits)

🤖 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/e2e-test.yml around lines 4 - 7, Update the workflow
trigger configuration and component-image reference: add concurrency for pull
requests using a group keyed by the PR number, canceling in-progress runs as
appropriate, and replace the mutable pr-<number> image tag with an immutable
commit SHA or pushed digest reference. Keep workflow_dispatch behavior intact.

Source: Linters/SAST tools


🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Repository files matching workflow:"
git ls-files '.github/workflows/**/*' || true

echo
if [ -f .github/workflows/e2e-test.yml ]; then
  echo "Line count:"
  wc -l .github/workflows/e2e-test.yml
  echo
  echo "Relevant contents:"
  nl -ba .github/workflows/e2e-test.yml | sed -n '1,120p'
else
  echo ".github/workflows/e2e-test.yml not found"
fi

Repository: osac-project/osac-aap

Length of output: 1931


🌐 Web query:

GitHub Actions workflow_dispatch inputs required context pull_request github.event.pull_request

💡 Result:

The workflow_dispatch event in GitHub Actions does not natively provide pull request context [1][2]. When a workflow is triggered by workflow_dispatch, the github.event.pull_request context is typically empty or null because the workflow was manually initiated, not triggered by a pull request event [1][3]. Key considerations: 1. Context Availability: The inputs context is only available for workflows triggered by workflow_dispatch (or reusable workflows) [1][2]. Conversely, the github.event.pull_request context is only populated when a workflow is triggered by a pull_request event [3][4]. These two contexts do not inherently share information unless you manually pass pull request data as inputs during the manual trigger. 2. Trigger Behavior: If you include both on: workflow_dispatch and on: pull_request in your workflow file, the workflow will trigger whenever either event occurs [5]. This can lead to the workflow running automatically on pull requests when you might only intend for it to run manually [5]. 3. Workaround for Non-Default Branches: A common technical pattern involves adding a pull_request trigger to a workflow so it can be registered and tested on non-default branches, while using conditional logic (if: github.event_name == 'workflow_dispatch') within the jobs to ensure that expensive or sensitive steps only execute when manually triggered [6]. If you require pull request data inside a workflow_dispatch trigger, you must either trigger the workflow via the API with the necessary PR information passed as inputs, or rely on other methods to fetch the context dynamically during execution [7][6].

Citations:


Provide AAP ref and URI inputs for manual runs.

workflow_dispatch does not populate github.event.pull_request, so manual runs will resolve the AAP ref and repository URI to empty unless the workflow supplies dispatch inputs or conditional defaults.

🧰 Tools
🪛 zizmor (1.28.0)

[warning] 4-7: insufficient job-level concurrency limits (concurrency-limits): workflow is missing concurrency setting

(concurrency-limits)

🤖 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/e2e-test.yml around lines 4 - 7, Update the
workflow_dispatch configuration and the AAP ref/repository URI references in
this workflow so manual runs receive explicit inputs or conditional fallback
values when github.event.pull_request is unavailable. Preserve the existing
pull_request behavior and ensure both values resolve correctly for either
trigger.

Comment on lines +12 to +14
permissions:
contents: read
packages: write

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 | 🏗️ Heavy lift

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== files =="
git ls-files '.github/workflows/*' || true

echo "== e2e workflow excerpt =="
if [ -f .github/workflows/e2e-test.yml ]; then
  nl -ba .github/workflows/e2e-test.yml | sed -n '1,140p'
fi

echo "== pull_request_target / checkout occurrences =="
rg -n "pull_request_target|pull_request|checkout|GITHUB_TOKEN|GITHUB_TOKEN|packages: write|podman push|docker push|cosign|sigstore" .github/workflows || true

Repository: osac-project/osac-aap

Length of output: 1931


🌐 Web query:

GitHub Actions pull_request fork GITHUB_TOKEN permissions downgrade read-only packages write

💡 Result:

When a GitHub Actions workflow is triggered by a pull request from a public fork, the GITHUB_TOKEN is automatically restricted to read-only permissions by the GitHub platform [1][2]. This security measure is enforced regardless of the permissions defined in your workflow file [1][2]. Key details regarding this behavior: 1. Automatic Restriction: GitHub intentionally enforces a read-only token for workflows triggered by fork pull requests to prevent unauthorized actions (such as pushing malicious code or publishing rogue packages) using the repository's secrets or identity [1][2]. 2. Scope of Restriction: This automatic read-only adjustment applies to all pull request-related events (such as pull_request and pull_request_review) that originate from forked repositories [3]. 3. pull_request_target Exception: The pull_request_target event is an exception to this rule because it executes the workflow context of the base repository's default branch, which is considered trusted [4][5]. Because it runs trusted code, it is capable of having write permissions [4]. However, this event should be used with caution, as it can inadvertently expose secrets to potentially malicious PR content if the workflow is not carefully designed [4][6]. 4. Repository Settings: While organizations and repositories have settings that allow administrators to "Send write tokens to workflows from pull requests," enabling this on public repositories for fork PRs is generally discouraged due to the security risks involved [5][3]. If your workflow requires write access (e.g., to publish packages), you should structure it to run on events other than pull requests from forks—such as the push event or a merge event—where the workflow runs in the context of the main repository and can maintain higher permissions [2]. For tasks that must occur during a PR review, consider alternative authentication methods like using GitHub App installation access tokens or personal access tokens stored as secrets, though these must be managed carefully to avoid security vulnerabilities [7][8].

Citations:


Use a trusted publish path with writable package access.

packages: write is read-only from fork-origin pull_request events, so this workflow cannot push the image from forked PRs. Route publication to a trusted workflow/event flow instead of pull_request_target.

🧰 Tools
🪛 zizmor (1.28.0)

[warning] 14-14: permissions without explanatory comments (undocumented-permissions): needs an explanatory comment

(undocumented-permissions)

🤖 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/e2e-test.yml around lines 12 - 14, Update the workflow’s
image publication flow to use a trusted event or workflow path rather than
pull_request_target, while retaining packages: write for publishing access.
Ensure fork-origin pull requests can trigger the required trusted publication
flow without granting them direct write access.

Source: Path instructions

Comment on lines +18 to +19
- name: Checkout
uses: actions/checkout@v6

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 -euo pipefail

echo "== workflow outline =="
git ls-files '.github/workflows/e2e-test.yml' || true
if [ -f .github/workflows/e2e-test.yml ]; then
  wc -l .github/workflows/e2e-test.yml
  cat -n .github/workflows/e2e-test.yml
fi

echo "== checkout usages in workflows =="
rg -n "actions/checkout|persist-credentials|permissions:" .github/workflows || true

echo "== git diff stat/name =="
git diff --stat || true
git diff -- .github/workflows/e2e-test.yml | sed -n '1,220p' || true

Repository: osac-project/osac-aap

Length of output: 1931


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== current pwd and repo presence =="
pwd
ls -la

echo "== workflow outline =="
git ls-files '.github/workflows/e2e-test.yml' || true
if [ -f .github/workflows/e2e-test.yml ]; then
  wc -l .github/workflows/e2e-test.yml
  cat -n .github/workflows/e2e-test.yml
fi

echo "== checkout usages in workflows =="
rg -n "actions/checkout|persist-credentials|permissions:" .github/workflows || true

echo "== git diff stat/name =="
git diff --stat || true
git diff -- .github/workflows/e2e-test.yml | sed -n '1,220p' || true

echo "== safe yaml parse if python available =="
python3 - <<'PY'
from pathlib import Path
p=Path(".github/workflows/e2e-test.yml")
print("exists", p.exists(), "size", p.stat().st_size if p.exists() else None)
PY

Repository: osac-project/osac-aap

Length of output: 1931


Disable checkout credential persistence.

This workflow checkouts the PR head before running later steps; set persist-credentials: false on actions/checkout so the repository token is not left in the local Git config for PR-controlled tooling to access.

🧰 Tools
🪛 zizmor (1.28.0)

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

(artipacked)


[error] 19-19: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)

(unpinned-uses)

🤖 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/e2e-test.yml around lines 18 - 19, Update the
actions/checkout step named Checkout to set persist-credentials to false,
ensuring the repository token is not retained in local Git configuration for
subsequent PR-controlled steps.

Source: Linters/SAST tools

image: ${{ steps.meta.outputs.image }}
steps:
- name: Checkout
uses: actions/checkout@v6

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 -euo pipefail

echo "== workflow excerpt =="
cat -n .github/workflows/e2e-test.yml | sed -n '1,80p'

echo
echo "== action refs in workflows =="
rg -n 'uses:\s*[^#]+' .github/workflows || true

echo
echo "== git status / diff stat =="
git status --short
git diff --stat || true

Repository: osac-project/osac-aap

Length of output: 1931


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== workflow file =="
cat -n .github/workflows/e2e-test.yml | sed -n '1,90p'

echo
echo "== action refs in workflows =="
rg -n 'uses:\s*[^#]+' .github/workflows || true

echo
echo "== resolve GitHub refs to dereferenced SHAs =="
python3 - <<'PY'
import json, sys, urllib.request, urllib.error

refs = [
    ("actions/checkout", "v6"),
    ("actions/cache", "v4"),
    ("actions/upload-artifact", "v4"),
    ("osac-test-infra/e2e-prepare", "main"),
]
for owner, tag in refs:
    url = f"https://api.github.com/repos/{owner}/git/refs/tags/{tag}"
    req = urllib.request.Request(url, headers={"User-Agent": "code-rabbit-verifier"})
    try:
        with urllib.request.urlopen(req, timeout=15) as r:
            data = json.load(r)
    except urllib.error.HTTPError as e:
        print(f"{owner}@{tag}: HTTP {e.code}")
        continue
    obj = data.get("object") or {}
    print(f"{owner}@{tag}: object={obj}")
PY

Repository: osac-project/osac-aap

Length of output: 1931


Pin workflow actions to full commit SHAs.

Replace the mutable references with 40-character SHAs, including the GitHub actions refs and osac-test-infra/e2e-prepare@main, so the workflow cannot drift with tag/branch movement. Also applies to lines 28, 31, and 54.

🧰 Tools
🪛 zizmor (1.28.0)

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

(artipacked)


[error] 19-19: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)

(unpinned-uses)

🤖 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/e2e-test.yml at line 19, Update all workflow action
references in the e2e test workflow, including actions/checkout and
osac-test-infra/e2e-prepare, to immutable 40-character commit SHAs instead of
tags or branches. Apply this consistently to the action references at the
indicated locations while preserving their existing inputs and behavior.

Sources: Path instructions, Linters/SAST tools

Comment on lines +42 to +50
- name: Build execution environment
run: |
uv tool run ansible-builder build -vvv \
--container-runtime podman \
--tag "${{ steps.meta.outputs.image }}" \
-f "./execution-environment/execution-environment.yaml"

- name: Push PR image
run: podman push "${{ steps.meta.outputs.image }}"

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 | 🏗️ Heavy lift

Add SAST/SCA gates before publishing.

This workflow installs PR dependencies, builds an execution environment, and pushes it without any SAST or SCA step. Add or require the repository’s existing static-analysis, dependency, and image-scanning checks before the push.

As per path instructions: SAST/SCA steps in pipeline.

🧰 Tools
🪛 zizmor (1.28.0)

[info] 46-46: code injection via template expansion (template-injection): may expand into attacker-controllable code

(template-injection)


[info] 50-50: code injection via template expansion (template-injection): may expand into attacker-controllable code

(template-injection)

🤖 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/e2e-test.yml around lines 42 - 50, Add the repository’s
existing SAST, dependency/SCA, and container-image scanning checks between the
“Build execution environment” step and the “Push PR image” step in the workflow.
Ensure the push is gated on all scans completing successfully, reusing
established pipeline checks and image reference symbols such as
steps.meta.outputs.image.

Source: Path instructions

Comment on lines +49 to +50
- name: Push PR image
run: podman push "${{ steps.meta.outputs.image }}"

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 | 🏗️ Heavy lift

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "## Locate workflow files"
git ls-files .github/workflows || true

echo
echo "## e2e-test.yml outline and relevant lines"
if [ -f .github/workflows/e2e-test.yml ]; then
  wc -l .github/workflows/e2e-test.yml
  nl -ba .github/workflows/e2e-test.yml | sed -n '1,140p'
fi

echo
echo "## Search for cosign/keyless/signing/id-token in workflows"
rg -n "cosign|sigstore|sign|id-token|prerequisites|verify|required-checks|push|e2e" .github/workflows || true

Repository: osac-project/osac-aap

Length of output: 1931


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "## Locate workflow files"
git ls-files .github/workflows || true

echo
echo "## e2e-test.yml relevant lines"
if [ -f .github/workflows/e2e-test.yml ]; then
  wc -l .github/workflows/e2e-test.yml
  nl -ba .github/workflows/e2e-test.yml | sed -n '1,140p'
fi

echo
echo "## Search for signing, token grants, and artifact/dependency verification"
rg -n "cosign|sigstore|sign|verify|id-token|permissions:|pull_request_target|needs:|uses: actions/checkout|podman push|dependencies|dependency|SCA|SAST|artifacts|att" .github/workflows || true

Repository: osac-project/osac-aap

Length of output: 1931


Sign the pushed image before E2E consumes it.

.github/workflows/e2e-test.yml pushes the PR image without a Sigstore/cosign signature. Add a signing job that signs by digest with keyless cosign, grant id-token: write only to that job, and have the E2E workflow verify the signature before using the image.

🧰 Tools
🪛 zizmor (1.28.0)

[info] 50-50: code injection via template expansion (template-injection): may expand into attacker-controllable code

(template-injection)

🤖 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/e2e-test.yml around lines 49 - 50, Add a dedicated
image-signing job after the PR image push that signs the pushed image by digest
using keyless cosign and requests only the id-token: write permission. Update
the E2E workflow’s image-consumption step to verify that signature before
running tests, preserving the existing image reference and push flow.

Source: Path instructions

Comment on lines +52 to +54
e2e:
needs: build-pr-image
uses: osac-project/osac-test-infra/.github/workflows/e2e.yml@main

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 -euo pipefail

echo "== candidate workflow files =="
git ls-files '.github/workflows/*' | sed -n '1,120p'

echo
echo "== target workflow relevant content =="
if [ -f .github/workflows/e2e-test.yml ]; then
  nl -ba .github/workflows/e2e-test.yml | sed -n '1,130p'
else
  echo ".github/workflows/e2e-test.yml not found"
fi

echo
echo "== reusable workflow references =="
rg -n "uses:|permissions:|GITHUB_TOKEN|github\\.token|e2e-test|e2e\\s*:" .github/workflows -S || true

echo
echo "== git diff stat/name-only for reference =="
git diff --stat HEAD~1..HEAD 2>/dev/null || git diff --stat 2>/dev/null || true
git diff -- '.github/workflows/e2e-test.yml' | sed -n '1,220p' || true

Repository: osac-project/osac-aap

Length of output: 1931


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== check gh availability =="
(type -p gh && gh --version | sed -n '1,4p') || echo "github-cli not available"

echo
echo "== inspect workflow ref sha availability using gh if available =="
if command -v gh >/dev/null 2>&1; then
  # Attempt to inspect the reusable workflow ref if API access allows.
  for ref in main; do
    echo "--- ref $ref ---"
    gh api repos/osac-project/osac-test-infra/.github/workflows/e2e.yml?ref=$ref 2>&1 | sed -n '1,60p' || echo "gh api failed"
    gh api repos/osac-project/osac-test-infra/git/ref/heads/$ref 2>&1 | sed -n '1,80p' || echo "gh api head ref failed"
  done
fi

Repository: osac-project/osac-aap

Length of output: 1931


Declare least-privilege permissions for the reusable workflow.

The e2e reusable workflow invocation omits permissions, so it receives repository-default token permissions. Add workflow-wide permissions: {} and grant only the scopes the referenced workflow needs, such as packages: read if it pulls the private image.

🧰 Tools
🪛 zizmor (1.28.0)

[warning] 52-60: overly broad permissions (excessive-permissions): default permissions used due to no permissions: block

(excessive-permissions)


[error] 54-54: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)

(unpinned-uses)

🤖 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/e2e-test.yml around lines 52 - 54, Update the e2e job
invoking the reusable workflow to explicitly set least-privilege permissions:
apply workflow-wide permissions: {} and grant only the required scope, such as
packages: read when the private image is pulled.

Source: Path instructions

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants