fix: limit AgentRun default tool credentials

This commit is contained in:
Codex
2026-06-25 03:16:18 +00:00
parent 10c6a0ef0d
commit 960da6e214
+14 -8
View File
@@ -7312,15 +7312,21 @@ function agentRunExecutionPolicyWithLaneCredentials(basePolicy: Record<string, u
};
}
function agentRunToolCredentialRefs(spec: AgentRunLaneSpec): Array<{ tool: string; sourceId: string; secretRef: { namespace: string; name: string; key: string }; valuesPrinted: false }> {
const AGENTRUN_DEFAULT_TOOL_CREDENTIALS = new Set(["unidesk-ssh"]);
function agentRunToolCredentialRefs(spec: AgentRunLaneSpec, options: { includeUnsupported?: boolean } = {}): Array<{ tool: string; sourceId: string; secretRef: { namespace: string; name: string; key: string }; valuesPrinted: false }> {
return spec.secrets
.filter((secret) => secret.providerCredentialProfile === null && secret.id.startsWith("tool-"))
.map((secret) => ({
tool: secret.id.replace(/^tool-/u, "").replace(/-token$/u, ""),
sourceId: secret.id,
secretRef: secret.targetRef,
valuesPrinted: false,
}));
.map((secret) => {
const tool = secret.id.replace(/^tool-/u, "").replace(/-token$/u, "");
return {
tool,
sourceId: secret.id,
secretRef: secret.targetRef,
valuesPrinted: false as const,
};
})
.filter((credential) => options.includeUnsupported === true || AGENTRUN_DEFAULT_TOOL_CREDENTIALS.has(credential.tool));
}
function renderAgentRunSessionPolicyExplanation(args: string[] = [], options: AgentRunRestTargetOptions = { node: null, lane: null }): string {
@@ -7338,7 +7344,7 @@ function renderAgentRunSessionPolicyExplanation(args: string[] = [], options: Ag
secretRef: credential.secretRef,
valuesPrinted: false,
}));
const toolCredentialSources = agentRunToolCredentialRefs(spec);
const toolCredentialSources = agentRunToolCredentialRefs(spec, { includeUnsupported: true });
return [
"KIND: session-policy",
`CONFIG: ${config.sourcePath}`,