Skip to content

Remove e2e-vault-secrets.yml and point caller to e2e.yml - #74

Merged
eliorerz merged 1 commit into
osac-project:mainfrom
eliorerz:fix-e2e-permissions
Jun 22, 2026
Merged

eliorerz merged 1 commit into
osac-project:mainfrom
eliorerz:fix-e2e-permissions

Conversation

@eliorerz

@eliorerz eliorerz commented Jun 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

@openshift-ci

openshift-ci Bot commented Jun 18, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: eliorerz

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

The pull request process is described 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 commented Jun 18, 2026 •

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Vault authentication in the E2E test infrastructure is switched from GitHub OIDC/JWT to Vault AppRole. vault-setup.sh phase 8 now enables the approle/ auth mount (conditionally if not already present) and phase 9 creates the auth/approle/role/osac-e2e role, persisting role-id and secret-id to disk with restrictive permissions (700 for directory, 600 for files). vault-health-check.sh replaces JWT mount and role checks with AppRole equivalents. The E2E workflow removes the test-image input, adds cluster-template and flavor selection inputs, removes id-token: write permission, adds local image build via podman, loads AppRole credentials from disk with secret masking, authenticates to Vault via hashicorp/vault-action using method: approle, runs pytest from the built image with mounted kubeconfig and secrets, and cleans up with podman rmi and cluster clone destruction. Workflow and job-level contents: read permissions are added.

Changes

JWT to AppRole migration

Layer / File(s) Summary
Vault AppRole provisioning and documentation
vault/scripts/vault-setup.sh
Phase 8 conditionally enables auth/approle mount; phase 9 creates auth/approle/role/osac-e2e with policy attachment, TTL, and usage constraints. Role-id and secret-id are read/generated and persisted to ${VAULT_HOME}/.approle/ with restrictive permissions (directory 700, files 600).
Vault AppRole health validation
vault/scripts/vault-health-check.sh
Health check 5 verifies approle/ auth mount is present; health check 6 confirms auth/approle/role/osac-e2e role exists, replacing prior JWT mount and role checks.
E2E workflow permissions and inputs
.github/workflows/e2e-vault-secrets.yml, .github/workflows/e2e-test.yml
Removes test-image input and adds cluster-template, flavor-image, flavor-name inputs. Permissions updated to keep only contents: read (removes id-token: write). Workflow and job-level permissions added to e2e-test.yml.
E2E job setup, image build, and OSAC deployment
.github/workflows/e2e-vault-secrets.yml
Adds repo checkout, reads and masks AppRole credentials from ${HOME}/.vault-server/.approle/, authenticates via hashicorp/vault-action with method: approle. Configures/pulls cluster flavor with shared lock, boots cluster clone, builds run-specific E2E_IMAGE via podman build, waits for KubeVirt Available status, and deploys OSAC.
E2E test execution and cleanup
.github/workflows/e2e-vault-secrets.yml
Runs pytest inside E2E_IMAGE using podman run with read-only mounts for clone-specific kubeconfig and secret files. Cleanup always destroys cluster clone, removes temporary secret files, kubeconfig, installer artifacts, and locally built image via podman rmi.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • osac-project/osac-test-infra#72: Originally introduced the local Vault E2E infrastructure with JWT-based auth in the same vault-setup.sh and vault-health-check.sh files that this PR migrates to AppRole.

Suggested labels

lgtm

Suggested reviewers

  • eranco74
  • jhernand

Poem

🔐 JWT had its day, now AppRole takes the stage,
A role-id and secret-id locked on disk, sage,
podman build conjures the image with care,
Kubeconfig checked before tests dare,
chmod 600 keeps the secrets in their cage! 🏗️


Caution

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

  • Ignore

❌ Failed checks (2 errors, 1 warning)

