fix: address code scanning alerts (#434)
* fix: address code scanning alerts Parse Gemini hostnames instead of matching raw URL substrings, redact gRPC error logs, and harden the Finder drag-drop test escape helper so the flagged paths are fixed without regressing working behavior. * Potential fix for pull request finding 'CodeQL / Clear-text logging of sensitive information' Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> * fix: restore safe grpc error summaries A later autofix commit removed the exported gRPC error summarizer while the new regression test still imported it. Restore the safe name/code-only summary so CI stays green without reintroducing clear-text logging. * fix: keep grpc logging generic Remove the stale helper/test pair and keep the gRPC startup and stream logs free of error-derived data so the CodeQL clear-text logging alert stays closed while the rest of the security fixes remain intact. --------- Co-authored-by: OpenClaude Worker 3 <worker-3@openclaude.local> Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
This commit is contained in:
@@ -261,6 +261,58 @@ test('preserves Gemini tool call extra_content in follow-up requests', async ()
|
||||
})
|
||||
})
|
||||
|
||||
test('does not infer Gemini mode from OPENAI_BASE_URL path substrings', async () => {
|
||||
let capturedAuthorization: string | null = null
|
||||
|
||||
process.env.OPENAI_BASE_URL =
|
||||
'https://evil.example/generativelanguage.googleapis.com/v1beta/openai'
|
||||
delete process.env.OPENAI_API_KEY
|
||||
process.env.GEMINI_API_KEY = 'gemini-secret'
|
||||
|
||||
globalThis.fetch = (async (_input, init) => {
|
||||
const headers = init?.headers as Record<string, string> | undefined
|
||||
capturedAuthorization =
|
||||
headers?.Authorization ?? headers?.authorization ?? null
|
||||
|
||||
return new Response(
|
||||
JSON.stringify({
|
||||
id: 'chatcmpl-1',
|
||||
model: 'fake-model',
|
||||
choices: [
|
||||
{
|
||||
message: {
|
||||
role: 'assistant',
|
||||
content: 'ok',
|
||||
},
|
||||
finish_reason: 'stop',
|
||||
},
|
||||
],
|
||||
usage: {
|
||||
prompt_tokens: 12,
|
||||
completion_tokens: 4,
|
||||
total_tokens: 16,
|
||||
},
|
||||
}),
|
||||
{
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
},
|
||||
)
|
||||
}) as FetchType
|
||||
|
||||
const client = createOpenAIShimClient({}) as OpenAIShimClient
|
||||
|
||||
await client.beta.messages.create({
|
||||
model: 'fake-model',
|
||||
messages: [{ role: 'user', content: 'hello' }],
|
||||
max_tokens: 64,
|
||||
stream: false,
|
||||
})
|
||||
|
||||
expect(capturedAuthorization).toBeNull()
|
||||
})
|
||||
|
||||
test('preserves image tool results as placeholders in follow-up requests', async () => {
|
||||
let requestBody: Record<string, unknown> | undefined
|
||||
|
||||
|
||||
Reference in New Issue
Block a user