Caption transcript extraction silently returns an empty transcript for some valid JavaScript array literals.
For example, pass a composition containing this declaration to extractTranscript:
const TRANSCRIPT = [{ text: 'x ]; y', start: 0, end: 1 }];
Expected: one word with the literal text x ]; y. Actual: the extraction regex terminates at the delimiter inside the string, parsing fails, and the catch returns []. Independent review also reproduced failures for JavaScript hex escapes and certain escaped quotes in single-quoted words.
The implementation is in packages/studio/src/captions/parser.ts. Replace the delimiter/quote-normalization approach with a parser/tokenizer that accepts supported static array literals without evaluating code. Preserve existing JSON, single-quoted strings, unquoted keys, trailing commas, text, IDs and timing behavior; reject executable expressions. Add regressions for delimiters inside strings, escapes, and malformed input.
Found during the security cleanup and independently traced by miga-heygen. This is a correctness bug: parsed values reach JSON.parse/React text rendering, with no executable sink. Security alert #102 was individually classified as by design. The separate generated-script HTML boundary was fixed in #3847; that change does not fix this parser behavior.
Caption transcript extraction silently returns an empty transcript for some valid JavaScript array literals.
For example, pass a composition containing this declaration to
extractTranscript:Expected: one word with the literal text
x ]; y. Actual: the extraction regex terminates at the delimiter inside the string, parsing fails, and the catch returns[]. Independent review also reproduced failures for JavaScript hex escapes and certain escaped quotes in single-quoted words.The implementation is in
packages/studio/src/captions/parser.ts. Replace the delimiter/quote-normalization approach with a parser/tokenizer that accepts supported static array literals without evaluating code. Preserve existing JSON, single-quoted strings, unquoted keys, trailing commas, text, IDs and timing behavior; reject executable expressions. Add regressions for delimiters inside strings, escapes, and malformed input.Found during the security cleanup and independently traced by miga-heygen. This is a correctness bug: parsed values reach JSON.parse/React text rendering, with no executable sink. Security alert #102 was individually classified as by design. The separate generated-script HTML boundary was fixed in #3847; that change does not fix this parser behavior.