Tighten opaque plugin content boundaries

This commit is contained in:
npc0-hue
2026-09-03 18:24:39 +08:00
parent 80cddbf19d
commit 14cbc63e61
31 changed files with 452 additions and 558 deletions
-26
View File
@@ -822,11 +822,6 @@ export function parseArtifactReference(result: Record<string, string> | undefine
if (!reference.downloadUrl.startsWith(`/api/v1/artifacts/${encodeURIComponent(reference.artifactId)}/content`)) {
return undefined;
}
for (const value of Object.values(reference)) {
if (typeof value === "string" && containsUnsafeReferenceContent(value)) {
return undefined;
}
}
return reference;
}
@@ -883,24 +878,3 @@ export function bridgeError(
): PluginBridgeError {
return { code, message, details };
}
function containsUnsafeReferenceContent(value: string): boolean {
const lowered = value.trim().toLowerCase();
return (
lowered.includes("/users/") ||
lowered.includes("/private/") ||
lowered.includes("unix://") ||
lowered.includes("tcp://") ||
lowered.includes("bearer ") ||
lowered.includes("password=") ||
lowered.includes("api_key=") ||
lowered.includes("apikey=") ||
lowered.includes("storage://") ||
lowered.includes("file://") ||
lowered.includes("sessiontoken") ||
lowered.includes("secret://") ||
lowered.includes("hostpath") ||
lowered.includes("processid") ||
lowered.startsWith("sk-")
);
}