Check name Status Explanation Resolution
No-Injection-Vectors ❌ Error Shell injection vulnerability in e2e-vault-secrets.yml: TEST_SUITE and TEST_FILTER (user inputs) are unquoted in the pytest command at line 267 (pytest ${TEST_ARGS} ${FILTER_ARGS}), allowing arbitr... Quote the unquoted variables: pytest "${TEST_ARGS}" "${FILTER_ARGS}" --junitxml=/tmp/junit.xml -v
No-Sensitive-Data-In-Logs ❌ Error AppRole secret-id exposed in logs: line 69 of e2e-vault-secrets.yml echoes the secret value before GitHub masking registers it, per GitHub's timing semantics. Store secret-id in variable without output, call ::add-mask:: on variable separately, then append to GITHUB_OUTPUT to avoid exposing secret during echo.
Title check ⚠️ Warning The PR title describes removing e2e-vault-secrets.yml and pointing callers to e2e.yml, but the actual changeset significantly refactors and enhances e2e-vault-secrets.yml with AppRole auth, cluster provisioning, and parallel execution support rather than removing it. Revise the title to accurately reflect the primary change: something like 'Switch Vault auth to AppRole and integrate cluster-tool for isolated test environments' would better capture the substantial enhancements made.
✅ Passed checks (8 passed)
Check name Status Explanation
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. All credentials (AppRole role-id/secret-id, Vault secrets) are read from files or retrieved via vault-action. Secret-id is properly masked with ::add-mask::. All other r...
No-Weak-Crypto ✅ Passed No weak cryptography detected: no MD5/SHA1/DES/RC4/3DES/Blowfish/ECB, no custom crypto implementations, no timing-attack-vulnerable secret comparisons. All operations use industry-standard Vault Ap...
Container-Privileges ✅ Passed No privileged container settings found. The PR contains no Kubernetes manifests. Containers run with appropriate defaults: test image as root (acceptable in isolated CI), Vault container without pr...
Ai-Attribution ✅ Passed No AI tools mentioned in PR description or commits, so attribution requirement does not apply. Commit by Elior Erez has no AI tool usage declarations or improper Co-Authored-By entries for AI.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing Touches
🧪 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 and usage tips.

@eliorerz
eliorerz force-pushed the fix-e2e-permissions branch from 982caa1 to 1361e87 Compare June 18, 2026 20:26
@eliorerz eliorerz changed the title Fix e2e caller workflow: add id-token permissions Switch Vault auth from JWT/OIDC to AppRole Jun 18, 2026
@eliorerz
eliorerz force-pushed the fix-e2e-permissions branch from 1361e87 to f65014a Compare June 18, 2026 20:38
@eliorerz
eliorerz force-pushed the fix-e2e-permissions branch from f65014a to 1e5cad2 Compare June 18, 2026 20:41
@eliorerz
eliorerz force-pushed the fix-e2e-permissions branch from 1e5cad2 to 9a5555f Compare June 18, 2026 20:51

@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: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/workflows/e2e-vault-secrets.yml (1)

102-119: 🧹 Nitpick | 🔵 Trivial | 💤 Low value

Quote FILTER_ARGS to handle special characters safely.

If TEST_FILTER contains spaces or shell metacharacters, the unquoted expansion could cause unexpected behavior. While pytest's -k typically uses simple patterns, quoting is safer.

Proposed fix
-           pytest ${TEST_ARGS} ${FILTER_ARGS} \
+           pytest ${TEST_ARGS} "${FILTER_ARGS}" \
🤖 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-vault-secrets.yml around lines 102 - 119, The
FILTER_ARGS variable is passed unquoted to the pytest command in the podman run
container, which could cause issues if TEST_FILTER contains spaces or special
characters. Quote the FILTER_ARGS variable expansion in the pytest invocation to
ensure it is safely passed as a single argument, even when it contains special
characters or whitespace. Change the pytest command line where FILTER_ARGS is
used to wrap it with double quotes like "${FILTER_ARGS}".
🤖 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-vault-secrets.yml:
- Around line 42-43: The actions/checkout action in the Checkout repository step
is pinned to a version tag (v4) instead of a full commit SHA, which violates
security guidelines. Replace the `@v4` reference with the full commit SHA for
the corresponding version of actions/checkout. Additionally, add a `with`
section to the step that sets `persist-credentials: false` to prevent Git
credentials from being stored and reduce the attack surface after checkout
completes.

