VDB
Sign up
MEDIUM4.4

GHSA-657c-g7qc-r9j2

Redocly CLI: Path traversal when using `split` command

Quick fix

GHSA-657c-g7qc-r9j2 — @redocly/cli: upgrade to the fixed version with the command below.

npm install @redocly/cli@1.34.17

Details

### Impact

An OpenAPI or AsyncAPI description could make the `split` command write files outside the chosen output directory, on the machine of anyone who runs `split` against it. The write is constrained rather than a free file-write primitive: component data is emitted only as YAML/JSON, and code-sample files are named after the HTTP method, so an attacker can place or overwrite files at an unintended path but has limited control over their name and contents.

### Patches

Fixed in `@redocly/cli` v2.33.2.

### Workarounds

Do not run the `split` command on API descriptions from untrusted or unreviewed sources.

To detect an exploit attempt, inspect the description's component names and `x-codeSamples` `lang` values for a literal `../` — neither legitimately contains path segments.

Are you affected?

Enter the version of the package you're using.

Affected packages

npm/@redocly/cli
Introduced in: 0Fixed in: 1.34.17
Fixnpm install @redocly/cli@1.34.17
npm/@redocly/cli
Introduced in: 2.0.0Fixed in: 2.33.2
Fixnpm install @redocly/cli@2.33.2

References