# GHSA-4jqc-jvh2-pxg9: Path traversal for local publishers in TechDocs backend

> A malicious actor with catalog registration rights can write files to arbitrary paths on the TechDocs backend host when using local publisher configuration.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 17 Jun 2022

## What is GHSA-4jqc-jvh2-pxg9?

GHSA-4jqc-jvh2-pxg9 is a path traversal vulnerability in @backstage/plugin-techdocs-node, published on 17 Jun 2022. Any signed-in user can exploit it over the network, with no action from the victim.

### Official description

### Impact
A malicious actor with the ability to register entities in the Software Catalog is able to write files to arbitrary paths on the techdocs backend host instance when `techdocs.publisher.type` is set to `local`.

This vulnerability is mitigated by the fact that the Software Catalog must be configured with non-standard field format validators and/or non-standard entity policies.

### Patches
Those affected are advised to upgrade to `@backstage/plugin-techdocs-node` version `1.1.2` or higher.

### Workarounds
If patching or upgrading is not possible, it would be sufficient to update any custom Catalog field format validators and/or custom entity policies to disallow entity names, kinds, and namespaces containing `..`

<!--
### References
todo: Link to blog post / published report.
-->

### For more information
If you have any questions or comments about this advisory:

- Open an issue in the [Backstage repository](https://github.com/backstage/backstage)
- Visit our chat, linked to in the [Backstage README](https://github.com/backstage/backstage)

## Which versions are affected by GHSA-4jqc-jvh2-pxg9?

4 open source packages ship an affected version, including @backstage/plugin-techdocs-node and @backstage/techdocs-common.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `@backstage/plugin-techdocs-node` | npm | All versions | 1.1.2 |
| `@backstage/plugin-techdocs-node` | npm | All versions | 1.1.2 |
| `@backstage/techdocs-common` | npm | All versions | 0.11.16 |
| `@backstage/techdocs-common` | npm | All versions | 0.11.16 |

## How do I fix GHSA-4jqc-jvh2-pxg9?

Upgrade @backstage/plugin-techdocs-node to 1.1.2 or later.

## Is GHSA-4jqc-jvh2-pxg9 being exploited?

There is no known exploitation of GHSA-4jqc-jvh2-pxg9 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-4jqc-jvh2-pxg9 and fix it if it is affected.

What it is: GHSA-4jqc-jvh2-pxg9 is a path traversal vulnerability in @backstage/plugin-techdocs-node, published on 17 Jun 2022. Any signed-in user can exploit it over the network, with no action from the victim.
Exploitation: There is no known exploitation of GHSA-4jqc-jvh2-pxg9 in the wild and no public exploit code.

Affected packages and fixed versions:
- @backstage/plugin-techdocs-node (npm): affected all versions; fixed in 1.1.2
- @backstage/plugin-techdocs-node (npm): affected all versions; fixed in 1.1.2
- @backstage/techdocs-common (npm): affected all versions; fixed in 0.11.16
- @backstage/techdocs-common (npm): affected all versions; fixed in 0.11.16

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/GHSA-4jqc-jvh2-pxg9/ (Markdown: https://insights.sbomify.com/GHSA-4jqc-jvh2-pxg9/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-4jqc-jvh2-pxg9

---
From sbomify Insights: https://insights.sbomify.com/GHSA-4jqc-jvh2-pxg9/
Summaries are generated and may contain mistakes; the official description above is the record.
