Skip to content

ci: add mend integration - #12520

Merged
Adam-Aghili merged 3 commits into
mainfrom
aka/mend-integration
Apr 21, 2026
Merged

ci: add mend integration#12520
Adam-Aghili merged 3 commits into
mainfrom
aka/mend-integration

Conversation

@Adam-Aghili

@Adam-Aghili Adam-Aghili commented Apr 6, 2026

Copy link
Copy Markdown
Collaborator

add mend integration to OSS

Summary by CodeRabbit

  • Chores
    • Integrated automated dependency vulnerability scanning into the CI/CD pipeline. A new workflow automatically scans frontend dependencies on pull requests and commits to supported branches, enabling early detection of potential security issues in the codebase.

@coderabbitai

coderabbitai Bot commented Apr 6, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 1e62682b-c15d-4a74-a28f-b40a3a1a3baa

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Walkthrough

Added .github/workflows/mend.yml, a new GitHub Actions workflow triggered on pushes and pull requests to main and release-1.9.0 branches. Workflow installs Node.js 24 and Java 21 (Semeru), caches dependencies and build artifacts, conditionally downloads the Mend Unified Agent jar, and executes security scanning with debug logging enabled.

Changes

Cohort / File(s) Summary
GitHub Actions Workflow
.github/workflows/mend.yml
New security scanning workflow that sets up Node.js and Java environments, caches npm dependencies and Mend jar file, conditionally downloads jar from S3 with timestamp-based caching, and runs Mend Unified Agent scan against src/frontend directory with configuration sourced from repository secrets.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 7
✅ Passed checks (7 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'ci: add mend integration' directly and concisely describes the main change—adding a Mend security scanning workflow to CI/CD—and matches the changeset perfectly.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Test Coverage For New Implementations ✅ Passed PR adds GitHub Actions workflow configuration for security scanning, which is CI/CD infrastructure, not application code subject to test coverage requirements.
Test Quality And Coverage ✅ Passed The 'Test Quality and Coverage' check is not applicable to this PR, which adds only a GitHub Actions workflow configuration file (.github/workflows/mend.yml). GitHub Actions workflows are declarative CI/CD infrastructure in YAML format, not application code with business logic, async functions, or API endpoints requiring traditional unit testing with pytest or Playwright.
Test File Naming And Structure ✅ Passed PR only modifies .github/workflows/mend.yml CI/CD configuration file; no test files are included.
Excessive Mock Usage Warning ✅ Passed The custom check for excessive mock usage is not applicable to this PR. The PR exclusively adds a GitHub Actions workflow configuration file with no test files or mock objects to evaluate.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch aka/mend-integration

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.

@github-actions

github-actions Bot commented Apr 6, 2026

Copy link
Copy Markdown
Contributor

Frontend Unit Test Coverage Report

Coverage Summary

Lines Statements Branches Functions
Coverage: 34%
34.76% (39813/114533) 67.4% (5438/8068) 35.72% (931/2606)

Unit Test Results

Tests Skipped Failures Errors Time
3818 0 💤 0 ❌ 0 🔥 7m 17s ⏱️

@codecov

codecov Bot commented Apr 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 52.63%. Comparing base (9aae6de) to head (cafcca4).
⚠️ Report is 3 commits behind head on main.

❌ Your project status has failed because the head coverage (49.97%) is below the target coverage (60.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #12520      +/-   ##
==========================================
- Coverage   52.88%   52.63%   -0.26%     
==========================================
  Files        2023     2023              
  Lines      183784   183070     -714     
  Branches    27387    27598     +211     
==========================================
- Hits        97202    96359     -843     
- Misses      85484    85612     +128     
- Partials     1098     1099       +1     
Flag Coverage Δ
backend 55.75% <ø> (-0.10%) ⬇️
frontend 52.55% <ø> (-0.35%) ⬇️
lfx 49.97% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 118 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 2

🧹 Nitpick comments (2)
.github/workflows/mend.yml (2)

37-43: Static cache key makes Mend agent cache effectively stale/immutable.

On Line 42, actions/cache uses a constant key. Cache entries are immutable, so refreshed agent binaries won’t be persisted under the same key, causing repeated re-download behavior after updates.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/mend.yml around lines 37 - 43, The cache step "Cache Mend
Agent" (id: cache-mend) uses a static key "mend-agent-latest", which makes
cached agent binaries immutable and prevents updates from being stored; change
the cache key to be dynamic (for example include a checksum/hash of
wss-unified-agent.jar, a version file, or a timestamp/commit hash) or add
appropriate restore-keys so new agent binaries produce a new cache entry; update
the "key" value to reference the computed/hash token (or include runner/os and
commit) so updated jars are persisted and stale caches avoided.

56-56: Default CI scan log level should be less verbose.

On Line 56, -logLevel debug is very noisy and can increase exposure of scan metadata in logs. Prefer info by default and enable debug only for incident triage.

💡 Suggested change
-          java -jar wss-unified-agent.jar -d src/frontend -logLevel debug
+          java -jar wss-unified-agent.jar -d src/frontend -logLevel info
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/mend.yml at line 56, The CI workflow uses the
wss-unified-agent command with a very verbose flag "-logLevel debug" which
floods logs; change the flag to "-logLevel info" in the job step that runs "java
-jar wss-unified-agent.jar -d src/frontend -logLevel debug" so the default scan
logging is less noisy, leaving debug only for explicit triage runs.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/mend.yml:
- Around line 44-46: Replace the fragile download and execution steps for the
Mend agent (the curl line "curl -L -z wss-unified-agent.jar -o
wss-unified-agent.jar" and the subsequent JAR execution step) with a hardened
sequence: run curl with --fail --show-error --retry (and keep -L -z -o) to
ensure non‑zero exit on HTTP errors and retries, save the downloaded file,
compute its SHA256 (e.g., via sha256sum or shasum) and compare against the
MEND_UA_SHA256 GitHub secret, and exit the job if the checksum does not match;
only after a verified checksum should the workflow run the JAR (the "java -jar
wss-unified-agent.jar" step), and that execution should also be run with strict
shell failure handling (set -e) so any non‑zero exit fails the job.
- Around line 6-7: The "Run Mend Scan" workflow step should be guarded so it
doesn't run for forked pull requests where repository secrets (e.g.,
MEND_API_KEY) are unavailable; update the step named "Run Mend Scan" to include
an if-condition that skips execution for pull_request events from forks or when
the required secret is missing (for example: only run when event is not
pull_request OR when pull_request.head.repo.fork == false and the secret
exists). Ensure the condition uses GitHub Actions context (github.event_name and
github.event.pull_request.head.repo.fork) and checks the secret presence
(secrets.MEND_API_KEY) so forked PRs won’t attempt the secret-dependent scan.

---

Nitpick comments:
In @.github/workflows/mend.yml:
- Around line 37-43: The cache step "Cache Mend Agent" (id: cache-mend) uses a
static key "mend-agent-latest", which makes cached agent binaries immutable and
prevents updates from being stored; change the cache key to be dynamic (for
example include a checksum/hash of wss-unified-agent.jar, a version file, or a
timestamp/commit hash) or add appropriate restore-keys so new agent binaries
produce a new cache entry; update the "key" value to reference the computed/hash
token (or include runner/os and commit) so updated jars are persisted and stale
caches avoided.
- Line 56: The CI workflow uses the wss-unified-agent command with a very
verbose flag "-logLevel debug" which floods logs; change the flag to "-logLevel
info" in the job step that runs "java -jar wss-unified-agent.jar -d src/frontend
-logLevel debug" so the default scan logging is less noisy, leaving debug only
for explicit triage runs.
🪄 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: 3c696471-efe1-4685-8df5-5520bcfcdf02

📥 Commits

Reviewing files that changed from the base of the PR and between e555e47 and 19dda08.

📒 Files selected for processing (1)
  • .github/workflows/mend.yml

Comment thread .github/workflows/mend.yml Outdated
Comment on lines +6 to +7
pull_request:
branches: ["release-1.9.0", "main"]

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

🧩 Analysis chain

🏁 Script executed:

cat -n .github/workflows/mend.yml

Repository: langflow-ai/langflow

Length of output: 1978


🌐 Web query:

GitHub Actions fork pull request secrets unavailable behavior

💡 Result:

  • Default behavior: Workflows triggered by a pull request from a fork (typically on: pull_request) do not receive repository/org environment secrets. The job still gets GITHUB_TOKEN, but with minimal privileges (read-only). [1], [2], [3]
  • Why: Prevents a fork author from changing workflow/code and exfiltrating secrets during CI. [2], [3]
  • Common “workaround” (use with care): on: pull_request_target runs the workflow from the base repo’s workflow file and can access secrets and a more-privileged GITHUB_TOKEN, which is why it’s risky if you check out and run PR code (classic “pwn request”/secret-exfiltration pattern). [4], [5]
  • Dependabot behaves like a fork: Runs triggered by Dependabot for pull_request/push-family events are treated like fork PRs (read-only token / no secrets by default). [6], [7]

Sources
[1] GitHub Docs – Understanding GitHub secret types (Actions secrets not passed to fork PR workflows) (docs.github.com)
[2] GitHub Blog – Four tips to keep your GitHub Actions workflows secure (fork PRs: no secrets, read-only token) (github.blog)
[3] GitHub Docs – Using secrets in GitHub Actions (secrets not passed on fork-triggered workflows) (docs.github.com)
[4] GitHub Docs – Security hardening for GitHub Actions (risk of pull_request_target exposing secrets) (docs.github.com)
[5] GitHub Security Lab – Preventing pwn requests (pull_request_target can expose token/secrets) (securitylab.github.com)
[6] GitHub Changelog – Dependabot-triggered workflows treated as forks (github.blog)
[7] GitHub Docs – Dependabot troubleshooting (Dependabot runs treated as fork PRs by default) (docs.github.com)

Citations:


Add conditional guard to prevent secret-dependent Mend scan from failing on forked PRs.

The "Run Mend Scan" step (lines 48–56) triggers on pull_request but depends on repository secrets that are unavailable in fork PR contexts. This causes predictable authentication failures and noisy logs for external contributors.

Suggested change
      - name: Run Mend Scan
+       if: ${{ secrets.WS_APIKEY != '' && secrets.WS_USERKEY != '' && secrets.WS_WSS_URL != '' }}
        env:
          WS_APIKEY: ${{ secrets.WS_APIKEY }}
          WS_WSS_URL: ${{ secrets.WS_WSS_URL }}
          WS_USERKEY: ${{ secrets.WS_USERKEY }}
          WS_PRODUCTNAME: ${{ secrets.WS_PRODUCTNAME }}
          WS_PROJECTNAME: ${{ secrets.WS_PROJECTNAME }}
        run: |
          java -jar wss-unified-agent.jar -d src/frontend -logLevel debug
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/mend.yml around lines 6 - 7, The "Run Mend Scan" workflow
step should be guarded so it doesn't run for forked pull requests where
repository secrets (e.g., MEND_API_KEY) are unavailable; update the step named
"Run Mend Scan" to include an if-condition that skips execution for pull_request
events from forks or when the required secret is missing (for example: only run
when event is not pull_request OR when pull_request.head.repo.fork == false and
the secret exists). Ensure the condition uses GitHub Actions context
(github.event_name and github.event.pull_request.head.repo.fork) and checks the
secret presence (secrets.MEND_API_KEY) so forked PRs won’t attempt the
secret-dependent scan.

Comment thread .github/workflows/mend.yml Outdated
Comment on lines +44 to +46
- name: Download Mend Unified Agent if missing or outdated
run: |
curl -L -z wss-unified-agent.jar -o wss-unified-agent.jar https://unified-agent.s3.amazonaws.com/wss-unified-agent.jar

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

🧩 Analysis chain

🏁 Script executed:

cat -n .github/workflows/mend.yml

Repository: langflow-ai/langflow

Length of output: 1978


🏁 Script executed:

cd .github/workflows && ls -la | grep -i mend

Repository: langflow-ai/langflow

Length of output: 122


🏁 Script executed:

# Check if MEND_UA_SHA256 secret is referenced anywhere in the repo
rg "MEND_UA_SHA256" --type yaml --type yml

Repository: langflow-ai/langflow

Length of output: 91


🏁 Script executed:

# Search for integrity verification patterns in workflows
rg "sha256sum|checksum|SHASUM" .github/workflows/ --type yaml

Repository: langflow-ai/langflow

Length of output: 133


🏁 Script executed:

# Check if there are any other download patterns with verification
rg "curl.*sha" .github/workflows/ -A 2 -B 2

Repository: langflow-ai/langflow

Length of output: 46


Implement integrity verification and add strict curl error handling for JAR download.

The workflow downloads and executes a remote JAR without integrity verification or strict error handling. On line 46, the curl command lacks failure flags and will not halt on transient errors. This creates a supply-chain risk if the downloaded artifact is compromised or corrupted.

Add --fail, --show-error, and --retry flags to the curl command and implement SHA256 verification:

Required hardening
       - name: Download Mend Unified Agent if missing or outdated
         run: |
-          curl -L -z wss-unified-agent.jar -o wss-unified-agent.jar https://unified-agent.s3.amazonaws.com/wss-unified-agent.jar
+          curl --fail --show-error --silent --location --retry 3 --retry-delay 2 \
+            -z wss-unified-agent.jar \
+            -o wss-unified-agent.jar \
+            https://unified-agent.s3.amazonaws.com/wss-unified-agent.jar
+          echo "${{ secrets.MEND_UA_SHA256 }}  wss-unified-agent.jar" | sha256sum -c -

Also add the MEND_UA_SHA256 secret to your GitHub repository.

Also applies to line 56 (JAR execution).

📝 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: Download Mend Unified Agent if missing or outdated
run: |
curl -L -z wss-unified-agent.jar -o wss-unified-agent.jar https://unified-agent.s3.amazonaws.com/wss-unified-agent.jar
- name: Download Mend Unified Agent if missing or outdated
run: |
curl --fail --show-error --silent --location --retry 3 --retry-delay 2 \
-z wss-unified-agent.jar \
-o wss-unified-agent.jar \
https://unified-agent.s3.amazonaws.com/wss-unified-agent.jar
echo "${{ secrets.MEND_UA_SHA256 }} wss-unified-agent.jar" | sha256sum -c -
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/mend.yml around lines 44 - 46, Replace the fragile
download and execution steps for the Mend agent (the curl line "curl -L -z
wss-unified-agent.jar -o wss-unified-agent.jar" and the subsequent JAR execution
step) with a hardened sequence: run curl with --fail --show-error --retry (and
keep -L -z -o) to ensure non‑zero exit on HTTP errors and retries, save the
downloaded file, compute its SHA256 (e.g., via sha256sum or shasum) and compare
against the MEND_UA_SHA256 GitHub secret, and exit the job if the checksum does
not match; only after a verified checksum should the workflow run the JAR (the
"java -jar wss-unified-agent.jar" step), and that execution should also be run
with strict shell failure handling (set -e) so any non‑zero exit fails the job.

@erichare
erichare self-requested a review April 17, 2026 14:18

@erichare erichare left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Review: ci: add mend integration (#12520)

Overall a clean, minimal addition. A few issues worth addressing before merge:

🔴 Issues

  • Missing newline at EOF (.github/workflows/mend.yml:56) — file ends with \ No newline at end of file. Add a trailing newline.
  • Stale branch in triggersrelease-1.9.0 is listed in both push and pull_request branches, but the current release line is 1.10.0 (per recent commits). Either bump to release-1.10.0 or drop the specific release branch and rely on main only.
  • Cache key is not content-addressedkey: mend-agent-latest is a static key. The cache will never refresh, so the -z (if-modified-since) flag on curl will always see the cached jar and skip updates. Either:
    • Use a dated/versioned key (e.g. mend-agent-${{ github.run_id }} with a weekly restore-keys prefix), or
    • Drop the cache entirely since the download is cheap and correctness matters more than saved seconds on a security scan.
  • Step name misleading — "Download Mend Unified Agent if missing or outdated" runs unconditionally and doesn't actually check age beyond curl -z, which compares against the local file mtime restored from cache (always "fresh" from cache's POV). Combined with the static cache key above, the agent can get pinned indefinitely. Consider if: steps.cache-mend.outputs.cache-hit != 'true' or remove the cache.

🟡 Suggestions

  • Pin action versions to SHAs — security workflows especially should pin actions/checkout, actions/setup-node, actions/setup-java, actions/cache to full SHAs rather than major tags, to prevent supply-chain drift.
  • Concurrency group — add concurrency: { group: mend-${{ github.ref }}, cancel-in-progress: true } to avoid duplicate scans on rapid pushes.
  • permissions: block missing — explicitly set least-privilege permissions (e.g. permissions: { contents: read }). Default token perms on security scans should be minimal.
  • PRs from forks will fail silently — secrets (WS_APIKEY, etc.) aren't available to fork PRs. The java -jar step will run with empty env vars and likely error or submit under a null project. Guard with if: github.event.pull_request.head.repo.full_name == github.repository or switch to pull_request_target carefully (with its own risks).
  • -logLevel debug — debug logs can be verbose and may leak dependency paths/names into public CI logs. Consider info for default PR runs.
  • Java 21 + Node 24 — confirm the frontend toolchain actually requires Node 24; current repo may be pinned lower. Worth aligning with existing CI.

🟢 Nits

  • .gitignore additions for whitesource/ look correct.
  • Job name run-jar is generic — mend-scan would be clearer.

✅ Approval

Approve-with-changes. The caching/trigger-branch/fork-secret issues are the only ones I'd block on; the rest are quality-of-life.

add mend integration to OSS
add whitesource to .gitignore and scan all of src
address eric's comment 1
@Adam-Aghili
Adam-Aghili force-pushed the aka/mend-integration branch from 057e6c2 to cafcca4 Compare April 21, 2026 18:59
@Adam-Aghili

Copy link
Copy Markdown
Collaborator Author

@erichare I addressed as many as I think make sense or are possible. For the ones unaddressed I have comments below

Pin action versions to SHAs

We don't do this anywhere else in our yml files and it would add a lot of maintence to our code base. I think it is fine if we want to go this route but it would become a regular mantaince issue any time there is an update

Stale branch in triggers

I made it a larger wild card. We still want mend running on patch branches and maintaining that list strictly would be very difficult.

Code rabbit:

Implement integrity verification and add strict curl error handling for JAR download.

mend doesn't offer this. it is literally just a link https://pages.github.ibm.com/Supply-Chain-Security/Mend/docs/Getting%20Started/Unified%20Agent%20Scan/

@erichare
erichare self-requested a review April 21, 2026 19:04

@erichare erichare left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM @Adam-Aghili!

@github-actions github-actions Bot added the lgtm This PR has been approved by a maintainer label Apr 21, 2026
@Adam-Aghili
Adam-Aghili enabled auto-merge April 21, 2026 20:01
@Adam-Aghili
Adam-Aghili disabled auto-merge April 21, 2026 20:07
@Adam-Aghili
Adam-Aghili enabled auto-merge April 21, 2026 20:07
@Adam-Aghili
Adam-Aghili disabled auto-merge April 21, 2026 20:17
@Adam-Aghili
Adam-Aghili merged commit 5d6a7a0 into main Apr 21, 2026
102 of 103 checks passed
@Adam-Aghili
Adam-Aghili deleted the aka/mend-integration branch April 21, 2026 20:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants