openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
53 lines (52 loc) • 2.01 kB
JavaScript
import { s as resolveOpenClawStateSqlitePath } from "./openclaw-state-db.paths-R3ArRCcz.mjs";
import { o as readSecretStoreValue, r as listSecretStoreEntries } from "./secret-store-BZfjrX_2.mjs";
//#region src/secrets/audit-store.ts
async function findSecretStoreRedactedValueFindings(e) {
return (await listSecretStoreEntries({
scope: { kind: "team" },
redactedOnly: true,
database: e.database
})).flatMap((t) => {
if (e.excludeNames?.has(t.name)) return [];
return [{
name: t.name,
code: "PLACEHOLDER_VALUE",
severity: "error",
file: e.database.path ?? resolveOpenClawStateSqlitePath(e.database.env),
jsonPath: `secret_store_entries.${t.name}`,
message: `Secret store entry "${t.name}" contains a redaction placeholder and is unavailable. Run openclaw doctor --fix to repair a store-backed Gateway token; replace other entries with real credentials.`
}];
});
}
async function findSecretStorePlaintextResidueFindings(e) {
const t = await listSecretStoreEntries({
scope: { kind: "team" },
database: e.database
});
if (t.length === 0 || e.assignments.length === 0) return [];
const n = /* @__PURE__ */ new Map();
for (const r of t) {
const t = await readSecretStoreValue({
scope: { kind: "team" },
name: r.name,
database: e.database
});
if (!t.ok) {
if (t.error.code === "SECRET_STORE_NOT_FOUND") continue;
if (t.error.code === "SECRET_STORE_INVALID_NAME") throw new Error(t.error.message);
throw new Error(t.error.message, { cause: t.error.cause });
}
const i = n.get(t.value);
if (i) i.push(r.name);
else n.set(t.value, [r.name]);
}
return e.assignments.flatMap((e) => (n.get(e.value) ?? []).map((t) => ({
code: "STORE_PLAINTEXT_RESIDUE",
severity: "warn",
file: e.file,
jsonPath: e.path,
message: `${e.path} duplicates team secret store entry "${t}"; replace the plaintext with a store SecretRef.`
})));
}
//#endregion
export { findSecretStoreRedactedValueFindings as n, findSecretStorePlaintextResidueFindings as t };