Skip to content

[BUG] Undefined symbols in __all__ #331

@ZuhairORZaki

Description

@ZuhairORZaki

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions