MCPcopy Create free account
hub / github.com/ConardLi/easy-agent / readTrustedStringArraySetting

Function readTrustedStringArraySetting

src/utils/settings.ts:341–360  ·  view source on GitHub ↗
(
  cwd: string,
  key: string,
)

Source from the content-addressed store, hash-verified

339 if (!env || typeof env !== "object" || Array.isArray(env)) continue;
340 for (const [key, value] of Object.entries(env as Record<string, unknown>)) {
341 if (value === undefined || value === null) continue;
342 if ((src.source === "project" || src.source === "local") && isInheritedCredentialProtected(key)) {
343 continue;
344 }
345 out[key] = typeof value === "string" ? value : String(value);
346 }
347 }
348 return out;
349}
350
351/**
352 * Concatenate + de-duplicate a string-array setting across TRUSTED sources.
353 * Used by `additionalDirectories`, which widens the filesystem access boundary
354 * — so an untrusted repo must not be able to grant itself extra directories.
355 */
356export async function readTrustedStringArraySetting(cwd: string, key: string): Promise<string[]> {
357 const sources = await loadTrustedSettingSources(cwd);
358 const seen = new Set<string>();
359 const out: string[] = [];
360 for (const src of sources) {
361 const arr = src.raw?.[key];
362 if (!Array.isArray(arr)) continue;
363 for (const item of arr) {

Callers 1

mainFunction · 0.85

Calls 1

Tested by

no test coverage detected