Open-source AI coworkers that each get a computer of their own: a browser, files and tools, with every action decided before it happens and recorded after. Bring any AG-UI agent.
fix(telemetry): keep mysql's -P port and redact the real -p password (fixes #815) (#819)
Charan Rathoree76c6863ede1
diff --git a/server/src/telemetry/scrub.ts b/server/src/telemetry/scrub.tsindex 731b4b84..2b7dac5a 100644--- a/server/src/telemetry/scrub.ts+++ b/server/src/telemetry/scrub.ts@@ -57,7 +57,7 @@ const RULES: [RegExp, (match: string, ...groups: string[]) => string][] = [// `-psecret` for mysql and friends. Nothing separates them: a space means the password is asked for// at the prompt and the word after `-p` is the database, so only the attached form is redacted.[- /(\bmysql(?:dump)?\b(?:[^|;&\\\r\n]|\\[\s\S])*?(?:[ \t]|\\\r?\n)-p)("[^"]*"|'[^']*'|[^\s'"-]\S*)/gi,+ /(\bmysql(?:dump)?\b(?:[^|;&\\\r\n]|\\[\s\S])*?(?:[ \t]|\\\r?\n)-p)("[^"]*"|'[^']*'|[^\s'"-]\S*)/g,(_m, lead) => `${lead}${REDACTED}`,],// `docker login -p secret`, where `-p` is the password rather than a port.diff --git a/server/tests/enterprise-controls.test.ts b/server/tests/enterprise-controls.test.tsindex d1da9ce0..23927b95 100644--- a/server/tests/enterprise-controls.test.ts+++ b/server/tests/enterprise-controls.test.ts@@ -359,6 +359,11 @@ describe("scrubbing commands", () => {"psql postgres://app:[REDACTED]@db:5432/app",],["mysql -uroot -phunter2 app", "mysql -uroot -p[REDACTED] app"],+ // `-P` is mysql's port, not its password: the attached port must survive and the real+ // password later in the same command must still be redacted (gh-815).+ ["mysql -h db -P3306 -phunter2 app", "mysql -h db -P3306 -p[REDACTED] app"],+ ["mysql -uroot -p3306 app", "mysql -uroot -p[REDACTED] app"],+ ["mysqldump -phunter2 db", "mysqldump -p[REDACTED] db"],["tool --password hunter2 --verbose","tool --password [REDACTED] --verbose",