Skip to content

Commit 94e48d0

Browse files
authored
Merge pull request #6292 from snyk/fix/CN-436-go-binaries-not-scanned-on-windows
fix: CN-436 go binaries not scanned on windows
2 parents 2837924 + be8098b commit 94e48d0

File tree

4 files changed

+40
-11
lines changed

4 files changed

+40
-11
lines changed

package-lock.json

Lines changed: 9 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@
117117
"semver": "^6.0.0",
118118
"snyk-config": "^5.0.0",
119119
"snyk-cpp-plugin": "2.24.1",
120-
"snyk-docker-plugin": "8.10.0",
120+
"snyk-docker-plugin": "8.10.2",
121121
"snyk-go-plugin": "1.23.0",
122122
"snyk-gradle-plugin": "5.1.0",
123123
"snyk-module": "3.1.0",
5.51 MB
Binary file not shown.

test/jest/acceptance/snyk-container/container.spec.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,36 @@ DepGraph end`,
553553
TEST_DISTROLESS_STATIC_IMAGE_DEPGRAPH.pkgs.length,
554554
);
555555
});
556+
557+
it('finds go binaries on windows with complex paths', async () => {
558+
const { code, stdout } = await runSnykCLI(
559+
'container test test/fixtures/container-projects/go-binaries.tar --json',
560+
{ env },
561+
);
562+
563+
const jsonOutput = JSON.parse(stdout);
564+
565+
// Should succeed and find Go binaries (including esbuild)
566+
expect([0, 1]).toContain(code); // 0 = no vulns, 1 = vulns found
567+
expect(jsonOutput).toHaveProperty('applications');
568+
expect(jsonOutput.applications).toBeInstanceOf(Array);
569+
expect(jsonOutput.applications.length).toBeGreaterThanOrEqual(1);
570+
571+
// Verify esbuild binary was actually detected by the real container scan
572+
const esbuildApp = jsonOutput.applications.find(
573+
(app) => app.targetFile && app.targetFile.includes('esbuild'),
574+
);
575+
expect(esbuildApp).toBeDefined();
576+
expect(esbuildApp.targetFile).toBe(
577+
'/app/node_modules/.pnpm/@[email protected]/node_modules/@esbuild/linux-x64/bin/esbuild',
578+
);
579+
580+
// Verify the complex pnpm path structure is handled correctly
581+
expect(esbuildApp.targetFile).toMatch(/@esbuild\+linux-x64@0\.23\.1/);
582+
expect(esbuildApp.targetFile).toContain('.pnpm');
583+
expect(esbuildApp.targetFile).toContain('node_modules');
584+
expect(esbuildApp.packageManager).toBe('gomodules');
585+
});
556586
});
557587

558588
describe('snyk container monitor --json output', () => {

0 commit comments

Comments
 (0)