fix(core): don't permit access to system directories (#16891)

This commit is contained in:
Adam
2026-03-10 11:32:05 -05:00
committed by GitHub
parent ad08fd57df
commit 9c4325bcf8
3 changed files with 63 additions and 5 deletions

View File

@@ -11,6 +11,7 @@ import { Ripgrep } from "./ripgrep"
import fuzzysort from "fuzzysort"
import { Global } from "../global"
import { git } from "@/util/git"
import { Protected } from "./protected"
export namespace File {
const log = Log.create({ service: "file" })
@@ -345,10 +346,7 @@ export namespace File {
if (isGlobalHome) {
const dirs = new Set<string>()
const ignore = new Set<string>()
if (process.platform === "darwin") ignore.add("Library")
if (process.platform === "win32") ignore.add("AppData")
const ignore = Protected.names()
const ignoreNested = new Set(["node_modules", "dist", "build", "target", "vendor"])
const shouldIgnore = (name: string) => name.startsWith(".") || ignore.has(name)