Skip to content

Fix the vulnerable dependencies that block the release - #191

Merged
Jordanh1996 merged 10 commits into
masterfrom
fix/XRAY-100231-replace-gomod-absolutizer
Oct 1, 2026
Merged

Jordanh1996 merged 10 commits into
masterfrom
fix/XRAY-100231-replace-gomod-absolutizer

Conversation

@Jordanh1996

@Jordanh1996 Jordanh1996 commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Background

The release workflow's audit gate blocks the next release on jackson 2.18.6, and on golang.org/x/mod v0.18.0 plus the runner's Go stdlib, both found through the gomod-absolutizer submodule.

Description

The Go scan runs go in the project directory with GOFLAGS=-modfile=<temp>/go.mod, so go reads and writes a temp copy of go.mod and go.sum while relative replace paths resolve as written. That replaces copying the project and rewriting its paths with the absolutizer, so the submodule (and the dead JFrog Pipelines release files) are removed. jackson goes to 2.21.7, the lowest version without known CVEs.

Tests

GoTreeBuilderTest passes on macOS, Windows and WSL, and now checks that the scanned project's go.mod and go.sum are left untouched. jf audit with the gate's exclusions reports 0 vulnerabilities.


  • All tests passed. If this feature is not already covered by the tests, I added new tests.

🤖 Generated with Claude Code

Rewrite relative replace paths with go mod edit instead of running the
gomod-absolutizer, remove its submodule, and upgrade jackson to 2.21.7.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 8fdfec6a-aae7-4c45-8f4f-5acc4e58dcbe

  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Releases moved to the ecosystem-workflows GitHub Action (XRAY-137561).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
GoDriver runs commands through /bin/sh -c or cmd /c, so replace paths
with spaces or shell characters broke the edit or ran as commands.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
GoDriver runs commands through /bin/sh -c or cmd /c. Values from the
scanned go.mod are now referenced from the command instead of quoted into
it, so no shell interprets them. On Windows, a replace directive with a
double quote is skipped, since cmd cannot escape it inside quotes.
The WSL conversion uses WslUtils, and absolute replace paths go through
the same resolution as relative ones.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
go reads and writes a temp copy of go.mod (and go.sum) via GOFLAGS
-modfile while running in the project directory, so relative replace
paths resolve as they are and nothing from the go.mod reaches a shell.
This removes GoScanWorkspaceCreator and its replace rewrite.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Set GOWORK=off, since workspace mode rejects -modfile, and start from
go env GOFLAGS so values saved with go env -w are kept. The go version
check runs without the scan flags.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@attiasas attiasas added the improvement Automatically generated release notes label Oct 1, 2026

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

The -modfile scan matches the goal: go runs in the project directory, relative replace paths still resolve from the module root, and writes go to a temp go.mod / go.sum that is deleted afterward. go version and go env GOFLAGS run before the scan flags, and GOWORK=off is set only on the scan driver. The gomod-absolutizer submodule and the old Pipelines release files are fully removed. Jackson 2.21.7 is the right pin.

All 18 unit-test jobs passed (Ubuntu, macOS, and Windows; Java 18/20/22; Go 1.23 and 1.24). Frogbot (scan-pull-request) was still pending.

Not blocking. Three small follow-ups inline.

DepTree dt = treeBuilder.buildTree();
validateDependencyTreeResults(expected, dt);
assertEquals(Files.readString(projectDir.resolve("go.mod")), goMod);
assertFalse(Files.exists(projectDir.resolve("go.sum")));

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.

This locks the no-go.sum case, which is enough to show -modfile is in effect: a tidy against the real module would have created go.sum.

testCreateDependencyTree2 is the checksum-mismatch fixture and still does not compare go.mod or go.sum before and after. modTidy passes ignoreErrors=true whenever Go is at least 1.16, so go mod tidy -e can succeed even when sums are wrong. A byte comparison on project2 would cover the case the absolutizer existed for.

return flag;
}
return goModAbsDir;
String quote = flag.contains("'") ? "\"" : "'";

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.

Go 1.21 and later keep a quoted GOFLAGS path intact. Go 1.16 through 1.20 split GOFLAGS on whitespace and reject this form, so a temp directory under a path with a space (C:\Users\First Last\...) fails the scan. The failure happens before any write, so the project files stay intact.

CI only runs Go 1.23 and 1.24, and the GitHub Windows temp path has no space, so this branch never runs. A path that contains both ' and " is wrapped in one of those quotes and will not parse, with the same fail-closed behavior.

A unit test that builds GOFLAGS for a path containing a space, plus one scan whose temp directory contains a space, would cover it.

if (runGoThroughWsl) {
// Windows environment variables reach go inside WSL only when WSLENV lists them.
String wslEnv = scanEnv.getOrDefault("WSLENV", System.getenv("WSLENV"));
scanEnv.put("WSLENV", StringUtils.isBlank(wslEnv) ? "GOFLAGS:GOWORK" : wslEnv + ":GOFLAGS:GOWORK");

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.

This appends :GOFLAGS:GOWORK even when those names are already listed. A prior GOFLAGS/p then sits next to a second GOFLAGS. The value is already a Linux path (/mnt/c/...), so path translation should not rewrite it. Skipping names that are already present would make the intent obvious.

This path is not in CI. The workflow runs native Windows, not WSL.

…pe WSLENV

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Jordanh1996 Jordanh1996 added the safe to test run tests label Oct 1, 2026
@github-actions github-actions Bot removed the safe to test run tests label Oct 1, 2026
Xray published XRAY-1097605 for commons-io 1.4, so the maven-example
fixture now has four vulnerabilities and the exact count of three fails
on every branch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Jordanh1996 Jordanh1996 added the safe to test run tests label Oct 1, 2026
@github-actions github-actions Bot removed the safe to test run tests label Oct 1, 2026
@github-actions

github-actions Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

👍 Frogbot scanned this pull request and did not find any new security issues.


@Jordanh1996
Jordanh1996 merged commit e047b80 into master Oct 1, 2026
39 checks passed
@Jordanh1996
Jordanh1996 deleted the fix/XRAY-100231-replace-gomod-absolutizer branch October 1, 2026 10:43

This branch was successfully deployed

1 active deployment
frogbot — 850d8f9a Deployed Oct 1, 2026 by Jordanh1996 via scan-pull-request #361
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement Automatically generated release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants