Skip to content

Add trivy vulnerability to build - #1828

Draft
kaumini wants to merge 8 commits into
wso2:mainfrom
kaumini:addTrivy
Draft

Add trivy vulnerability to build#1828
kaumini wants to merge 8 commits into
wso2:mainfrom
kaumini:addTrivy

Conversation

@kaumini

@kaumini kaumini commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Purpose

Resolves https://github.com/wso2-enterprise/integration-engineering/issues/1878

Goals

Describe the solutions that this feature/fix will introduce to resolve the problems described above

Approach

Describe how you are implementing the solutions. Include an animated GIF or screenshot if the change affects the UI (email documentation@wso2.com to review all UI text). Include a link to a Markdown file or Google doc if the feature write-up is too long to paste here.

User stories

Summary of user stories addressed by this change>

Release note

Brief description of the new feature or bug fix as it will appear in the release notes

Documentation

Link(s) to product documentation that addresses the changes of this PR. If no doc impact, enter “N/A” plus brief explanation of why there’s no doc impact

Training

Link to the PR for changes to the training content in https://github.com/wso2/WSO2-Training, if applicable

Certification

Type “Sent” when you have provided new/updated certification questions, plus four answers for each question (correct answer highlighted in bold), based on this change. Certification questions/answers should be sent to certification@wso2.com and NOT pasted in this PR. If there is no impact on certification exams, type “N/A” and explain why.

Marketing

Link to drafts of marketing content that will describe and promote this feature, including product page changes, technical articles, blog posts, videos, etc., if applicable

Automation tests

  • Unit tests

    Code coverage information

  • Integration tests

    Details about the test cases and coverage

Security checks

Samples

Provide high-level details about the samples related to this feature

Related PRs

List any other related PRs

Migrations (if applicable)

Describe migration steps and platforms on which migration has been tested

Test environment

List all JDK versions, operating systems, databases, and browser/versions on which this feature/fix was tested

Learning

Describe the research phase and any blog posts, patterns, libraries, or add-ons you used to solve the problem.

Summary by CodeRabbit

  • Chores
    • Updated several bundled libraries and build tools to newer versions.
    • Added automated vulnerability scanning in the build process.
    • Included an ignore rule for a known low-risk security finding.

@kaumini
kaumini requested a review from gigara July 6, 2026 04:52
@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

This PR adds a Trivy filesystem vulnerability scan job to the CI compile workflow along with a .trivyignore file suppressing one CVE, and updates pinned dependency versions in pnpm's global overrides and in two package.json files (webview-giga-bridge, wi-extension).

Changes

Security Scanning and Dependency Updates

Layer / File(s) Summary
Trivy CI scan job and ignore rule
.github/workflows/compile.yml, .trivyignore
Adds a trivy-scan job that runs Trivy's filesystem scan (excluding common/temp, lib/vscode, external), fails on findings, ignores unfixed CVEs, and enforces a .trivyignore rule for CVE-2026-31808.
Pinned transitive dependency overrides
common/config/rush/pnpm-config.json
Expands globalOverrides with explicit pinned versions for multiple transitive dependencies (e.g. @babel/core, axios, webpack, yaml) alongside the existing tar-fs override.
Package version bumps
wi/webview-giga-bridge/package.json, wi/wi-extension/package.json
Bumps ws to 8.21.0, webpack to 5.104.1, js-yaml to 4.2.0, yaml to 2.8.3, and axios to 1.16.0.

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

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning Only the Purpose section is filled; the rest of the required template is left as placeholders or blank. Add concrete content for Goals, Approach, User stories, Release note, Documentation, tests, Security checks, and the remaining required sections.
✅ Passed checks (4 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.
Title check ✅ Passed The title matches the main change: adding Trivy vulnerability scanning to the build.
✨ 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.

@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/compile.yml:
- Around line 119-120: The Checkout step in the workflow currently uses
actions/checkout@v4 without disabling credential persistence, which leaves the
GITHUB_TOKEN available to later steps like trivy-action. Update the checkout
configuration to set persist-credentials to false on the Checkout step so the
token is not stored on disk for the rest of the job.
- Around line 122-123: The Trivy workflow step is using a mutable tag for
aquasecurity/trivy-action instead of a pinned commit. Update the uses reference
in the Run Trivy vulnerability scanner step to the v0.35.0 commit SHA
57a97c7e7821a5776cebc9bb87c984fa69cba8f1, keeping the existing job name and step
structure unchanged.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 6e26039d-e2b5-4422-892a-5b2af78003bf

📥 Commits

Reviewing files that changed from the base of the PR and between 515f431 and 7472788.

⛔ Files ignored due to path filters (1)
  • common/config/rush/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (5)
  • .github/workflows/compile.yml
  • .trivyignore
  • common/config/rush/pnpm-config.json
  • wi/webview-giga-bridge/package.json
  • wi/wi-extension/package.json

Comment on lines +119 to +120
- name: Checkout
uses: actions/checkout@v4

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 | 🟡 Minor | ⚡ Quick win

Set persist-credentials: false on checkout.

The checkout step doesn't disable credential persistence, leaving the GITHUB_TOKEN on disk for the remainder of the job — including the third-party trivy-action step that follows. Given this exact action has previously been compromised to exfiltrate CI secrets (see the March 2026 trivy-action supply-chain incident), minimizing token exposure here is worthwhile.

🔒 Proposed fix
       - name: Checkout
         uses: actions/checkout@v4
+        with:
+          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
- name: Checkout
uses: actions/checkout@v4
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false
🧰 Tools
🪛 zizmor (1.26.1)

[warning] 119-120: 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/compile.yml around lines 119 - 120, The Checkout step in
the workflow currently uses actions/checkout@v4 without disabling credential
persistence, which leaves the GITHUB_TOKEN available to later steps like
trivy-action. Update the checkout configuration to set persist-credentials to
false on the Checkout step so the token is not stored on disk for the rest of
the job.

Source: Linters/SAST tools

Comment on lines +122 to +123
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@0.35.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.

🔒 Security & Privacy | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Inspect the workflow lines around the referenced action.
sed -n '110,130p' .github/workflows/compile.yml

# Resolve the tag and the proposed commit for aquasecurity/trivy-action v0.35.0.
if command -v gh >/dev/null 2>&1; then
  echo "--- tag ref ---"
  gh api repos/aquasecurity/trivy-action/git/refs/tags/0.35.0 --jq '{ref:.ref, type:.object.type, sha:.object.sha}'
  echo "--- tag object (if annotated) ---"
  TAG_OBJ_SHA="$(gh api repos/aquasecurity/trivy-action/git/refs/tags/0.35.0 --jq '.object.sha')"
  TAG_TYPE="$(gh api repos/aquasecurity/trivy-action/git/refs/tags/0.35.0 --jq '.object.type')"
  if [ "$TAG_TYPE" = "tag" ]; then
    gh api repos/aquasecurity/trivy-action/git/tags/"$TAG_OBJ_SHA" --jq '{tag:.tag, type:.object.type, commit:.object.sha}'
  fi
  echo "--- proposed commit existence ---"
  gh api repos/aquasecurity/trivy-action/commits/57a97c7e7821a5776cebc9bb87c984fa69cba8f1 --jq '.sha'
else
  echo "gh CLI not available; unable to query GitHub API."
fi

Repository: wso2/product-integrator

Length of output: 1321


🌐 Web query:

aquasecurity/trivy-action 0.35.0 commit SHA release notes

💡 Result:

The commit SHA for aquasecurity/trivy-action version 0.35.0 (also released as v0.35.0) is 57a97c7e7821a5776cebc9bb87c984fa69cba8f1 [1][2]. The release, published in March 2026, was issued as part of a security response to a supply chain attack that affected mutable branches (such as @master) of the repository [3][4][1]. While version 0.35.0 was released initially, the project subsequently adopted a 'v' prefix convention (v0.35.0) for future releases to enhance clarity [3][5]. The project explicitly advised users to pin their GitHub Action workflows to this specific commit SHA to ensure security and prevent the use of compromised mutable tags [1][2].

Citations:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Try to resolve the public tag/commit mapping without GitHub API auth.
git ls-remote --tags https://github.com/aquasecurity/trivy-action.git 'refs/tags/0.35.0' 'refs/tags/v0.35.0' || true
git ls-remote https://github.com/aquasecurity/trivy-action.git 57a97c7e7821a5776cebc9bb87c984fa69cba8f1 || true

Repository: wso2/product-integrator

Length of output: 278


Pin aquasecurity/trivy-action to the commit SHA for v0.35.0.

0.35.0 resolves to 57a97c7e7821a5776cebc9bb87c984fa69cba8f1; use the SHA instead of the mutable tag.

Proposed fix
-        uses: aquasecurity/trivy-action@0.35.0
+        uses: aquasecurity/trivy-action@57a97c7e7821a5776cebc9bb87c984fa69cba8f1 # v0.35.0
📝 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
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@0.35.0
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@57a97c7e7821a5776cebc9bb87c984fa69cba8f1 # v0.35.0
🤖 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/compile.yml around lines 122 - 123, The Trivy workflow
step is using a mutable tag for aquasecurity/trivy-action instead of a pinned
commit. Update the uses reference in the Run Trivy vulnerability scanner step to
the v0.35.0 commit SHA 57a97c7e7821a5776cebc9bb87c984fa69cba8f1, keeping the
existing job name and step structure unchanged.

timeout: '10m'
# lib/vscode and external are third-party submodules (upstream VS Code and
# wso2/vscode-extensions) maintained and scanned in their own repos.
skip-dirs: 'common/temp,lib/vscode,external'

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.

We can't skip the vulnerabilities on the VS Code side since it's the core of the application.

@kaumini
kaumini changed the base branch from 5.0.x to main July 7, 2026 05:32
@samithkavishke
samithkavishke marked this pull request as draft August 5, 2026 08:58
@samithkavishke

Copy link
Copy Markdown
Contributor

Discussed with @kaumini offline and decided to push this in a future release

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants