CVE-2021-41151: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') (CWE-22)
value: Backstage is an open platform for building developer portals. In affected versions A malicious actor could read sensitive files from the environment where Scaffolder Tasks are run. The attack is executed by crafting a custom Scaffolder template with a `github:publish:pull-request` action and a particular source path. When the template is executed the sensitive files would be included in the published pull request. This vulnerability is mitigated by the fact that an attacker would need access to create and register templates in the Backstage catalog, and that the attack is very visible given that the exfiltration happens via a pull request. The vulnerability is patched in the `0.15.9` release of `@backstage/plugin-scaffolder-backend`.
CWE description: The product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.
CVSS v3 base score: 4.9
Published: 2021-10-18T21:15Z
Repository: https://github.com/backstage/backstage
Language: JSON
Files changed: plugins/scaffolder-backend/CHANGELOG.md, plugins/scaffolder-backend/package.json
Commit date: 2021-10-16 14:00:24 +0200
Commit message: scaffolder-backend: release path traversal fix

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>

Diff: diff --git a/.changeset/stale-poets-destroy.md b/.changeset/stale-poets-destroy.md
deleted file mode 100644
index 71f8a478ec..0000000000
--- a/.changeset/stale-poets-destroy.md
+++ /dev/null
@@ -1,6 +0,0 @@
----
-'@backstage/plugin-scaffolder-backend': patch
----
-
-Make sure `sourcePath` of `publish:github:pull-request` can only be used to
-retrieve files from the workspace.
diff --git a/plugins/scaffolder-backend/CHANGELOG.md b/plugins/scaffolder-backend/CHANGELOG.md
index 413c384929..160a0229d5 100644
--- a/plugins/scaffolder-backend/CHANGELOG.md
+++ b/plugins/scaffolder-backend/CHANGELOG.md
@@ -1,7 +1,14 @@
 # @backstage/plugin-scaffolder-backend
 
+## 0.15.9
+
+### Patch Changes
+
+- 0f99f1170e: Make sure `sourcePath` of `publish:github:pull-request` can only be used to
+  retrieve files from the workspace.
+
 ## 0.15.8
 
 ### Patch Changes
 
 - 42c618abf6: Use `resolveSafeChildPath` in the `fetchContents` function to forbid reading files outside the base directory when a template is registered from a `file:` location.
diff --git a/plugins/scaffolder-backend/package.json b/plugins/scaffolder-backend/package.json
index 15f4cd40d2..05377123c0 100644
--- a/plugins/scaffolder-backend/package.json
+++ b/plugins/scaffolder-backend/package.json
@@ -1,9 +1,9 @@
 {
   "name": "@backstage/plugin-scaffolder-backend",
   "description": "The Backstage backend plugin that helps you create new things",
-  "version": "0.15.8",
+  "version": "0.15.9",
   "main": "src/index.ts",
   "types": "src/index.ts",
   "license": "Apache-2.0",
   "private": false,
   "publishConfig": {

Vulnerable code: '@backstage/plugin-scaffolder-backend': patch

Make sure `sourcePath` of `publish:github:pull-request` can only be used to
retrieve files from the workspace.
  "version": "0.15.8",
Fixed code: ## 0.15.9

### Patch Changes

- 0f99f1170e: Make sure `sourcePath` of `publish:github:pull-request` can only be used to
  retrieve files from the workspace.

  "version": "0.15.9",