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

OSAC-2186: Pin configAsCode.eeImage/projectGitBranch at release - #412

Merged
openshift-merge-bot[bot] merged 1 commit into
osac-project:mainfrom
minmzzhang:OSAC-2186-pin-configascode-release
Jul 27, 2026
Merged

openshift-merge-bot[bot] merged 1 commit into
osac-project:mainfrom
minmzzhang:OSAC-2186-pin-configascode-release

Conversation

@minmzzhang

@minmzzhang minmzzhang commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Summary

  • charts/aap/values.yaml declares configAsCode.eeImage and configAsCode.projectGitBranch as empty-string placeholders. bootstrap.image is patched to the exact release version by publish-charts.yaml before packaging, but these two fields were never touched by the release workflow.
  • Because Helm's {{- with }} treats an empty string as falsy, the chart template omits AAP_EE_IMAGE/AAP_PROJECT_GIT_BRANCH from the generated Secret whenever these are unset, and the Ansible config-as-code layer (playbooks/vars/config.yml) then falls back to ghcr.io/osac-project/osac-aap:latest / main. A released chart deployed with default values therefore silently runs an unpinned execution-environment image and syncs automation content from main instead of the tested release.
  • Added two sed substitutions alongside the existing bootstrap.image patch so both fields default to the release version/tag, consistent with how bootstrap.image is already handled. The committed values.yaml placeholders are intentionally left unchanged — only the release-time patch step is extended.

