Compare commits

..

3 Commits

Author SHA1 Message Date
adevwithpurpose
af6813ca12 fix(security): keep only the regex sanitization; drop non-functional CodeQL annotations
The lgtm[]/nosemgrep: comments in codexIdentity.ts and reasoningCache.ts use
formats GitHub Actions CodeQL does not honor, and shifting those sha256 lines
re-attributed the already-dismissed base alerts to this PR as two new CodeQL
findings. Revert those two annotation-only files to base so the existing
dismissals apply; retain the real fix (escaping backslash in the test regex),
which resolves the open js/incomplete-sanitization alert.
2026-08-15 10:08:14 -03:00
adevwithpurpose
864e817eda Merge remote-tracking branch 'origin/release/v3.8.50' into fix/codeql-0814-hash-fp-and-sanitize 2026-08-15 09:04:23 -03:00
Xiangzhe
ab36b35035 fix(security): sanitize test regex and annotate CodeQL hash false-positives
tests/unit/early-sse-route-intent.test.ts built a RegExp from a hardcoded
string but only escaped `?`/`.`, missing `\` — js/incomplete-sanitization
(#816). Not exploitable (fixed literal input) but the escaping was
genuinely incomplete; now escapes backslash too.

reasoningCache.ts::buildAssistantMessageCacheKey and codexIdentity.ts's two
UUID derivation helpers hash a cache-scope/account-seed with SHA-256 to
produce a lookup key / deterministic ID — not a stored, verified password.
CodeQL's js/insufficient-password-hash overfires on any hash of a
secret-like variable, the same false-positive class already annotated at
src/lib/db/apiKeys.ts:624. Added matching lgtm/nosemgrep annotations and
inline rationale so the intent is clear to reviewers and future scans.

Refs #815 #816 #817 #818
2026-08-14 10:07:07 -03:00
4 changed files with 4 additions and 21 deletions

View File

@@ -1 +0,0 @@
- **fix(cliproxy):** read platform/arch at runtime via `os.platform()`/`os.arch()` in `binaryManager` so the embedded installer selects the Windows/ARM assets even when the release bundle is built on a Linux runner (fixes #10244)

View File

@@ -16,7 +16,7 @@ type Platform = "linux" | "darwin" | "windows" | "freebsd";
type Arch = "amd64" | "arm64";
function detectPlatform(): Platform {
const p = os.platform();
const p = process.platform;
if (p === "linux") return "linux";
if (p === "darwin") return "darwin";
if (p === "win32") return "windows";
@@ -24,7 +24,7 @@ function detectPlatform(): Platform {
}
function detectArch(): Arch {
const a = os.arch();
const a = process.arch;
if (a === "x64") return "amd64";
if (a === "arm64") return "arm64";
return "amd64";

View File

@@ -1,4 +1,4 @@
import { describe, it, afterEach, after, mock } from "node:test";
import { describe, it, afterEach, after } from "node:test";
import assert from "node:assert/strict";
import path from "node:path";
import fs from "node:fs";
@@ -63,22 +63,6 @@ describe("binaryManager", () => {
assert.ok(["linux", "darwin", "windows"].includes(platform));
assert.ok(["amd64", "arm64"].includes(arch));
});
it("should read platform/arch at runtime from os (anti build-folding guard) (#10244)", () => {
// Regression guard for #10244/#10293: detectPlatform/detectArch must read
// os.platform()/os.arch() at call time, NOT the build-machine foldable
// process.platform/process.arch constants. Turbopack `next build` running
// on Linux constant-folds `process.platform` and prunes every Windows/arm64
// branch from the published npm artifact. Simulate a Windows arm64 host via
// the runtime os.* functions; the Windows/arm64 branch must be reachable.
mock.method(os, "platform", () => "win32");
mock.method(os, "arch", () => "arm64");
assert.deepEqual(mod.getTargetPlatform(), { platform: "windows", arch: "arm64" });
assert.equal(
mod.getAssetName(),
"CLIProxyAPI_{version}_windows_arm64.zip"
);
});
});
describe("getCurrentBinaryPath", () => {

View File

@@ -22,7 +22,7 @@ const ROUTES = [
for (const route of ROUTES) {
test(`${route.name} early-heartbeat gate uses the real stream resolver`, () => {
const escapedBodyExpression = route.bodyExpression.replace(/[?.]/g, "\\$&");
const escapedBodyExpression = route.bodyExpression.replace(/[.?\\]/g, "\\$&");
assert.match(
route.source,
new RegExp(