Skip to content
Merged
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
11 changes: 9 additions & 2 deletions .github/workflows/claude-wif-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
run: |
git clone --depth 1 https://github.com/openshift-eng/ai-helpers.git /tmp/ai-helpers
mkdir -p "$HOME/.claude/plugins"
printf '%s\n' '{"enabledPlugins":{"hello-world@ai-helpers":true,"jira@ai-helpers":true,"ci@ai-helpers":true}}' > "$HOME/.claude/settings.json"
printf '%s\n' '{"enabledPlugins":{"hello-world@ai-helpers":true,"ai-sbom@ai-helpers":true,"jira@ai-helpers":true,"ci@ai-helpers":true}}' > "$HOME/.claude/settings.json"
printf '%s\n' '{"ai-helpers":{"source":{"source":"directory","path":"/tmp/ai-helpers"},"installLocation":"/tmp/ai-helpers","lastUpdated":"2025-10-27T12:00:00.000Z"}}' > "$HOME/.claude/plugins/known_marketplaces.json"
Comment on lines +56 to +59

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Pin ai-helpers to an immutable commit.

Line 56 clones the marketplace from the moving default branch, so this trusted workflow can start executing new plugin code without any change in this repo. Please pin the checkout to a specific commit SHA and update it deliberately.

Suggested hardening
-          git clone --depth 1 https://github.com/openshift-eng/ai-helpers.git /tmp/ai-helpers
+          AI_HELPERS_SHA="<pinned-commit-sha>"
+          git clone https://github.com/openshift-eng/ai-helpers.git /tmp/ai-helpers
+          git -C /tmp/ai-helpers checkout --detach "$AI_HELPERS_SHA"
🤖 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/claude-wif-test.yaml around lines 56 - 59, The workflow
currently clones the moving default branch with git clone (git clone ...
ai-helpers -> /tmp/ai-helpers), which allows unreviewed plugin changes to be
pulled; update the checkout to pin to an immutable commit SHA by checking out a
specific commit in /tmp/ai-helpers immediately after clone (or using a shallow
clone of that SHA) so the marketplace code used for
"$HOME/.claude/plugins/known_marketplaces.json" and
"$HOME/.claude/settings.json" is fixed; ensure the commit SHA is represented as
a variable or literal in the workflow and document/update it deliberately when
you want to change versions.


- name: Test Claude Code
Expand All @@ -65,4 +65,11 @@ jobs:
ANTHROPIC_VERTEX_PROJECT_ID: hosted-control-planes
run: |
claude --version
claude -p "/hello-world:echo HyperShift" --max-turns 1
claude -p "Generate an AI SBOM for this session." --model claude-opus-4-6 --max-turns 1 | tee /tmp/claude-output.txt
if grep -qi "ai-assisted\|ai.sbom\|sbom" /tmp/claude-output.txt; then

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Tighten the success check to a plugin-only marker.

Including bare sbom in Line 69 makes this pass on normal model output, so the workflow no longer proves ai-sbom loaded. Match only the distinctive plugin marker you called out in the PR, such as the ai-assisted block.

Suggested fix
-          if grep -qi "ai-assisted\|ai.sbom\|sbom" /tmp/claude-output.txt; then
+          if grep -qi "ai-assisted" /tmp/claude-output.txt; then
📝 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
if grep -qi "ai-assisted\|ai.sbom\|sbom" /tmp/claude-output.txt; then
if grep -qi "ai-assisted" /tmp/claude-output.txt; then
🤖 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/claude-wif-test.yaml at line 69, The current grep check
uses a broad "sbom" token which can match normal model output; update the grep
pattern in the if that scans /tmp/claude-output.txt to only match the
plugin-specific marker(s) you asserted (e.g., "ai-assisted" or the exact plugin
tag "ai-sbom"/"ai.sbom") so the workflow only succeeds when the AI-SBOM plugin
block is present; locate the line containing grep -qi
"ai-assisted\|ai.sbom\|sbom" and replace the pattern to exclude the bare "sbom"
token, keeping only the distinctive marker(s) like "ai-assisted" (and optionally
"ai-sbom" or "ai.sbom") to tighten the success check.

echo "Plugin verified: ai-sbom plugin executed successfully"
else
echo "ERROR: ai-sbom plugin output not detected"
cat /tmp/claude-output.txt
exit 1
Comment on lines +68 to +74

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical | 🏗️ Heavy lift

Don't run Claude on PR-head contents with WIF creds in scope.

On issue_comment, this job checks out the PR head and then invokes Claude after GCP WIF auth. That lets a fork PR feed attacker-controlled repository files into an agentic tool while cloud credentials are available, and tee/cat will echo any induced exfiltration into the workflow logs. For this smoke test, use a trusted fixture/default-branch checkout instead, or at minimum remove cloud auth and avoid logging raw model output before invoking Claude.

As per coding guidelines, "No secrets in logs; mask sensitive outputs" and "Agentic CI actions: audit for prompt injection via issue/PR title/body flowing into LLM prompts".

🤖 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/claude-wif-test.yaml around lines 68 - 74, The workflow
currently checks out PR-head contents and runs the Claude invocation (the
`claude -p ...` call) after GCP WIF auth, writing raw model output to
/tmp/claude-output.txt and echoing it with tee/cat — replace that with a trusted
fixture or default-branch checkout instead of the PR head, remove or revoke GCP
WIF auth credentials before calling `claude -p`, and stop piping raw model
output to stdout; write output only to a local file (e.g.,
/tmp/claude-output.txt) and use grep -qi on that file, emitting only safe
success/failure messages (no cat/tee of the full file) or redact sensitive lines
if you must print content. Ensure the changes reference the existing `claude -p
"Generate an AI SBOM for this session." --model claude-opus-4-6 --max-turns 1`,
`/tmp/claude-output.txt`, and any checkout step so reviewers can locate and
update the workflow.

fi
Loading