Skip to content

Commit af9b026

Browse files
committed
fix(qa): preserve cli flag redaction
1 parent 6a23a72 commit af9b026

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

‎extensions/qa-lab/src/gateway-child.test.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1087,6 +1087,7 @@ describe("buildQaRuntimeEnv", () => {
10871087
"OPENCLAW_QA_CONVEX_SECRET_MAINTAINER=convex-maintainer-secret",
10881088
"OPENCLAW_LIVE_CODEX_API_KEY=codex-live-secret",
10891089
"botToken=12345:AbCdEfGhIjKl",
1090+
"--botToken=12345:flag-secret",
10901091
'"driverToken":"12345:driver-secr3t"',
10911092
"sutToken='12345:sut-secr3t'",
10921093
"leaseToken=lease-12345",
@@ -1131,6 +1132,7 @@ describe("buildQaRuntimeEnv", () => {
11311132
"OPENCLAW_QA_CONVEX_SECRET_MAINTAINER=<redacted>",
11321133
"OPENCLAW_LIVE_CODEX_API_KEY=<redacted>",
11331134
"botToken=<redacted>",
1135+
"--botToken=<redacted>",
11341136
'"driverToken":"<redacted>"',
11351137
"sutToken=<redacted>",
11361138
"leaseToken=<redacted>",

‎extensions/qa-lab/src/gateway-log-redaction.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ function redactSecretValueKey(text: string, key: string) {
5454
const escapedKey = escapeRegExp(key);
5555
return text
5656
.replace(new RegExp(`([?#&]${escapedKey}=)[^&\\s]+`, "gi"), "$1<redacted>")
57+
.replace(
58+
new RegExp(`(^|\\s)(--${escapedKey})(\\s*[=:]\\s*)([^\\s"';,]+|"[^"]*"|'[^']*')`, "gi"),
59+
`$1$2$3<redacted>`,
60+
)
5761
.replace(
5862
new RegExp(`(^|[^\\w?#&-])(${escapedKey})(\\s*[=:]\\s*)([^\\s"';,]+|"[^"]*"|'[^']*')`, "gi"),
5963
`$1$2$3<redacted>`,

0 commit comments

Comments
 (0)