@hyperframes/core 0.8.216 → 0.8.218

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,12 +10,6 @@ export function redactUrlQueryStrings(value) {
10
10
  .replace(/\b(https?:\/\/[^\s?]+)\?[^\s]*/g, "$1?…")
11
11
  .replace(/((?:X-(?:Amz|Goog)-[\w-]*|Signature)=)[^&\s]*/gi, "$1…");
12
12
  }
13
- /**
14
- * Path characters we treat as part of a single segment. Space is deliberately
15
- * excluded: including it would let a match run past the path and swallow the
16
- * prose after it, and a path with a space still gets its remaining segments
17
- * redacted, which is the part that carries the identifying information.
18
- */
19
13
  /**
20
14
  * A path segment is defined by what ENDS it, not by an alphabet.
21
15
  *
@@ -31,6 +25,9 @@ export function redactUrlQueryStrings(value) {
31
25
  * run past the path and swallow the prose after it.
32
26
  */
33
27
  const SEGMENT = String.raw `[^\s/\\'"]+`;
28
+ /** A folder that another separator follows may hold spaces (`My Drive`, `내 드라이브`, `OneDrive - Contoso`); only
29
+ * the last segment stops at a space, so prose after a path survives. Line breaks still end it. */
30
+ const FOLDER = String.raw `${SEGMENT}(?:[^\S\r\n]+(?![A-Za-z]:[\\/])${SEGMENT})*(?=[\\/])`;
34
31
  /** Same, minus the dot, so a trailing `.ext` can be matched separately. */
35
32
  const SEGMENT_NODOT = String.raw `[^\s/\\'".]+`;
36
33
  /**
@@ -54,10 +51,12 @@ const TOKEN_TAIL = String.raw `[^\s'")]*`;
54
51
  * position inside a URL can start a match. URLs are handled above, where the
55
52
  * host is kept and only the query is dropped.
56
53
  */
57
- const ABSOLUTE_PATH = new RegExp(String.raw `(?<![:\w/\\])(?:[A-Za-z]:)?(?:[\\/]${SEGMENT}){2,}${TOKEN_TAIL}`, "g");
54
+ const ABSOLUTE_PATH = new RegExp(
55
+ // A Windows share (`\\server\share`) starts with two separators; the first is taken as its root.
56
+ String.raw `(?<![:\w\p{L}\p{N}\p{M}/\\])(?:[A-Za-z]:|\\(?=\\[^\s\\/]))?(?:[\\/]${FOLDER})+[\\/]${SEGMENT}${TOKEN_TAIL}`, "gu");
58
57
  /** `./assets/bgm.mp3`, `../out.wav`, `.\tmp\x` — relative paths leak the same
59
58
  * project structure absolute ones do, and were previously untouched. */
60
- const RELATIVE_PATH = new RegExp(String.raw `(?<![\w/\\.])\.{1,2}(?:[\\/]${SEGMENT})+${TOKEN_TAIL}`, "g");
59
+ const RELATIVE_PATH = new RegExp(String.raw `(?<![\w/\\.])\.{1,2}(?:[\\/]${FOLDER})*[\\/]${SEGMENT}${TOKEN_TAIL}`, "g");
61
60
  /**
62
61
  * A bare basename with an asset extension. ffprobe reports the input by the
63
62
  * name it was given, so a caller that passes a basename (or a path this
@@ -82,6 +81,8 @@ const BARE_RELATIVE_PATH = new RegExp([
82
81
  // Two or more separators: `customer/acme/video.mp4`. No extension needed —
83
82
  // that much structure is already a path.
84
83
  String.raw `(?<![^\s'\"(=,\[])(?:${SEGMENT}[\\/]){2,}${SEGMENT}${TOKEN_TAIL}`,
84
+ // Spaced folders only before a file name with an extension, so ffprobe's `N/A, … bitrate: N/A` is not a path.
85
+ String.raw `(?<![^\s'\"(=,\[])${SEGMENT}[\\/](?:${FOLDER}[\\/]){1,8}${SEGMENT_NODOT}\.\w{1,8}\b${TOKEN_TAIL}`,
85
86
  // One separator, but the last segment carries a file extension:
86
87
  // `assets/bgm.mp3`. That segment is dot-free on purpose — SEGMENT includes
87
88
  // `.`, so a greedy one swallows the extension this rule needs.
@@ -122,10 +123,10 @@ function redactFilePaths(value) {
122
123
  // (`/assets/x.mp3`), so the absolute rule would consume it and leave the
123
124
  // leading `.` stranded outside the redaction.
124
125
  .replace(RELATIVE_PATH, "[path]")
125
- // Bare-relative BEFORE absolute: a bare path's interior satisfies the
126
- // absolute rule, which would claim it and strand the first segment.
127
- .replace(BARE_RELATIVE_PATH, "[path]")
126
+ // Absolute BEFORE bare-relative: the folders after a space in `/Users/kim/My Drive/x.mp4` look like a bare path
127
+ // on their own, and claiming them first would strand the start of the absolute one.
128
128
  .replace(ABSOLUTE_PATH, "[path]")
129
+ .replace(BARE_RELATIVE_PATH, "[path]")
129
130
  .replace(ASSET_BASENAME, "[file]"));
130
131
  }
131
132
  export function redactTelemetryString(value, maxLength = MAX_TELEMETRY_STRING_LENGTH) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperframes/core",
3
- "version": "0.8.216",
3
+ "version": "0.8.218",
4
4
  "description": "",
5
5
  "repository": {
6
6
  "type": "git",
@@ -429,9 +429,9 @@
429
429
  "linkedom": "^0.18.12",
430
430
  "postcss": "^8.5.8",
431
431
  "wawoff2": "^2.0.1",
432
- "@hyperframes/lint": "0.8.216",
433
- "@hyperframes/parsers": "0.8.216",
434
- "@hyperframes/studio-server": "0.8.216"
432
+ "@hyperframes/lint": "0.8.218",
433
+ "@hyperframes/studio-server": "0.8.218",
434
+ "@hyperframes/parsers": "0.8.218"
435
435
  },
436
436
  "devDependencies": {
437
437
  "@fontsource/archivo-black": "^5.2.8",