T08 · Insecure Dependencies
- Location
references/openrewrite-recipes.md:64- Finding
Unpinned OpenRewrite Recipe Dependency Permits Mutable Supply-Chain Code Execution
- Content
View full analysis
Vulnerability Details
File Location:
references/openrewrite-recipes.md, lines 64–66
Vulnerability Type: Unpinned third-party dependency
Risk Level: HighTechnical Analysis
The documented one-shot migration command resolves the OpenRewrite recipe artifact using the mutable
LATESTversion:bash ./mvnw -U org.openrewrite.maven:rewrite-maven-plugin:run \ -Drewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-spring:LATEST \ -Drewrite.activeRecipes=org.openrewrite.java.spring.boot3.UpgradeSpringBoot_3_5LATESTdoes not identify a stable, previously reviewed artifact. Maven consults remote repository metadata at execution time and selects whichever version is then designated as the latest release. The-Uoption further directs Maven to check remote repositories for updated metadata and artifacts.OpenRewrite recipe artifacts contain executable Java components loaded by the Rewrite plugin. Consequently, executing this command gives the newly resolved artifact the ability to run in the Maven process and intentionally modify the target repository. The effective executable dependency can therefore change after this skill package has been audited, without any corresponding change to the reviewed documentation.
Although the document elsewhere recommends looking up current versions, this executable example explicitly uses
LATEST, preventing reproducible resolution and bypassing meaningful version review or approval controls.Attack Path
- An attacker compromises the upstream
rewrite-springpublishing process, an authorized publisher account, or a repository through which Maven resolves the artifact. - The attacker publishes a malicious or compromised version that becomes the version represented by
LATEST. - An agent follows the documented migration command.
- Maven refreshes repository metadata because of
-Uand downloads the attacker-controlled recipe artifact.
...[truncated 1552 chars]
- An attacker compromises the upstream
- Remediation
View remediation
Remediation Suggestions
-
Replace
LATESTwith an explicit, reviewed recipe version:bash ./mvnw org.openrewrite.maven:rewrite-maven-plugin:PINNED_PLUGIN_VERSION:run \ -Drewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-spring:PINNED_REWRITE_SPRING_VERSION \ -Drewrite.activeRecipes=org.openrewrite.java.spring.boot3.UpgradeSpringBoot_3_5 -
Pin the OpenRewrite Maven plugin version as well, either in
pom.xmlor in the fully qualified command, so all executable components are deterministic. -
Remove
-Ufrom routine migration commands. Use it only during an explicit, controlled dependency-update process. -
Verify selected versions against official release records and review release notes before execution.
-
Enforce trusted Maven repositories through organization-controlled
settings.xmlmirrors. Disable unapproved repositories declared by projects or transitive build configuration. -
Use repository-manager checksum and signature validation where available. Record resolved artifact versions and hashes in migration logs.
-
Run OpenRewrite in an isolated, least-privileged environment without production credentials, unnecessary filesystem access, or unrestricted network access.
-
Review the complete generated diff before staging or committing it. Do not automatically treat recipe-generated changes as trusted.
-
Configure automated dependency-update tooling to propose reviewed version bumps rather than selecting mutable versions at execution time.
-
