From 07a83ccc9bd9d5ce93e1531da9b47d3a8e85626d Mon Sep 17 00:00:00 2001 From: Suparva Date: Mon, 26 Oct 2026 00:07:18 +0530 Subject: [PATCH 1/2] fix(security): allow C++ source files in Private directories --- core/indexing/ignore.ts | 13 +++++++++++++ core/indexing/ignore.vitest.ts | 25 +++++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/core/indexing/ignore.ts b/core/indexing/ignore.ts index e431e24eed9..dcf4d0c2054 100644 --- a/core/indexing/ignore.ts +++ b/core/indexing/ignore.ts @@ -243,6 +243,19 @@ export function isSecurityConcern(filePathOrUri: string) { try { filepath = fileURLToPath(filePathOrUri); } catch {} + + const normalized = filepath.replace(/\\/g, "/"); + const isSourceInPrivate = + /(?:^|\/)Source\/[^/]+\/Private\//i.test(normalized) || + /(?:^|\/)Private\/.*?\.(?:cpp|cc|cxx|c|h|hpp|hxx|inl|cs)$/i.test(normalized); + + if (isSourceInPrivate) { + const basename = path.basename(filepath); + if (!defaultSecurityIgnoreFile.ignores(basename)) { + return false; + } + } + if (path.isAbsolute(filepath)) { const dir = path.dirname(filepath).split(/\/|\\/).at(-1) ?? ""; const basename = path.basename(filepath); diff --git a/core/indexing/ignore.vitest.ts b/core/indexing/ignore.vitest.ts index 565db5efd15..345f2875e70 100644 --- a/core/indexing/ignore.vitest.ts +++ b/core/indexing/ignore.vitest.ts @@ -151,6 +151,31 @@ describe("isSecurityConcern", () => { expect(isSecurityConcern("styles/main.css")).toBe(false); }); + it("should not flag C++ source files in Unreal Engine and Private directories", () => { + expect( + isSecurityConcern("Source/ExampleModule/Private/ExampleActor.cpp"), + ).toBe(false); + expect( + isSecurityConcern("Source/ExampleModule/Private/ExampleActor.h"), + ).toBe(false); + expect( + isSecurityConcern( + "Source/ExampleModule/Private/Subdir/ExampleActor.cpp", + ), + ).toBe(false); + expect( + isSecurityConcern( + "c:/Users/name/Documents/ExampleProject/Source/ExampleModule/Private/ExampleActor.cpp", + ), + ).toBe(false); + expect(isSecurityConcern("Private/MyActor.cpp")).toBe(false); + expect(isSecurityConcern("Private/MyActor.h")).toBe(false); + expect( + isSecurityConcern("Source/ExampleModule/Private/secret.key"), + ).toBe(true); + expect(isSecurityConcern("Private/.env")).toBe(true); + }); + it("should not flag regular configuration files", () => { expect(isSecurityConcern("package.json")).toBe(false); expect(isSecurityConcern("tsconfig.json")).toBe(false); From 7e8c47f9d56f75d55316674aa90ba1fac8d8756c Mon Sep 17 00:00:00 2001 From: Suparva Date: Mon, 26 Oct 2026 13:06:11 +0530 Subject: [PATCH 2/2] chore: format with prettier --- core/indexing/ignore.ts | 4 +++- core/indexing/ignore.vitest.ts | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/core/indexing/ignore.ts b/core/indexing/ignore.ts index dcf4d0c2054..1609b0830b3 100644 --- a/core/indexing/ignore.ts +++ b/core/indexing/ignore.ts @@ -247,7 +247,9 @@ export function isSecurityConcern(filePathOrUri: string) { const normalized = filepath.replace(/\\/g, "/"); const isSourceInPrivate = /(?:^|\/)Source\/[^/]+\/Private\//i.test(normalized) || - /(?:^|\/)Private\/.*?\.(?:cpp|cc|cxx|c|h|hpp|hxx|inl|cs)$/i.test(normalized); + /(?:^|\/)Private\/.*?\.(?:cpp|cc|cxx|c|h|hpp|hxx|inl|cs)$/i.test( + normalized, + ); if (isSourceInPrivate) { const basename = path.basename(filepath); diff --git a/core/indexing/ignore.vitest.ts b/core/indexing/ignore.vitest.ts index 345f2875e70..1ac9a712256 100644 --- a/core/indexing/ignore.vitest.ts +++ b/core/indexing/ignore.vitest.ts @@ -170,9 +170,9 @@ describe("isSecurityConcern", () => { ).toBe(false); expect(isSecurityConcern("Private/MyActor.cpp")).toBe(false); expect(isSecurityConcern("Private/MyActor.h")).toBe(false); - expect( - isSecurityConcern("Source/ExampleModule/Private/secret.key"), - ).toBe(true); + expect(isSecurityConcern("Source/ExampleModule/Private/secret.key")).toBe( + true, + ); expect(isSecurityConcern("Private/.env")).toBe(true); });