chore(deps): update dependency typeorm to v0.3.31 [security] - #101
Open
renovate[bot] wants to merge 1 commit into
Open
chore(deps): update dependency typeorm to v0.3.31 [security]#101renovate[bot] wants to merge 1 commit into
renovate[bot] wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
0.3.30→0.3.31TypeORM: migration:generate template-literal code injection
CVE-2026-73651 / GHSA-2rp8-mm9q-fp49
More information
Details
Summary
typeorm migration:generateembeds database schema metadata into JS/TS template literals, escaping backticks but not${...}. An attacker who can write schema metadata (column comments, defaults, view definitions) achieves arbitrary code execution on the host that loads the generated migration.Details
MigrationGenerateCommand.ts(L117-138) wraps each SQL statement in a JS template literal, escaping only backticks:Introspected schema strings reach this sink through driver query runners:
DEFAULT,COMMENT,CHECKconstraints, view definitionsPostgresQueryRunner.ts:1782,L1898,L2287,L4125COLUMN_DEFAULT,COLUMN_COMMENTMysqlQueryRunner.ts:2873-2974,L3580-3583CockroachQueryRunner.tsescapeComment()on each driver strips only null bytes, leaving${...}intact:When the migration file is loaded (
migration:run,import, orrequire), the JS engine evaluates${...}as live interpolation.Affected source:
MigrationGenerateCommand.tsPostgresDriver.tsescapeComment()— PostgresMysqlDriver.tsescapeComment()— MySQLCockroachDriver.tsescapeComment()— CockroachDBConfirmed injection vectors (MySQL):
COMMENTDEFAULTALTER TABLE ... DEFAULT '${...}'; payload appears in generated migrationCHECKconstraintinformation_schema.CHECK_CONSTRAINTSstrips content fromCHECK_CLAUSEViewEntityintrospection; likely exploitable viapg_get_viewdef()Suggested fix: Escape
${to\${(and\\to\\\\) before embedding query strings into template literals, or switch to emitting the SQL as aJSON.stringify()-encoded regular string argument.PoC
Prerequisites:
migration:generateCOMMENT,DEFAULT, or view definition textSteps:
${...}:.tsfile contains unescaped${...}:Output confirms code execution —
idran on the host and its output was interpolated into the SQL:The payload appears in whichever migration direction restores the DB's current state. A malicious DB comment with a clean entity comment places it in
down(). Attacker-influenced entity metadata places it inup(). Either direction executes the code when the method runs.Impact
Code injection / RCE. An attacker with DB schema write access executes arbitrary JavaScript on any machine that generates and loads the migration. This crosses the DB-to-host trust boundary.
CI/CD pipelines that auto-generate and run migrations are the highest-risk target. Any TypeORM user running
migration:generateagainst a database with attacker-influenced schema metadata is affected.Severity
CVSS:3.1/AV:N/AC:H/PR:H/UI:R/S:U/C:H/I:H/A:NReferences
This data is provided by the GitHub Advisory Database (CC-BY 4.0).
Release Notes
typeorm/typeorm (typeorm)
v0.3.31Compare Source
Bug Fixes
require()calls that break bundlers (#12647) (30f9fc7)Full Changelog: typeorm/typeorm@0.3.30...0.3.31
Configuration
📅 Schedule: (UTC)
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.