diff --git a/src/application/releaseExposure/ReleaseExposureService.test.ts b/src/application/releaseExposure/ReleaseExposureService.test.ts index 325dc52954..fa2ee63a33 100644 --- a/src/application/releaseExposure/ReleaseExposureService.test.ts +++ b/src/application/releaseExposure/ReleaseExposureService.test.ts @@ -1019,7 +1019,7 @@ describe("ReleaseExposureService cleanup", () => { }); }); -describe("ReleaseExposureService Go UNC paths", () => { +describe("ReleaseExposureService Go Windows paths", () => { it("reports UNC roots retained in Go flags", async () => { const module = (value: string) => ({ path: "github.com/acme/app", @@ -1045,6 +1045,25 @@ describe("ReleaseExposureService Go UNC paths", () => { await goStatus(module(String.raw`-DNAME=\\ -DHOST=\\buildhost`)), ).toBe("not_observed"); }); + + it.each([ + [String.raw`-I..\sdk\include`, String.raw`..\sdk\include`], + [String.raw`-O2 -I.\sdk`, String.raw`.\sdk`], + [String.raw`"-isystem ..\my sdk\include"`, String.raw`..\my sdk\include`], + ])("reports the backslash-relative path in %s", async (value, path) => { + const report = await goReport({ + path: "github.com/acme/app", + main: null, + dependencies: [], + settings: [{ key: "CGO_CFLAGS", value }], + unparsed_lines: [], + unparsed_line_bytes_base64: [], + complete: true, + }); + const check = report.checks.find((item) => item.id === "go.build_paths"); + expect(check?.status).toBe("exposed"); + expect(check?.observation.samples).toEqual([path]); + }); }); describe("ReleaseExposureService Go paths", () => { diff --git a/src/application/releaseExposure/ReleaseExposureService.ts b/src/application/releaseExposure/ReleaseExposureService.ts index c7c9f67c03..d6ac8eb898 100644 --- a/src/application/releaseExposure/ReleaseExposureService.ts +++ b/src/application/releaseExposure/ReleaseExposureService.ts @@ -740,7 +740,7 @@ const GO_FLAG_SETTING = const GO_FLAG_FIELD = /(?:[^\s"']|"[^"]*"|'[^']*')+/gu; /** A path after a flag prefix, whitespace, `=`, or `,`, as in `-isystem/opt/x`. */ const GO_FLAG_PATH = - /(?:^|[\s=,])(?:-(?:idirafter|imacros|include|iprefix|iquote|isysroot|isystem|[BFILT]))?((?:\.{1,2}\/|\/|[A-Za-z]:[\\/]|\\{2}[^\\\s=,]+\\)[^=,]+)/gu; + /(?:^|[\s=,])(?:-(?:idirafter|imacros|include|iprefix|iquote|isysroot|isystem|[BFILT]))?((?:\.{1,2}[\\/]|\/|[A-Za-z]:[\\/]|\\{2}[^\\\s=,]+\\)[^=,]+)/gu; /** Paths in one flag value, with a quoted path kept whole up to the next flag. */ const goFlagPaths = (value: string): string[] => diff --git a/tests/acceptance/releaseExposureCli.test.ts b/tests/acceptance/releaseExposureCli.test.ts index 1f9afbdc4c..d1c0b821a3 100644 --- a/tests/acceptance/releaseExposureCli.test.ts +++ b/tests/acceptance/releaseExposureCli.test.ts @@ -44,7 +44,7 @@ cliTest( expect( report.checks.find((check) => check.id === "electron.run_as_node") ?.status, - ).toBe("not_applicable"); + ).toBe("unknown"); expect( report.checks.find((check) => check.id === "native.pdb_path")?.status, ).toBe("not_applicable");