In `@vault/scripts/vault-setup.sh`:
- Around line 191-196: The vault write command configuring the osac-e2e role
with secret_id_ttl="0" means the secret ID never expires, creating a persistent
security risk if compromised. Add a comment above or inline with the vault write
auth/approle/role/osac-e2e command block that explains this setting is
intentional for persistent runner credentials and documents the security
trade-off of indefinite secret ID validity, clarifying why the non-expiring
credential is necessary despite the associated risk.

---

Outside diff comments:
In @.github/workflows/e2e-vault-secrets.yml:
- Around line 102-119: The FILTER_ARGS variable is passed unquoted to the pytest
command in the podman run container, which could cause issues if TEST_FILTER
contains spaces or special characters. Quote the FILTER_ARGS variable expansion
in the pytest invocation to ensure it is safely passed as a single argument,
even when it contains special characters or whitespace. Change the pytest
command line where FILTER_ARGS is used to wrap it with double quotes like
"${FILTER_ARGS}".
🪄 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: Enterprise

Run ID: ee8beb14-0f03-4298-9828-f6258f358d43

📥 Commits

Reviewing files that changed from the base of the PR and between 3950e95 and 9a5555f.

📒 Files selected for processing (4)
  • .github/workflows/e2e-test.yml
  • .github/workflows/e2e-vault-secrets.yml
  • vault/scripts/vault-health-check.sh
  • vault/scripts/vault-setup.sh

Comment thread .github/workflows/e2e-vault-secrets.yml Outdated
Comment thread vault/scripts/vault-setup.sh Outdated
Comment on lines +191 to +196
vault write auth/approle/role/osac-e2e \
token_policies="osac-e2e" \
token_ttl="10m" \
token_max_ttl="30m" \
secret_id_ttl="0" \
token_num_uses=0

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial | 💤 Low value

secret_id_ttl="0" means the secret_id never expires.

This is presumably intentional for a persistent runner credential, but it does mean a compromised secret_id remains valid indefinitely. Consider documenting this trade-off or implementing periodic rotation.

🤖 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 `@vault/scripts/vault-setup.sh` around lines 191 - 196, The vault write command
configuring the osac-e2e role with secret_id_ttl="0" means the secret ID never
expires, creating a persistent security risk if compromised. Add a comment above
or inline with the vault write auth/approle/role/osac-e2e command block that
explains this setting is intentional for persistent runner credentials and
documents the security trade-off of indefinite secret ID validity, clarifying
why the non-expiring credential is necessary despite the associated risk.

@eliorerz
eliorerz force-pushed the fix-e2e-permissions branch from 9a5555f to 801d792 Compare June 18, 2026 21:05
@eliorerz eliorerz changed the title Switch Vault auth from JWT/OIDC to AppRole [WIP] Switch Vault auth from JWT/OIDC to AppRole Jun 18, 2026
@eliorerz
eliorerz force-pushed the fix-e2e-permissions branch from 801d792 to 63b7f45 Compare June 18, 2026 22:51

@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: 2

🤖 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-vault-secrets.yml:
- Around line 155-158: After setting the KUBECONFIG_PATH variable using the
CLONE_NAME, add a guard condition to verify that the kubeconfig file actually
exists at the specified path before proceeding with the test execution. If the
file does not exist, the workflow should exit with an appropriate error message.
This will prevent confusing mount errors during the podman run command and
provide clear feedback if the kubeconfig path is incorrect or the boot step
fails silently.

In `@vault/scripts/vault-setup.sh`:
- Around line 205-211: The credential setup in vault-setup.sh lacks atomicity
between the role-id and secret-id operations. If the vault read command for
role-id succeeds but the vault write command for secret-id fails, the state
becomes inconsistent with only a role-id file present. Add error handling after
each vault command to check for failures and exit if either operation fails, or
alternatively write both credentials to temporary files first, verify both
succeeded, then atomically move them to the APPROLE_DIR. This ensures the
directory either has both credentials or neither, preventing partial failures.
🪄 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: Enterprise

Run ID: a0d94250-50b3-47c8-8f8d-3b284c25c2db

📥 Commits

