/

CVE-2026-54074

Severity:

HIGH RISK

(7.8)

Code Injection (CWE-94) in Tina CLI migration utility

CVE-2026-54074

Deferred

Vulnerability type

Category:

Code Injection

CWE:

CWE-94

Impact:

Remote Code Execution in developer environment

Severity:

HIGH RISK

(7.8)

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

A code injection flaw in the Tina CLI Forestry-to-Tina migration command allows attacker-controlled project metadata to be transformed into executable JavaScript or TypeScript.

When a developer runs the migration and then executes tinacms dev or tinacms build, injected code in generated template files may run with the developer's local privileges.

Affected context

This vulnerability affects development environments where Tina's CLI is used to migrate from Forestry-style projects to Tina.

It becomes relevant when the migration command processes .forestry/**/*.yml configuration files whose label or name fields can be influenced by an attacker, such as in cloned or third-party sample repositories.

The generated tina/templates.{ts,js} file incorporates these fields without sufficient sanitisation, allowing crafted values to become executable code.

Exploit preconditions

  • Attack surface: Tina CLI Forestry-to-Tina migration workflow in developer machines.
  • Required access: Ability to control or modify a Forestry-style project's .forestry/**/*.yml files (e.g., a malicious repository, template, or pull request).
  • Trigger point: A developer runs the migration command and then executes tinacms dev or tinacms build, causing the generated tina/templates.{ts,js} module to be loaded.
  • Why exploitation is possible: The helper addVariablesToCode unquotes values marked with __TINA_INTERNAL__:::(...)::: inside stringified JSON, and user-controlled label and name fields are inserted into this JSON without sanitisation, allowing arbitrary JavaScript to be emitted at module top level.

Why this happens

The underlying bug is a classic code injection issue where data originating from configuration files is treated as trusted source code during code generation.

Instead of keeping user-supplied label and name fields as inert strings, the migration logic uses a marker-based unquoting mechanism that converts them into raw JavaScript fragments inside generated templates.

This directly maps to CWE-94: Improper Control of Generation of Code, where input is incorporated into dynamically produced code without strict validation, escaping, or a safe templating boundary.

Potential impact

  • Arbitrary JavaScript/TypeScript execution on the developer's machine when running Tina CLI commands.
  • Exfiltration of sensitive local files, environment variables, or access tokens available to the developer account.
  • Installation of additional malware or backdoors in the local development environment or checked-in project files.
  • Propagation of malicious code into the project's codebase, potentially affecting downstream builds or deployments.

General mitigation guidance

Effective mitigation centers on treating all configuration-driven content as untrusted data rather than executable code.

Recommended defensive patterns include:

  • Avoid directly embedding user-controlled values into generated source code; when necessary, ensure they remain properly quoted strings.
  • Use strict encoding and escaping routines for any content interpolated into code templates, preventing it from altering surrounding syntax or introducing new statements.
  • Replace marker-based "unquoting" mechanisms with structured code generation that only permits well-typed, pre-validated values.
  • Enforce schema validation and character restrictions on configuration fields that influence code generation, limiting them to safe, expected formats.
  • Isolate code generation and subsequent build steps in least-privileged, sandboxed environments to reduce the impact of unexpected execution.

How teams detect issues like this

Detection typically combines source-level review and automated analysis of code generation flows:

  • Use static analysis or linters to identify patterns where configuration values or stringified JSON segments are injected into templates without escaping or are deliberately unquoted into code.
  • During code review, scrutinize utilities that transform configuration into source code, especially helpers that manipulate strings with regex-based markers or custom templating logic.
  • Implement CI policies that flag newly generated files containing suspicious patterns (e.g., unexpected function calls, imports, or markers derived from configuration fields).
  • Employ supply-chain security tools that scan project templates and starter repositories for embedded dynamic code paths that depend on user-controlled metadata.

Sources

SourceLink
github.comgithub.com/tinacms/tinacms/security/advisories/GHSA-4936-9hrh-qqpw

Frequently asked

questions

It is primarily exploitable through the supply chain: an attacker provides or modifies a Forestry-style project that a developer then clones and migrates using Tina CLI.

The code runs locally when the developer executes Tina commands, rather than through a traditional remote network request.

An attacker must be able to influence the .forestry/**/*.yml configuration files, such as by distributing a malicious starter project, contributing a crafted configuration via pull request, or compromising a repository that developers trust and later migrate.

The broad fix is to eliminate direct injection of untrusted values into generated code by ensuring all configuration-derived content is treated as data.

This typically involves escaping or encoding values, removing mechanisms that unquote or evaluate configuration, and using structured code generation APIs instead of ad-hoc string concatenation.

Design code generators so that templates contain only fixed code structures and user content is inserted as strictly typed, escaped data.

Combine this with schema validation for configuration files, automated tests that assert generated code remains syntactically and semantically safe, and security reviews focused specifically on template rendering and code generation paths.

Find out what's already
exploitable in your codebase.