mirror of
https://github.com/tiennm99/ccs.git
synced 2026-09-02 14:19:56 +00:00
fix(cliproxy): disable spoofable default bg keepalive probe (#1340)
This commit is contained in:
@@ -275,12 +275,13 @@ export function setupCleanupHandlers(
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const backgroundProbe =
|
// Security hardening: only allow keepalive when caller provides an explicit,
|
||||||
keepAliveOptions.hasBackgroundWorkerUsingBaseUrl ?? hasClaudeBackgroundWorkerUsingBaseUrl;
|
// trusted detector. Falling back to global process-list probing is spoofable.
|
||||||
|
const backgroundProbe = keepAliveOptions.hasBackgroundWorkerUsingBaseUrl;
|
||||||
|
|
||||||
const startKeepAliveWatcher = (baseUrl: string) => {
|
const startKeepAliveWatcher = (baseUrl: string) => {
|
||||||
const timer = setInterval(() => {
|
const timer = setInterval(() => {
|
||||||
if (backgroundProbe(baseUrl)) return;
|
if (backgroundProbe?.(baseUrl)) return;
|
||||||
log('No Claude bg worker is using the session proxy; cleaning up');
|
log('No Claude bg worker is using the session proxy; cleaning up');
|
||||||
stopSessionResources();
|
stopSessionResources();
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
@@ -299,6 +300,7 @@ export function setupCleanupHandlers(
|
|||||||
const backgroundKeepAliveBaseUrl = keepAliveOptions.backgroundKeepAliveBaseUrl;
|
const backgroundKeepAliveBaseUrl = keepAliveOptions.backgroundKeepAliveBaseUrl;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
backgroundProbe &&
|
||||||
shouldKeepSessionProxiesAlive({
|
shouldKeepSessionProxiesAlive({
|
||||||
code,
|
code,
|
||||||
signal,
|
signal,
|
||||||
|
|||||||
Reference in New Issue
Block a user