Oct 10, 2026·5 min read·22 visits
Unsanitized Git branch names allow remote code execution in @tinacms/cli during automated CI/CD builds and Vercel preview deployments.
@tinacms/cli prior to version 3.0.0 dynamically constructs client source files using string interpolation without properly sanitizing runtime configuration variables. An attacker with permissions to create a branch or pull request can inject arbitrary JavaScript statements via a crafted Git ref name, leading to execution during automated build processes.
The package @tinacms/cli within the tinacms/tinacms monorepo provides CLI tools and code generation functionality for TinaCMS applications. During the build phase, @tinacms/cli executes automated code generation scripts that emit a TypeScript client configuration file (client.ts). This generated file initializes the TinaCMS client with specific runtime parameters, such as the Content API endpoint URL, authorization tokens, and caching directories.
The dynamic API URL construction mechanism extracts the current Git branch reference from hosting environment variables, including VERCEL_GIT_COMMIT_REF, GITHUB_BRANCH, or the local HEAD ref. In @tinacms/cli versions prior to 3.0.0, these extracted branch names and other configuration properties were directly interpolated into single- or double-quoted string literals within the generated JavaScript source code without escaping.
Because Git reference names permit characters such as single quotes (') and double quotes ("), a remote attacker capable of submitting a pull request or pushing a branch with a specially formatted name can escape the quote boundary. When the build system compiles or executes the generated client.ts module, the injected JavaScript executes with the full privileges of the underlying Node.js runner process.
The fundamental flaw resides in packages/@tinacms/cli/src/next/codegen/index.ts and packages/@tinacms/cli/src/next/codegen/codegen/plugin.ts. The template generation logic uses template string interpolation to emit TypeScript code.
Specifically, the apiURL string is constructed using the active Git ref name. When building the configuration object for createClient, the code generator wraps apiURL, token, cacheDir, and errorPolicy inside literal quote marks:
// Unpatched snippet in index.ts
export const client = createClient({ ${
this.noClientBuildCache === false
? `cacheDir: '${normalizePath(this.configManager.generatedCachePath)}', `
: ''
}url: ${this.localContentBuild ? `process.env.TINA_LOCAL_URL || '${apiURL}'` : `'${apiURL}'`}, token: '${token}', queries, ${
errorPolicy ? `errorPolicy: '${errorPolicy}'` : ''
} });If apiURL contains a single quote, the resulting output file contains premature quote termination. For example, a branch named feature/';require('child_process').execSync('id');// evaluates into the following emitted code:
export const client = createClient({
url: 'https://content.tinajs.io/content/feature/';require('child_process').execSync('id');//',
token: '',
queries
});This constitutes CWE-94 (Improper Control of Generation of Code). The failure to treat variable inputs as literal values allows arbitrary statement injection at module loading time.
To fix the vulnerability, the maintainers modified the code generator in commit d030d414d39e15de79bf36e4c728d57205e71dde. The fix replaces raw quote interpolation with JSON.stringify() calls across all dynamic configuration options.
Below is the patch diff applied to packages/@tinacms/cli/src/next/codegen/index.ts:
@@ -369,12 +369,16 @@ export default databaseClient;
import { queries } from "./types.js";
export const client = createClient({ ${
this.noClientBuildCache === false
- ? `cacheDir: '${normalizePath(
- this.configManager.generatedCachePath
- )}', `
+ ? `cacheDir: ${JSON.stringify(
+ normalizePath(this.configManager.generatedCachePath)
+ )}, `
: ''
- }url: ${this.localContentBuild ? `process.env.TINA_LOCAL_URL || '${apiURL}'` : `'${apiURL}'`}, token: '${token}', queries, ${
- errorPolicy ? `errorPolicy: '${errorPolicy}'` : ''
+ }url: ${
+ this.localContentBuild
+ ? `process.env.TINA_LOCAL_URL || ${JSON.stringify(apiURL)}`
+ : JSON.stringify(apiURL)
+ }, token: ${JSON.stringify(String(token))}, queries, ${
+ errorPolicy ? `errorPolicy: ${JSON.stringify(String(errorPolicy))}` : ''
} });
export default client;By leveraging JSON.stringify(), all dynamic values are converted into valid JSON string literals. Any internal quotes, backslashes, or control characters are automatically escaped (e.g., " becomes \"). This ensures that the generated output is strictly parsed as a string primitive, preventing syntax escape.
> [!NOTE]
> The fix is complete for the identified code generation paths. Replacing string interpolation with explicit string serialization prevents code injection vectors across all dynamic variables in client.ts.
Exploitation relies on an automated deployment pipeline executing @tinacms/cli during branch or pull request preview builds. The attack flow follows these stages:
test';process.env.AWS_SECRET_ACCESS_KEY// or containing network exfiltration payloads.tinacms build or similar CLI commands. The CLI reads the Git ref from environment variables (VERCEL_GIT_COMMIT_REF or GITHUB_BRANCH) and emits the unsanitized string into client.ts.client.ts as part of the frontend compilation step. Node.js evaluates the top-level injected payload, executing code within the host runner.Successful exploitation leads to full arbitrary code execution within the build runner container or Virtual Machine. The vulnerability carries a CVSS 3.1 base score of 8.2 with the vector CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:H/A:N.
Primary impacts include:
The primary remediation is upgrading @tinacms/cli to version 3.0.0 or higher.
npm install @tinacms/cli@3.0.0package-lock.json, yarn.lock, or pnpm-lock.yaml) reference @tinacms/cli version 3.0.0 or later.If immediate package updates cannot be applied:
VERCEL_GIT_COMMIT_REF, GITHUB_BRANCH) in CI workflow scripts prior to invoking @tinacms/cli commands.CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:H/A:N| Product | Affected Versions | Fixed Version |
|---|---|---|
@tinacms/cli TinaCMS | < 3.0.0 | 3.0.0 |
| Attribute | Detail |
|---|---|
| CWE ID | CWE-94 (Improper Control of Generation of Code) |
| CVSSv3.1 Score | 8.2 (High) |
| CVSS Vector | CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:H/A:N |
| Attack Vector | Network |
| Exploit Status | Proof of Concept / Technical Explanation Available |
| CISA KEV Status | Not Listed |
| Affected Component | @tinacms/cli (packages/@tinacms/cli) |
| Fixed Version | 3.0.0 |
The software constructs all or part of a code segment using externally-influenced input, but it does not neutralize or incorrectly neutralizes elements that could alter the syntax or behavior of the intended code segment.
CVE-2026-126303 (GHSA-8fx7-8jr8-84rv) is an uncontrolled resource consumption vulnerability in the Natural Language Toolkit (NLTK) prior to version 3.10.4. The flaw is located in the SteppingRecursiveDescentParser.parse() method within the nltk.parse.recursivedescent module. Because the parser executes a top-down recursive descent stepping loop without enforcing an execution time deadline or step limit, processing tokens against a left-recursive, self-embedding, or ambiguous Context-Free Grammar (CFG) causes the parser to enter an infinite loop. This results in complete CPU core exhaustion and worker thread starvation, leading to an application-level denial of service.
File Browser versions prior to 2.63.17 contain an authorization and state-management flaw in the BoltDB storage backend. When an authenticated user deletes a shared directory via an HTTP request with a trailing slash (e.g., DELETE /api/resources/a/), the share cleanup routine queries the database index using the unnormalized path before stripping the trailing slash. Because canonical share paths are stored without trailing slashes (e.g., /a), the database prefix query fails to match the parent directory share record. If a directory with the same name is later recreated, the dormant public share hash automatically reactivates and exposes the new directory contents to unauthenticated users.
An uncontrolled memory allocation vulnerability exists in ag-psd versions prior to 31.0.0. When parsing Adobe Photoshop Document (PSD) files, the readPsd() function reads image dimensions and color depth directly from the file header and allocates off-heap typed arrays without validating whether the requested memory size is proportional to the input stream or bounded by operational thresholds. An unauthenticated attacker can supply a crafted 52-byte PSD payload that triggers an immediate 3.35 GB memory allocation, resulting in process termination via the operating system Out-Of-Memory (OOM) killer.
CVE-2026-126297 (GHSA-v8f3-6phw-6mh9) is an uncontrolled resource consumption and algorithmic complexity vulnerability in the Natural Language Toolkit (NLTK) prior to version 3.10.4. Located in the Semantic Role Labeling (SRL) parser within `nltk/corpus/reader/conll.py`, the flaw allows an attacker to trigger quadratic O(N^2) CPU processing overhead by providing crafted CoNLL-formatted corpus inputs containing decoy span columns or nested full-width verb spans. Applications parsing untrusted linguistic corpora can experience prolonged CPU exhaustion and application-level Denial of Service (DoS).
CVE-2026-126298 (also tracked as GHSA-r53h-rw34-8h97) is an algorithmic complexity Denial of Service (DoS) vulnerability in the Natural Language Toolkit (NLTK) Python library affecting all versions prior to 3.10.4. The vulnerability resides in the nltk.tree.transforms.chomsky_normal_form function and its corresponding public method Tree.chomsky_normal_form(). When transforming a parse tree into Chomsky Normal Form using the default right-factoring strategy, the function repeatedly invokes list.pop(0) inside a loop iterating over all children of a node. In CPython, removing the initial element of a standard list requires an O(N) memory shift operation, causing the overall binarization algorithm to degrade to O(N^2) quadratic time complexity relative to the width of a node. Furthermore, converting horizontal node width into vertical tree depth bypasses initial parsing depth bounds, triggering subsequent stack exhaustion (RecursionError) when recursive methods traverse the mutated structure. Unauthenticated remote attackers who can submit bracketed tree strings to applications invoking this transformation can exhaust single-threaded CPU resources or induce unhandled application exceptions.
An algorithmic complexity vulnerability (CWE-407) in the Natural Language Toolkit (NLTK) before version 3.10.4 allows remote unauthenticated attackers to cause a denial of service via crafted Combinatory Categorial Grammar (CCG) lexicon strings. The parser in nltk.ccg.lexicon.fromstring performs repeated immutable string slicing, concatenation, and regex tail capturing, resulting in O(n^2) CPU consumption when processing wide, flat category definitions.