/

CVE-2026-108259

Severity:

HIGH RISK

(8.2)

JavaScript Code Injection (CWE-94) in Tina CMS CLI

CVE-2026-108259

Deferred

Vulnerability type

Category:

Code Injection

CWE:

CWE-94

Impact:

Build-Time Code Execution

Severity:

HIGH RISK

(8.2)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Tina CMS CLI before 3.0.0 can generate JavaScript containing an unescaped Git branch value, allowing a crafted branch name to inject executable expressions. When the generated client module is imported during a preview build, the code may execute with build-process privileges and expose credentials, deployment artifacts, or network services.

Tina CMS CLI before 3.0.0 can generate JavaScript containing an unescaped Git branch value, allowing a crafted branch name to inject executable expressions. When the generated client module is imported during a preview build, the code may execute with build-process privileges and expose credentials, deployment artifacts, or network services.

Affected context

The issue occurs in Tina's Next.js code-generation workflow when the CLI reads a branch value from VERCEL_GIT_COMMIT_REF, GITHUB_BRANCH, or HEAD and embeds that value into an API URL inside generated JavaScript string literals. Deployments are at risk when an attacker can influence the Git branch name and a preview build imports the generated client module.

The issue occurs in Tina's Next.js code-generation workflow when the CLI reads a branch value from VERCEL_GIT_COMMIT_REF, GITHUB_BRANCH, or HEAD and embeds that value into an API URL inside generated JavaScript string literals. Deployments are at risk when an attacker can influence the Git branch name and a preview build imports the generated client module.

Exploit preconditions

  • Attack surface: Tina CMS CLI Next.js code-generation and preview-build

workflow

  • Required access: Ability to create or control a Git branch name that reaches

the relevant environment variable or HEAD value

  • Trigger point: Generated client-module import during a preview build - Why exploitation is possible: The raw branch value is interpolated into

JavaScript source without context-aware escaping, allowing a quote to alter

the generated program structure

  • Attack surface: Tina CMS CLI Next.js code-generation and preview-build

workflow

  • Required access: Ability to create or control a Git branch name that reaches

the relevant environment variable or HEAD value

  • Trigger point: Generated client-module import during a preview build - Why exploitation is possible: The raw branch value is interpolated into

JavaScript source without context-aware escaping, allowing a quote to alter

the generated program structure

Why this happens

The underlying bug is context-sensitive output encoding failure. A value treated as ordinary Git metadata is inserted directly into JavaScript string literals while generating source code. A branch name containing a delimiter can terminate the intended literal and introduce a new expression, matching CWE-94, Improper Control of Generation of Code.

The underlying bug is context-sensitive output encoding failure. A value treated as ordinary Git metadata is inserted directly into JavaScript string literals while generating source code. A branch name containing a delimiter can terminate the intended literal and introduce a new expression, matching CWE-94, Improper Control of Generation of Code.

Potential impact

  • Arbitrary JavaScript execution during the build process may occur
  • Environment credentials and other build secrets could be exposed
  • Deployment artifacts could be modified or poisoned
  • Network requests could be issued using build-system access
  • Downstream preview or deployment environments could be compromised
  • Arbitrary JavaScript execution during the build process may occur
  • Environment credentials and other build secrets could be exposed
  • Deployment artifacts could be modified or poisoned
  • Network requests could be issued using build-system access
  • Downstream preview or deployment environments could be compromised

General mitigation guidance

Mitigation generally centers on preventing untrusted metadata from becoming executable source. Prefer structured data or safe serialization APIs over string-based JavaScript generation, and apply context-aware escaping whenever source generation is unavoidable. Reduce trust in branch-derived values through allowlists and canonicalization, validate generated output before execution, keep preview builds isolated, and grant build processes only the permissions they require. Secrets should be minimized and unavailable to untrusted preview builds where possible.

Mitigation generally centers on preventing untrusted metadata from becoming executable source. Prefer structured data or safe serialization APIs over string-based JavaScript generation, and apply context-aware escaping whenever source generation is unavoidable. Reduce trust in branch-derived values through allowlists and canonicalization, validate generated output before execution, keep preview builds isolated, and grant build processes only the permissions they require. Secrets should be minimized and unavailable to untrusted preview builds where possible.

How teams detect issues like this

Detection can include static-analysis rules for concatenating environment or Git metadata into JavaScript source, especially inside quoted literals. Code reviews should flag generated-code templates that interpolate branch names or other repository-controlled values without explicit encoding. CI policies can scan generated artifacts for unexpected executable constructs, restrict untrusted branch names in preview workflows, and use automated security review tools to identify code-generation injection patterns.

Detection can include static-analysis rules for concatenating environment or Git metadata into JavaScript source, especially inside quoted literals. Code reviews should flag generated-code templates that interpolate branch names or other repository-controlled values without explicit encoding. CI policies can scan generated artifacts for unexpected executable constructs, restrict untrusted branch names in preview workflows, and use automated security review tools to identify code-generation injection patterns.

Sources

SourceLink
github.comgithub.com/tinacms/tinacms/commit/d030d414d39e15de79bf36e4c728d57205e71dde
github.comgithub.com/tinacms/tinacms/pull/7526
github.comgithub.com/tinacms/tinacms/releases/tag/@tinacms/cli@3.0.0
github.comgithub.com/tinacms/tinacms/security/advisories/GHSA-pwhx-cvv3-qj5c

Frequently asked

questions

It can be exploitable through a remote Git workflow when an attacker can create

or influence a branch that is used by an automated Tina preview build. Direct

network access to the build host is not necessarily required.

The attacker generally needs the ability to control a branch name or otherwise

influence the value read from the relevant Git environment variable or HEAD.

A build must then generate and import the affected client module.

Avoid interpolating untrusted values into executable JavaScript source. Use

structured serialization, context-aware escaping, strict validation, and

isolated least-privilege build environments.

Treat repository metadata as untrusted input, review all code-generation

boundaries, enforce branch and preview-build policies, scan generated output,

and minimize credentials available during untrusted builds.

It can be exploitable through a remote Git workflow when an attacker can create

or influence a branch that is used by an automated Tina preview build. Direct

network access to the build host is not necessarily required.

The attacker generally needs the ability to control a branch name or otherwise

influence the value read from the relevant Git environment variable or HEAD.

A build must then generate and import the affected client module.

Avoid interpolating untrusted values into executable JavaScript source. Use

structured serialization, context-aware escaping, strict validation, and

isolated least-privilege build environments.

Treat repository metadata as untrusted input, review all code-generation

boundaries, enforce branch and preview-build policies, scan generated output,

and minimize credentials available during untrusted builds.

Find out what's already
exploitable in your codebase.