Could I use the lazy import to define a single set of dependencies of a monorepo and then load only the required subset for each project?
Python utility for tracking third party dependencies within a library
21–23 of 23 posts
Re: Python utility for tracking third party dependencies within a library
#22Earlier quoted context omitted.
Hi, I'm the main author of import_tracker. Thanks for taking the time to dig into it! It's a really interesting point that the subproces.Popen could itself be a security concern. The command that's being executed is executing the __main__ of the import_tracker library itself (which is not something that a user can't configure), so is your concern that import_tracker itself is untrusted and might be a concern for user…
Hi! I think that, in my cursory reading, I misunderstood what the code is doing. I thought it was importing the module you're trying to analyze... I'll have to read more closely when I have some spare time.
Re: Python utility for tracking third party dependencies within a library
#23This looks really neat. One thing I noticed on reading the source code, it appears to actually import the modules: Quoting the docstring on the `track_module` function: """This function executes the tracking of a single module by launching a subprocess to execute this module against the target module. The implementation of thie tracking resides in the __main__ in order to carefully control the import ecosystem. Sourc…
No, you understand. Indeed, by importing Python code, you execute Python code, and so there could be ab execution path for malicious code to run. FYI, pylint does something similar for native-code extension modules (unless this changed in the past few years): it imports them dynamically! EDIT: reading the code more closely and reading the rest of the comments, more precisely, it's not the subprocess call itself, but…
It's a very interesting use case to consider how a similar solution could work as a sandbox for investigating supply chain concerns with third-party libraries that have transitive dependencies. I think some of the static analysis tools referenced in other comments would address this better since the real concern there is detecting the presence of transitive dependencies which may be malicious as opposed to identifying exactly where in the target library those dependencies are used.