The vulnerability lies in the tinacms backend, specifically within the @tinacms/graphql package. The root cause is the insecure use of the gray-matter library for parsing markdown files. By default, gray-matter executes Javascript code found in the frontmatter of a file if it is marked with a js language identifier. An attacker could craft a markdown file with a malicious Javascript payload in the frontmatter. When the tinacms backend processes this file using the parseFile function, the malicious code would be executed on the server, leading to Remote Code Execution (RCE).
The patch addresses this vulnerability in packages/@tinacms/graphql/src/database/util.ts by explicitly disabling the Javascript and Coffeescript engines in gray-matter. This is achieved by passing a custom engines configuration to the matter() call inside the parseFile function. The custom configuration overrides the default parsers for js, javascript, coffee, and coffeescript to simply throw an error instead of executing any code. The stringifyFile function was also updated to prevent the creation of files with these insecure frontmatter types. The primary vulnerable function that would be seen in a stack trace during exploitation is parseFile.