Hardening added in response to CodeRabbit review

  • Tag injection (Critical/Security): steps.version.outputs.version (derived from the pushed tag's GITHUB_REF_NAME) was interpolated directly via ${{ }} template expansion into the shell script. GitHub Actions substitutes ${{ }} as raw text before bash parses it, so a maliciously crafted tag name could break out of the sed argument and run arbitrary commands in this privileged release job (contents: write, packages: write). Fixed by passing the version through env: and validating it against ^[0-9A-Za-z._-]+$ before use, applied to all three substitutions (including the pre-existing bootstrap.image line).
  • Fail closed on a missing placeholder (Data Integrity): sed exits 0 even when it matches zero lines, so a future values.yaml format change could silently leave a placeholder unpinned with no error. Added a replace_and_verify check after each substitution that fails the workflow if the expected replacement isn't found.

Verified locally (not just by inspection):

  • The substitutions produce valid YAML and leave the unrelated projectGitUri field untouched.
  • A crafted malicious tag value is rejected by the validation regex before reaching sed.
  • A simulated missing/altered placeholder now aborts the workflow with a clear error instead of silently succeeding.

Test plan

  • Push a v* tag (or dry-run the workflow) and confirm the packaged chart's values.yaml has eeImage and projectGitBranch pinned to the release version/tag rather than empty strings.
  • Confirm bootstrap.image patch behavior is unchanged.
  • Confirmed locally that a crafted tag value (e.g. containing ; touch /tmp/PWNED) is rejected by the version validation instead of executing.
  • Confirmed locally that a missing/altered placeholder now fails the step instead of silently proceeding.

Fixes OSAC-2186.

Summary by CodeRabbit

  • Chores
    • Improved chart publishing reliability by deriving the release version from the workflow output and validating it against an allowed format.
    • Updated chart values in a coordinated way (image, execution environment image, and project branch) to keep them consistent.
    • Added post-update verification; publishing now fails with a clear error if the expected changes are not found.

@openshift-ci-robot

openshift-ci-robot commented Jul 10, 2026

Copy link
Copy Markdown

@minmzzhang: This pull request references OSAC-2186 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 bug to target the "5.0.0" version, but no target version was set.

Details

In response to this:

Summary

  • charts/aap/values.yaml declares configAsCode.eeImage and configAsCode.projectGitBranch as empty-string placeholders. bootstrap.image is patched to the exact release version by publish-charts.yaml before packaging, but these two fields were never touched by the release workflow.
  • Because Helm's {{- with }} treats an empty string as falsy, the chart template omits AAP_EE_IMAGE/AAP_PROJECT_GIT_BRANCH from the generated Secret whenever these are unset, and the Ansible config-as-code layer (playbooks/vars/config.yml) then falls back to ghcr.io/osac-project/osac-aap:latest / main. A released chart deployed with default values therefore silently runs an unpinned execution-environment image and syncs automation content from main instead of the tested release.
  • Added two sed substitutions alongside the existing bootstrap.image patch so both fields default to the release version/tag, consistent with how bootstrap.image is already handled. The committed values.yaml placeholders are intentionally left unchanged — only the release-time patch step is extended.

Verified locally that the substitutions produce valid YAML and leave the unrelated projectGitUri field untouched.

Test plan

  • Push a v* tag (or dry-run the workflow) and confirm the packaged chart's values.yaml has eeImage and projectGitBranch pinned to the release version/tag rather than empty strings.
  • Confirm bootstrap.image patch behavior is unchanged.

Fixes OSAC-2186.

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 Jul 10, 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

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

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

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: 511adf72-3d04-4e58-a996-0829b618a34b

📥 Commits

Reviewing files that changed from the base of the PR and between e68c620 and 93cd515.

📒 Files selected for processing (1)
  • .github/workflows/publish-charts.yaml

Walkthrough

The chart publishing workflow validates the extracted tag version, then updates and verifies image, eeImage, and projectGitBranch in charts/aap/values.yaml.

Changes

Chart publishing

Layer / File(s) Summary
Validate and synchronize chart values
.github/workflows/publish-charts.yaml
Validates the extracted version format, updates image, eeImage, and projectGitBranch in charts/aap/values.yaml, and verifies each replacement.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: eliorerz, ybettan, danmanor

🚥 Pre-merge checks | ✅ 11
✅ Passed checks (11 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: pinning eeImage and projectGitBranch at release.
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 Modified workflow only adds version validation and placeholder replacement; no hardcoded secrets, tokens, passwords, private keys, base64 blobs, or credentialed URLs found.
No-Weak-Crypto ✅ Passed No MD5/SHA1/DES/RC4/3DES/Blowfish/ECB, custom crypto, or secret comparisons were added; the diff only changes tag validation and YAML substitutions.
No-Injection-Vectors ✅ Passed Validated VERSION is regex-restricted before sed, substitutions use fixed literals, and no eval/exec/unsafe loaders or user-controlled shell flags appear.
Container-Privileges ✅ Passed Only .github/workflows/publish-charts.yaml changed; no privileged, hostPID/Network/IPC, SYS_ADMIN, root, or allowPrivilegeEscalation settings were added.
No-Sensitive-Data-In-Logs ✅ Passed The PR’s new logs only report release version/tag and placeholder status; no passwords, tokens, PII, or internal hostnames are logged.
Ai-Attribution ✅ Passed PR commit includes Assisted-by: Cursor; no AI-related Co-Authored-By trailer was found.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

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

🤖 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/publish-charts.yaml:
- Around line 38-39: Prevent shell injection in the publish workflow by passing
the tag-derived version through an environment variable rather than
interpolating steps.version.outputs.version directly into shell commands.
Validate the variable against the expected release-version format before use,
then reference the validated variable in the image update on line 37 and the
eeImage and projectGitBranch updates in the sed commands.
🪄 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: 0dc70a39-dec7-4360-9105-ee5f396ea013

📥 Commits

Reviewing files that changed from the base of the PR and between c721186 and d888241.

📒 Files selected for processing (1)
  • .github/workflows/publish-charts.yaml

Comment thread .github/workflows/publish-charts.yaml Outdated

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

🤖 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/publish-charts.yaml:
- Around line 43-45: Update the chart replacement steps in the publish workflow
to fail if any expected placeholder is missing or duplicated. For each of image,
eeImage, and projectGitBranch, assert exactly one matching placeholder before
editing or verify the resulting values after editing, and terminate the workflow
on failure before packaging.
🪄 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: c30446af-ae86-44f6-9471-7c3a5319b9ab

📥 Commits

Reviewing files that changed from the base of the PR and between d888241 and 02341bc.

📒 Files selected for processing (1)
  • .github/workflows/publish-charts.yaml

Comment thread .github/workflows/publish-charts.yaml Outdated

@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.

Caution

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

⚠️ Outside diff range comments (2)
.github/workflows/publish-charts.yaml (2)

83-105: 🔒 Security & Privacy | 🟠 Major | 🏗️ Heavy lift

Add SAST/SCA before chart packaging.

This release workflow publishes the chart without a visible SAST/SCA gate. Add pinned scan steps that fail before helm package.

As per path instructions, .github/workflows/**/* requires “SAST/SCA steps in pipeline.”

🤖 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/publish-charts.yaml around lines 83 - 105, Add pinned SAST
and SCA scan steps to the publish workflow before the helm package command,
ensuring each scan fails the job on findings and runs against the
repository/chart sources as appropriate. Keep the existing version substitution
and packaging flow unchanged aside from placing the security gates before
packaging.

Source: Path instructions


83-105: 🔒 Security & Privacy | 🟠 Major | 🏗️ Heavy lift

Sign the published OCI chart with Sigstore.

The chart is packaged and pushed without a cosign signature. Sign the pushed OCI artifact with a SHA-pinned setup action and minimally scoped id-token: write permission.

As per path instructions, .github/workflows/**/* requires “Sign artifacts with Sigstore/cosign.”

🤖 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/publish-charts.yaml around lines 83 - 105, The publish
workflow must sign the pushed OCI chart with Sigstore. Add a SHA-pinned cosign
setup action, grant the workflow minimally scoped id-token: write permission,
and invoke cosign to sign the published chart reference after the chart push
step, using the existing VERSION-based artifact tag.

Source: Path instructions

🤖 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.

Outside diff comments:
In @.github/workflows/publish-charts.yaml:
- Around line 83-105: Add pinned SAST and SCA scan steps to the publish workflow
before the helm package command, ensuring each scan fails the job on findings
and runs against the repository/chart sources as appropriate. Keep the existing
version substitution and packaging flow unchanged aside from placing the
security gates before packaging.
- Around line 83-105: The publish workflow must sign the pushed OCI chart with
Sigstore. Add a SHA-pinned cosign setup action, grant the workflow minimally
scoped id-token: write permission, and invoke cosign to sign the published chart
reference after the chart push step, using the existing VERSION-based artifact
tag.

ℹ️ Review info
⚙️ Run configuration

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

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: 56db46cd-d84b-4e30-bc5e-4b04f1f746b7

📥 Commits

Reviewing files that changed from the base of the PR and between 251e520 and e68c620.

📒 Files selected for processing (1)
  • .github/workflows/publish-charts.yaml

Pin configAsCode.eeImage and configAsCode.projectGitBranch to the
release tag in publish-charts.yaml, matching the existing
bootstrap.image substitution. Pass the version through an env var
with format validation to prevent tag-injection, and verify each
sed substitution landed to fail closed on placeholder drift.

Assisted-by: Cursor <cursoragent@cursor.com>
Signed-off-by: Min Zhang <minzhang@redhat.com>
@openshift-ci

openshift-ci Bot commented Jul 27, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: eliorerz, minmzzhang

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

@openshift-merge-bot
openshift-merge-bot Bot merged commit 7ad4dff into osac-project:main Jul 27, 2026
13 of 14 checks passed
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.

3 participants