Skip to content

Commit 78f92a4

Browse files
author
ralphstodomingo
committed
fix: legacy Documents and Settings home roots, 14-char extension window
- the legacy Windows profile root joins Users in windowsHome, so 'C:\Documents and Settings\Jane Doe' gets the high-PII tail - PM_EXT window raised 8 -> 14 chars (.properties, .configuration are real extensions); both proof and prose-suppression directions covered by tests
1 parent 454cb28 commit 78f92a4

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

packages/opencode/src/altimate/telemetry/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ const PM_R = "(?:[^\\s\\/\\\\'\"`]|'(?=[\\p{L}\\p{N}_]))"
7272
const PM_R_P = "(?:[^\\s\\/'\"`]|'(?=[\\p{L}\\p{N}_]))"
7373
const PM_WORD = "(?:[\\p{L}\\p{M}\\p{N}_‘’-]|'(?=[\\p{L}\\p{N}_]))"
7474
const PM_ANCHOR = "(^|[\\s\"'`=(,[{:;<|])"
75-
const PM_EXT = "\\.[A-Za-z0-9]{1,8}"
75+
const PM_EXT = "\\.[A-Za-z0-9]{1,14}"
7676
// span char: path content incl. delimiters (, ; ) ] } >) that a later
7777
// separator — or an attached dotted terminal filename (;draft.sql) —
7878
// proves is path content — multi-word spaced runs allowed, all
@@ -98,7 +98,7 @@ const PM_TERM_UNC =
9898
const pmTail = (sep: string, term: string) => pmSpan(sep) + "*" + pmChunks(sep) + pmSpFile(sep) + term
9999
const PATH_RULES = {
100100
cloud: new RegExp(PM_ANCHOR + "(?:(?:" + [pmCI("gs"), pmCI("s3") + "[anAN]?", pmCI("abfs") + "[sS]?", pmCI("wasb") + "[sS]?", pmCI("adl"), pmCI("dbfs"), pmCI("hdfs")].join("|") + "):\\/\\/|" + pmCI("file") + ":\\/{1,3})" + pmTail(SEP_P, PM_TERM_UNC), "gu"),
101-
windowsHome: new RegExp(PM_ANCHOR + "(?:(?:\\\\\\\\\\?\\\\)?[A-Za-z]:" + SEP_W + "?|\\\\\\\\(?:\\?\\\\" + pmCI("unc") + "\\\\)?(?:" + PM_R + "+(?: {1,2}" + PM_R + "+)*" + SEP_W + ")*|" + SEP_W + ")" + pmCI("users") + SEP_W + pmTail(SEP_W, PM_TERM_UNC), "gu"),
101+
windowsHome: new RegExp(PM_ANCHOR + "(?:(?:\\\\\\\\\\?\\\\)?[A-Za-z]:" + SEP_W + "?|\\\\\\\\(?:\\?\\\\" + pmCI("unc") + "\\\\)?(?:" + PM_R + "+(?: {1,2}" + PM_R + "+)*" + SEP_W + ")*|" + SEP_W + ")(?:" + pmCI("users") + "|" + pmCI("documents") + " " + pmCI("and") + " " + pmCI("settings") + ")" + SEP_W + pmTail(SEP_W, PM_TERM_UNC), "gu"),
102102
windows: new RegExp(PM_ANCHOR + "(?:[A-Za-z]:" + SEP_W + "|[A-Za-z]:(?=" + PM_R + "+(?: {1,2}" + PM_R + "+)*\\\\|[\\p{L}_][\\p{L}\\p{N}_-]*\\/)|\\\\\\\\|\\.{1,2}\\\\(?=" + PM_R + "+(?: {1,2}" + PM_R + "+)*\\\\)|\\\\(?=(?:[\\p{L}\\p{N}_#@().'-]{2,}(?: {1,2}[\\p{L}\\p{N}_#@().'-]+)*\\\\){2}|[\\p{L}\\p{N}_#@().'-]{2,}(?: {1,2}[\\p{L}\\p{N}_#@().'-]+)*\\\\[^\\s\\\\]{1,256}" + PM_EXT + "(?=$|[\\s.,;:)\\]}!?])|[\\p{L}\\p{N}_#@().'-]{2,}(?: {1,2}[\\p{L}\\p{N}_#@().'-]+)+\\\\[\\p{L}\\p{N}]))" + pmSpan(SEP_W) + "+" + pmChunks(SEP_W) + pmSpFile(SEP_W) + PM_TERM_COND, "gu"),
103103
posixHome: new RegExp(PM_ANCHOR + "\\/(?:" + PM_R_P + "+(?: {1,2}" + PM_R_P + "+)*\\/)*(?:" + pmCI("users") + "|" + pmCI("home") + ")\\/" + pmTail(SEP_P, PM_TERM_UNC), "gu"),
104104
posix: new RegExp(PM_ANCHOR + "(?:\\.{0,2}\\/(?:" + PM_R_P + "+(?: {1,2}" + PM_R_P + "+)*\\/)+" + pmTail(SEP_P, PM_TERM_COND) + "|\\.{1,2}\\/" + pmSpan(SEP_P) + "+" + pmSpFile(SEP_P) + "(?<=" + PM_EXT + ")(?=$|[\\s.,;:)\\]}!?]))", "gu"),

packages/opencode/test/telemetry/mask-file-paths.test.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -585,3 +585,17 @@ describe("maskString paths — fleet round 16 (case folding out of the tail gate
585585
expect(mask(String.raw`stat \\?\unc\srv\share\Users\Jane Doe gone`)).toBe("stat <path> gone")
586586
})
587587
})
588+
589+
describe("maskString paths — fleet round 17 (legacy home roots, longer extensions)", () => {
590+
it("legacy Documents and Settings roots get home treatment", () => {
591+
expect(mask(String.raw`stat C:\Documents and Settings\Jane Doe does not exist`))
592+
.toBe("stat <path> does not exist")
593+
})
594+
595+
it("extensions up to 14 chars count as proof and as prose guards", () => {
596+
expect(mask("read ./customer_secret.properties failed")).toBe("read <path> failed")
597+
expect(mask("read ../private.configuration now")).toBe("read <path> now")
598+
// the suppression direction: prose after a long-extension file survives
599+
expect(mask("/Users/jdoe/app.properties was deleted")).toBe("<path> was deleted")
600+
})
601+
})

0 commit comments

Comments
 (0)