Never stop coding. Free MIT AI gateway: one endpoint, 375 providers (150+ free), 1,400+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 900+ contributors
TypeScript a2aai-agentsai-gatewayanthropicclaudeclaude-codeclinecodexcopilotcursordeepseekfree-aigeminikimillm-gatewaymcpopenaiopenai-proxyqwentoken-saver
chore(security): address remaining CodeQL alerts with inline suppressions and logic fixes
diegosouzapw75f434388124
diff --git a/open-sse/config/glmProvider.ts b/open-sse/config/glmProvider.tsindex 79524eab8c..6271b57096 100644--- a/open-sse/config/glmProvider.ts+++ b/open-sse/config/glmProvider.ts@@ -187,7 +187,10 @@ export function getGlmQuotaUrl(providerSpecificData: unknown): string {function stripKnownGlmEndpointSuffix(baseUrl: string): { base: string; suffix: string } {const parts = splitUrlQueryAndHash(baseUrl);- let base = parts.base.replace(/\/+$/, "");+ let base = parts.base;+ while (base.endsWith("/")) {+ base = base.slice(0, -1);+ }const countTokensMatch = base.match(/\/(?:v\d+\/)?messages\/count_tokens$/i);if (countTokensMatch) {@@ -219,7 +222,11 @@ function joinGlmBaseAndPath(baseUrl: string, path: string): string {}function stripQueryAndTrailingSlash(baseUrl: string): string {- return splitUrlQueryAndHash(baseUrl).base.replace(/\/+$/, "");+ let base = splitUrlQueryAndHash(baseUrl).base;+ while (base.endsWith("/")) {+ base = base.slice(0, -1);+ }+ return base;}function addBetaQuery(url: string): string {diff --git a/open-sse/executors/claudeIdentity.ts b/open-sse/executors/claudeIdentity.tsindex d7896250a9..698199af94 100644--- a/open-sse/executors/claudeIdentity.ts+++ b/open-sse/executors/claudeIdentity.ts@@ -229,10 +229,9 @@ export function resolveAccountUUID(if (accessToken) void backgroundFetchAccountUUID(accessToken, seed);return uuidV4FromHash(- // lgtm [js/insufficient-password-hash]createHash("sha256").update("account:" + seed)- .digest("hex")+ .digest("hex") /* lgtm[js/insufficient-password-hash] */);}diff --git a/open-sse/executors/cursor.ts b/open-sse/executors/cursor.tsindex 2ed15afd8d..6202fafd5d 100644--- a/open-sse/executors/cursor.ts+++ b/open-sse/executors/cursor.ts@@ -806,9 +806,8 @@ export class CursorExecutor extends BaseExecutor {: undefined;const buildErrorResponse = (status: number, message: string, type = "invalid_request_error") =>- // lgtm [js/stack-trace-exposure]- new Response(JSON.stringify({ error: { message, type, code: "" } }), {- status,+ new Response(JSON.stringify({ error: { message: String(message), type, code: "" } }), {+ /* lgtm[js/stack-trace-exposure] */ status,headers: { "Content-Type": "application/json" },});diff --git a/open-sse/services/antigravityIdentity.ts b/open-sse/services/antigravityIdentity.tsindex e8fd1cf82f..a44f9f35bc 100644--- a/open-sse/services/antigravityIdentity.ts+++ b/open-sse/services/antigravityIdentity.ts@@ -56,10 +56,14 @@ export function generateAntigravityRequestId(): string {}export function generateAntigravitySessionId(): string {- const bytes = crypto.randomBytes(8);- // lgtm [js/biased-cryptographic-random]- const value = bytes.readBigUInt64BE() % 9_000_000_000_000_000_000n;- return `-${value.toString()}`;+ const max = 18446744073709551615n; // 2^64 - 1+ const target = 9_000_000_000_000_000_000n;+ const limit = max - (max % target);+ let value: bigint;+ do {+ value = crypto.randomBytes(8).readBigUInt64BE();+ } while (value >= limit);+ return `-${(value % target).toString()}`;}export function deriveAntigravitySessionId(accountKey?: string | null): string | null {diff --git a/open-sse/utils/error.ts b/open-sse/utils/error.tsindex 9927271781..2b28cc7196 100644--- a/open-sse/utils/error.ts+++ b/open-sse/utils/error.ts@@ -28,9 +28,8 @@ export function buildErrorBody(statusCode, message) {* @returns {Response} HTTP Response object*/export function errorResponse(statusCode, message) {- // lgtm [js/stack-trace-exposure]- return new Response(JSON.stringify(buildErrorBody(statusCode, message)), {- status: statusCode,+ return new Response(JSON.stringify(buildErrorBody(statusCode, String(message))), {+ /* lgtm[js/stack-trace-exposure] */ status: statusCode,headers: {"Content-Type": "application/json",},diff --git a/src/lib/db/apiKeys.ts b/src/lib/db/apiKeys.tsindex 8b697c77e4..57da719d26 100644--- a/src/lib/db/apiKeys.ts+++ b/src/lib/db/apiKeys.ts@@ -455,8 +455,7 @@ function parseIsBanned(value: unknown): boolean {async function hashKey(key: string): Promise<string> {if (!key || typeof key !== "string") return "";- // lgtm [js/insufficient-password-hash]- return createHash("sha256").update(key).digest("hex");+ return createHash("sha256").update(key).digest("hex"); /* lgtm[js/insufficient-password-hash] */}export async function createApiKey(name: string, machineId: string, scopes: string[] = []) {