Summary
@refinedev/inferencer through version 7.0.0 does not properly escape API field names before inserting them into generated JSX source code. If an attacker controls the data provider and supplies crafted JSON property names, malicious JavaScript may execute in a developer's browser when the Inferencer page renders.
Affected context
The vulnerability occurs in Refine Inferencer deployments that generate JSX source code from API metadata or JSON property names without treating those names as untrusted input. Risk is present when a data provider can be influenced by an attacker and the generated Inferencer output is rendered in a developer's browser.
Exploit preconditions
- Attack surface: The Inferencer page and its generated JSX source code
- Required access: Ability to control or influence data returned by the configured data provider
- Trigger point: Rendering an Inferencer page that processes attacker-controlled JSON property names
- Why exploitation is possible: Field names are interpolated into generated JavaScript or JSX without sufficient escaping or contextual encoding
Why this happens
The underlying bug is an unsafe code-generation pattern in which externally influenced API field names are inserted directly into JSX source code. Because the generated content is interpreted as JavaScript rather than treated solely as data, specially crafted property names can alter program structure or introduce executable expressions. This maps to CWE-94: Improper Control of Generation of Code ('Code Injection').
Potential impact
- Malicious JavaScript could execute in a developer's browser
- Session data or locally accessible application information may be exposed
- Developer actions could be performed within the affected browser context
- Generated source code or development workflows could be manipulated
- Additional internal systems may be targeted through the developer's authenticated browser session
General mitigation guidance
Mitigation generally focuses on separating data from generated code and reducing trust in metadata supplied by data providers.
Common defensive patterns include:
- Escaping or encoding field names for the exact JavaScript and JSX context in which they are inserted
- Generating code through structured abstractions rather than string interpolation where possible
- Allowlisting valid identifier formats and rejecting unexpected property names
- Treating data-provider responses as untrusted input, even in development environments
- Applying least privilege to developer sessions and data-provider credentials
- Rendering generated content in an isolated context when direct code generation cannot be avoided
How teams detect issues like this
Detection approaches may include:
- Static analysis rules for string interpolation into JavaScript, JSX, or template-generated source code
- Code review checks for API fields, object keys, or metadata inserted into executable syntax
- Tests using unusual, reserved, and delimiter-containing property names
- Dependency and policy checks for unsafe code-generation patterns in frontend tooling
- Browser security monitoring for unexpected script execution or outbound requests from developer tools
Automated code review and security scanning tools can help identify unescaped data flowing into generated source code.

