Overview
In file: init.py, __all__ includes undefined symbols Node,WrappingNode,node_to_dict, translate. This will cause an ImportError when importing the module using star import i.e. from js2py.translators import *.
Possible Fix
One way to fix this issue would be to remove the undefined symbols if they are not needed.
--- /workspace/source/js2py/translators/__init__.py
+++ /workspace/source/js2py/translators/__init__.py
@@ -18,10 +18,9 @@
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
# OR THE USE OR OTHER DEALINGS IN THE SOFTWARE
__all__ = [
- 'PyJsParser', 'Node', 'WrappingNode', 'node_to_dict', 'parse',
- 'translate_js', 'translate', 'syntax_tree_translate', 'DEFAULT_HEADER'
+ 'PyJsParser', 'parse', 'translate_js', 'syntax_tree_translate', 'DEFAULT_HEADER'
]
__author__ = 'Piotr Dabkowski'
__version__ = '2.2.0'
from pyjsparser import PyJsParser
Notes from Triage Team
There is an import statement which imports trasnlate rather than translate.
from .translator import translate_js, trasnlate, syntax_tree_translate, DEFAULT_HEADER
This may be causing the translate symbol to become undefined.
Sponsorship and Support:
This work is done by the security researchers from OpenRefactory and is supported by the Open Source Security Foundation (OpenSSF): Project Alpha-Omega. Alpha-Omega is a project partnering with open source software project maintainers to systematically find new, as-yet-undiscovered vulnerabilities in open source code - and get them fixed - to improve global software supply chain security.
The bug is found by running the iCR tool by OpenRefactory, Inc. and then manually triaging the results.
Overview
In file: init.py,
__all__includes undefined symbolsNode,WrappingNode,node_to_dict,translate. This will cause anImportErrorwhen importing the module using star import i.e.from js2py.translators import *.Possible Fix
One way to fix this issue would be to remove the undefined symbols if they are not needed.
Notes from Triage Team
There is an import statement which imports
trasnlaterather thantranslate.This may be causing the
translatesymbol to become undefined.Sponsorship and Support:
This work is done by the security researchers from OpenRefactory and is supported by the Open Source Security Foundation (OpenSSF): Project Alpha-Omega. Alpha-Omega is a project partnering with open source software project maintainers to systematically find new, as-yet-undiscovered vulnerabilities in open source code - and get them fixed - to improve global software supply chain security.
The bug is found by running the iCR tool by OpenRefactory, Inc. and then manually triaging the results.