mirror of
https://github.com/morluto/rea.git
synced 2026-11-19 05:02:40 +00:00
fix(audit): report GCC profile paths retained in Go build flags (#12029)
Co-authored-by: ShuaixinHuang <197200901+ShuaixinHuang@users.noreply.github.com>
This commit is contained in:
1 parent
754589d4bf
commit
180e97f86f
2 files changed
+30
-2
No files matched your search
@@ -2239,6 +2239,32 @@ describe("ReleaseExposureService compiler path separators", () => {
|
||||
);
|
||||
});
|
||||
|
||||
describe("ReleaseExposureService compiler profile paths", () => {
|
||||
it.each([
|
||||
["CGO_CFLAGS", "-O2 -fprofile-use=internal/profiles", "internal/profiles"],
|
||||
["CGO_CFLAGS", "'-fprofile-dir=private profiles'", "private profiles"],
|
||||
["-ldflags", "-extldflags=-fprofile-generate=private/gcov", "private/gcov"],
|
||||
])("reports the named directory in %s %s", async (key, value, path) => {
|
||||
const report = await goReport(goModule([{ key, value }]));
|
||||
const check = report.checks.find((item) => item.id === "go.build_paths");
|
||||
expect(check?.status).toBe("exposed");
|
||||
expect(check?.observation.samples).toEqual([path]);
|
||||
});
|
||||
|
||||
it("finds no profile path for options without directory operands", async () => {
|
||||
const report = await goReport(
|
||||
goModule([
|
||||
{
|
||||
key: "CGO_CFLAGS",
|
||||
value: "-fprofile-use -fprofile-generate -O2",
|
||||
},
|
||||
]),
|
||||
);
|
||||
const check = report.checks.find((item) => item.id === "go.build_paths");
|
||||
expect(check?.status).toBe("not_observed");
|
||||
});
|
||||
});
|
||||
|
||||
describe("ReleaseExposureService Go linker -r search list", () => {
|
||||
it.each([["-r=$ORIGIN/../lib -s -w"], ["-r ${ORIGIN}/lib:$ORIGIN"]])(
|
||||
"does not read the ELF loader-expanded entries in %s as build paths",
|
||||
|
||||
Reference in new issue
Block a user