Reviewing files that changed from the base of the PR and between 9a5555f and 63b7f45.

📒 Files selected for processing (4)
  • .github/workflows/e2e-test.yml
  • .github/workflows/e2e-vault-secrets.yml
  • vault/scripts/vault-health-check.sh
  • vault/scripts/vault-setup.sh

Comment thread .github/workflows/e2e-vault-secrets.yml
Comment thread vault/scripts/vault-setup.sh Outdated
Comment on lines +205 to +211
vault read -format=json auth/approle/role/osac-e2e/role-id \
| jq -r '.data.role_id' > "${APPROLE_DIR}/role-id"
chmod 600 "${APPROLE_DIR}/role-id"

vault write -format=json -f auth/approle/role/osac-e2e/secret-id \
| jq -r '.data.secret_id' > "${APPROLE_DIR}/secret-id"
chmod 600 "${APPROLE_DIR}/secret-id"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Credential storage lacks atomicity - partial failure leaves inconsistent state.

If vault read ... role-id succeeds but vault write ... secret-id fails, you'll have a role-id file but no secret-id, causing downstream auth failures. Consider writing to temp files first, then moving atomically, or adding error handling.

Proposed fix with error handling
-vault read -format=json auth/approle/role/osac-e2e/role-id \
-    | jq -r '.data.role_id' > "${APPROLE_DIR}/role-id"
-chmod 600 "${APPROLE_DIR}/role-id"
-
-vault write -format=json -f auth/approle/role/osac-e2e/secret-id \
-    | jq -r '.data.secret_id' > "${APPROLE_DIR}/secret-id"
-chmod 600 "${APPROLE_DIR}/secret-id"
+ROLE_ID=$(vault read -format=json auth/approle/role/osac-e2e/role-id | jq -r '.data.role_id')
+SECRET_ID=$(vault write -format=json -f auth/approle/role/osac-e2e/secret-id | jq -r '.data.secret_id')
+
+printf '%s' "${ROLE_ID}" > "${APPROLE_DIR}/role-id"
+chmod 600 "${APPROLE_DIR}/role-id"
+
+printf '%s' "${SECRET_ID}" > "${APPROLE_DIR}/secret-id"
+chmod 600 "${APPROLE_DIR}/secret-id"
🤖 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 `@vault/scripts/vault-setup.sh` around lines 205 - 211, The credential setup in
vault-setup.sh lacks atomicity between the role-id and secret-id operations. If
the vault read command for role-id succeeds but the vault write command for
secret-id fails, the state becomes inconsistent with only a role-id file
present. Add error handling after each vault command to check for failures and
exit if either operation fails, or alternatively write both credentials to
temporary files first, verify both succeeded, then atomically move them to the
APPROLE_DIR. This ensures the directory either has both credentials or neither,
preventing partial failures.

@eliorerz
eliorerz force-pushed the fix-e2e-permissions branch from 63b7f45 to e4cf341 Compare June 18, 2026 23:10
@eliorerz eliorerz changed the title [WIP] Switch Vault auth from JWT/OIDC to AppRole E2E workflow: AppRole auth, cluster-tool integration, parallel job support Jun 18, 2026
@omer-vishlitzky

Copy link
Copy Markdown
Contributor

/retest

The reusable workflow was added as e2e.yml in PR osac-project#76. Delete the
old e2e-vault-secrets.yml and update e2e-test.yml to reference it.
@eliorerz
eliorerz force-pushed the fix-e2e-permissions branch from 1087fba to afae15d Compare June 21, 2026 17:06
@eliorerz eliorerz changed the title E2E workflow: AppRole auth, cluster-tool integration, parallel job support Remove e2e-vault-secrets.yml and point caller to e2e.yml Jun 21, 2026
@eliorerz eliorerz added the lgtm label Jun 22, 2026
@eliorerz
eliorerz merged commit f1a3cdb into osac-project:main Jun 22, 2026
5 of 6 checks passed

This branch was previously deployed

1 inactive deployment
e2e-test — afae15d2 Deployed Jun 21, 2026 by eliorerz via e2e-vmaas / e2e #46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants