fix: scope 2026.3.8 patch to redaction crash

This commit is contained in:
Jarvis 2026-03-10 20:37:41 +08:00
parent 7e4e9d3371
commit 4c740f7dd3
3 changed files with 13 additions and 11 deletions

View File

@ -67,13 +67,19 @@ describe("replaceSensitiveValuesInRaw", () => {
}); });
it("handles non-string raw input gracefully", () => { it("handles non-string raw input gracefully", () => {
const result = replaceSensitiveValuesInRaw({ const nullResult = replaceSensitiveValuesInRaw({
raw: null as unknown as string, raw: null as unknown as string,
sensitiveValues: ["test"], sensitiveValues: ["test"],
redactedSentinel: "***", redactedSentinel: "***",
}); });
// String(null) returns "null", but our defensive code returns empty string const objectResult = replaceSensitiveValuesInRaw({
expect(result).toBe(""); raw: { secret: "test" } as unknown as string,
sensitiveValues: ["test"],
redactedSentinel: "***",
});
expect(nullResult).toBe("");
expect(objectResult).toBe("");
}); });
it("handles unicode strings", () => { it("handles unicode strings", () => {

View File

@ -5,9 +5,8 @@ import JSON5 from "json5";
* Redacts sensitive values from a raw config string. * Redacts sensitive values from a raw config string.
* Filters out empty/null/undefined values to prevent RangeError (#41247). * Filters out empty/null/undefined values to prevent RangeError (#41247).
* *
* Note: When `params.raw` is not a string (e.g., null, number), it is * Note: When `params.raw` is not a string, this returns an empty string
* converted to a string via `String(params.raw ?? "")` and returned * defensively instead of returning a stringified unredacted value.
* without redaction. This is a silent fallback for invalid input.
*/ */
export function replaceSensitiveValuesInRaw(params: { export function replaceSensitiveValuesInRaw(params: {
raw: string; raw: string;
@ -16,7 +15,7 @@ export function replaceSensitiveValuesInRaw(params: {
}): string { }): string {
// Defensive: validate input types // Defensive: validate input types
if (typeof params.raw !== "string") { if (typeof params.raw !== "string") {
return String(params.raw ?? ""); return "";
} }
// Defensive: normalize and filter sensitive values // Defensive: normalize and filter sensitive values

View File

@ -292,10 +292,7 @@ export function buildGatewayCronService(params: {
abortSignal, abortSignal,
agentId, agentId,
sessionKey: `cron:${job.id}`, sessionKey: `cron:${job.id}`,
// FIX #41266: Use subagent lane to avoid deadlock with cron lane lane: "cron",
// The outer enqueueRun already holds CommandLane.Cron; using "cron"
// here would cause deadlock since cron lane has concurrency=1.
lane: "subagent",
}); });
}, },
sendCronFailureAlert: async ({ job, text, channel, to, mode, accountId }) => { sendCronFailureAlert: async ({ job, text, channel, to, mode, accountId }) => {