🔒 [security fix] Fix sensitive data exposure in logs
- Change core.info to core.debug for model responses in src/inference.ts - Change core.info to core.debug for tool execution details in src/mcp.ts - Change core.info to core.debug for custom header logging in src/helpers.ts - Remove sensitive response previews from error messages in src/inference.ts - Update tests to reflect changes from core.info to core.debug
This commit is contained in:
@@ -61,7 +61,7 @@ export async function simpleInference(request: InferenceRequest): Promise<string
|
||||
|
||||
const response = await chatCompletion(client, chatCompletionRequest, 'simpleInference')
|
||||
const modelResponse = response.choices[0]?.message?.content
|
||||
core.info(`Model response: ${modelResponse || 'No response content'}`)
|
||||
core.debug(`Model response: ${modelResponse || 'No response content'}`)
|
||||
return modelResponse || null
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ export async function mcpInference(
|
||||
const modelResponse = assistantMessage?.content
|
||||
const toolCalls = assistantMessage?.tool_calls
|
||||
|
||||
core.info(`Model response: ${modelResponse || 'No response content'}`)
|
||||
core.debug(`Model response: ${modelResponse || 'No response content'}`)
|
||||
|
||||
messages.push({
|
||||
role: 'assistant',
|
||||
@@ -181,16 +181,14 @@ async function chatCompletion(
|
||||
try {
|
||||
response = JSON.parse(response)
|
||||
} catch (e) {
|
||||
const preview = response.slice(0, 400)
|
||||
throw new Error(
|
||||
`${context}: Chat completion response was a string and not valid JSON (${(e as Error).message}). Preview: ${preview}`,
|
||||
`${context}: Chat completion response was a string and not valid JSON (${(e as Error).message})`,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
if (!response || typeof response !== 'object' || !('choices' in response)) {
|
||||
const preview = JSON.stringify(response)?.slice(0, 800)
|
||||
throw new Error(`${context}: Unexpected response shape (no choices). Preview: ${preview}`)
|
||||
throw new Error(`${context}: Unexpected response shape (no choices)`)
|
||||
}
|
||||
|
||||
return response as OpenAI.Chat.Completions.ChatCompletion
|
||||
|
||||
Reference in New Issue
Block a user