Improper Control of Generation of Code ('Code Injection') in @asyncapi/modelina
Impact
Anyone who is using the default presets and/or does not handle the functionality themself.
Patches
It is impossible to fully guard against this, because users have access to the original raw information. However, as of version 1, if you only access the constrained models, you will not encounter this issue.
Further similar situations are NOT seen as a security issue, but intended behavior.
Workarounds
Fully custom presets that change the entire rendering process which can then escape the user input.
For more information
Even though that I changed all the presets here, the vulnerability is still present throughout. I am using a JSON Schema here for simplicity.
const jsonSchemaDoc = {
$id: 'CustomClass',
type: 'object',
properties: {
'property: any; \n constructor(){console.log("injected")} \n private _temp': { type: 'string' },
}
};
generator = new TypeScriptGenerator(
{
presets: [
{
class: {
property({ propertyName, content }) {
return `private ${propertyName}: any;`;
},
ctor() {
return '';
},
getter() {
return '';
},
setter() {
return '';
}
}
}
]
}
);
const inputModel = await generator.process(jsonSchemaDoc);
This would render
export class CustomClass {
private property: any;
constructor(){console.log("injected")}
private _temp: any;
private additionalProperties: any;
}
Software afectado
Haz clic en una tecnología para ver todas sus vulnerabilidades.
| Plataforma | Paquete | Versiones vulnerables | Corregida en |
|---|---|---|---|
| Paquete de npm | @asyncapi/modelina | < 1.0.0 | 1.0.0 |
Referencias
- Vector CVSS
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H- Debilidad (CWE)
CWE-94- Plataforma
- npm
- Paquete
@asyncapi/modelina- Publicada
- 21.09.2021
- Actualizado
- 11.10.2026 10:22
Fuentes y licencias
OSV / GitHub Advisory Database - GHSA-4jg2-84c2-pj95 - CC BY 4.0
Historial de vulnerabilidades: @asyncapi/modelina
Todas las vulnerabilidades publicadas de este paquete (Paquete de npm), de la más reciente a la más antigua. Muestra si es un fallo aislado o un paquete que hay que vigilar.
Esta es la única vulnerabilidad conocida de este paquete.
Identifica las vulnerabilidades de tu aplicación
Con la integración de DockRay y el inventario de software activado, DockRay compara las versiones notificadas de los componentes con las vulnerabilidades conocidas y avisa de las coincidencias confirmadas. La cobertura depende de la tecnología compatible y de los avisos disponibles.