Files
react-native/packages/react-native-codegen
Ramanpreet Nara a748a405b6 Sanitize module name to prevent Java code injection (#55484)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/55484

This change adds content validation to ensure module names only contain safe identifier characters (alphanumeric and underscores, matching `^[a-zA-Z_][a-zA-Z0-9_]*$`). A new error class `IncorrectModuleRegistryCallArgumentValueParserError` provides a clear error message when an unsafe module name is detected.

Changelog: [Android][Fixed] - Validate module names in codegen

Reviewed By: CalixTang

Differential Revision: D92736956

fbshipit-source-id: 29b2c603bf97f9a2c30c8350d29b468d315765f0
2026-02-10 07:23:22 -08:00
..

@react-native/codegen

Version

Installation

yarn add --dev @react-native/codegen

Note: We're using yarn to install deps. Feel free to change commands to use npm 3+ and npx if you like

Testing

To run the tests in this package, run the following commands from the React Native root folder:

  1. yarn to install the dependencies. You just need to run this once
  2. yarn jest packages/react-native-codegen.