Summary
Redocly CLI versions before 2.33.0 can dynamically evaluate unsafe $faker expressions in Arazzo descriptions processed by the respect command. When an untrusted description is handled, a crafted expression may reach the JavaScript Function constructor and execute code with the privileges of the CLI process.
Affected context
The vulnerability occurs in Redocly CLI workflows that use the respect command to process Arazzo descriptions containing $faker runtime expressions. Risk is present when those descriptions originate from an untrusted or externally controlled source; users processing only trusted, self-authored workflows are generally outside the affected context.
Exploit preconditions
- Attack surface: Redocly CLI's
respectcommand and its Arazzo description expression evaluator - Required access: Ability to provide or cause processing of an untrusted Arazzo description
- Trigger point: Evaluation of a
$fakerruntime expression during workflow processing - Why exploitation is possible: Insufficient restrictions on property traversal can expose JavaScript constructor or prototype paths that reach dynamic code-generation functionality
Why this happens
The underlying bug is an unsafe dynamic expression evaluation pattern. The context parser permits expressions to traverse sensitive JavaScript properties such as constructor, prototype, or __proto__, allowing an attacker-controlled expression to reach the Function constructor.
This behavior maps primarily to CWE-94: Improper Control of Generation of Code, because untrusted input can influence dynamic code creation and execution. It is also related to CWE-95: Improper Neutralization of Directives in Dynamically Evaluated Code, since expression content is interpreted as executable logic rather than being limited to a safe data lookup model.
Potential impact
- An attacker may execute arbitrary JavaScript within the CLI process.
- Malicious code could execute shell commands with the process account's privileges.
- CI credentials, tokens, source files, or environment variables could be read.
- Build, validation, or documentation workflows could be altered.
- Compromised CI permissions could enable lateral movement or supply-chain impact.
General mitigation guidance
Mitigation generally focuses on removing executable behavior from expression handling and reducing trust in workflow content.
Common defensive patterns include:
- Restricting runtime expressions to an explicit allowlist of data-only functions and properties.
- Blocking access to constructors, prototypes,
__proto__, and other reflective JavaScript capabilities. - Treating Arazzo descriptions and workflow files from external sources as untrusted input.
- Separating parsing and validation from any mechanism that can execute code.
- Running CLI processing with least-privilege identities and minimal CI permissions.
- Limiting sensitive environment variables, credentials, and filesystem access available to documentation or validation jobs.
- Using secure-by-default expression evaluators that do not expose dynamic code-generation APIs.
How teams detect issues like this
Detection can combine source review, automated analysis, and CI policy controls:
- Use static analysis rules to identify dynamic evaluation,
Functionconstruction, unrestricted property traversal, and prototype access in expression parsers. - Review code paths that resolve user-controlled expressions before validation or normalization.
- Add tests confirming that constructor, prototype, and
__proto__access is rejected. - Scan Arazzo and related workflow inputs for externally sourced content before invoking validation commands.
- Enforce CI policies that restrict secret exposure and shell-capable permissions for documentation and linting jobs.
- Monitor CLI processes for unexpected child-process creation, sensitive file access, or outbound connections during workflow processing.
- Neutral automated code-review tools may help identify unsafe dynamic evaluation patterns during pull-request review.

