Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

fix(gfs): give the seed path lookup a null prototype

Alfredo Lopez913ee7811e89
diff --git a/control-api/src/gfs/seedResources.ts b/control-api/src/gfs/seedResources.ts
index c0cc66771..3ce31a88c 100644
--- a/control-api/src/gfs/seedResources.ts
+++ b/control-api/src/gfs/seedResources.ts
@@ -87,7 +87,12 @@ export async function seedRootDirectories(
pathCache: '/',
})
- const byPath: Record<string, string> = {}
+ // Null-prototype lookup: the keys are caller-supplied paths, so removing the
+ // prototype makes property injection structurally impossible instead of
+ // resting on the leading-slash invariant alone (defence in depth, and it
+ // clears CodeQL js/remote-property-injection). Serialization is unaffected —
+ // JSON.stringify, Object.keys and spread all behave identically.
+ const byPath: Record<string, string> = Object.create(null)
for (const { path, segments } of normalizedPaths) {
if (segments.length === 0) continue // '/' is the root itself, already ensured
let parentResourceId = rootResourceId