Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

chore(semgrep): mark the git-verdict memo key resolve() as a non-filesystem use

time-attackecb46a1750c2
diff --git a/src/core/git-visible-files.ts b/src/core/git-visible-files.ts
index 8042865fb8..dfd2504246 100644
--- a/src/core/git-visible-files.ts
+++ b/src/core/git-visible-files.ts
@@ -34,12 +34,14 @@ export function invalidateGitListingCache(): void {
/** True when the current scope already saw git report `dir` outside any repository. */
export function knownOutsideGitRepo(dir: string): boolean {
+ // nosemgrep: javascript.lang.security.audit.path-traversal.path-join-resolve-traversal.path-join-resolve-traversal -- resolve() only normalizes a memo key for a directory git already ran in; nothing is read or written at the path
return gitScope.getStore()?.outside.has(resolve(dir)) ?? false;
}
/** Record a failed git command run in `dir`: its stderr saying "not a git repository" is remembered for the current scope. */
export function noteGitFailure(dir: string, error: unknown): void {
const stderr = (error as { stderr?: unknown } | null)?.stderr;
+ // nosemgrep: javascript.lang.security.audit.path-traversal.path-join-resolve-traversal.path-join-resolve-traversal -- resolve() only normalizes a memo key for a directory git already ran in; nothing is read or written at the path
if (/not a git repository/i.test(String(stderr ?? ''))) gitScope.getStore()?.outside.add(resolve(dir));
}