Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented private variable obfuscation and improved the pyinstaller spec file. #695

Draft
wants to merge 4 commits into
base: 0.10
Choose a base branch
from

Conversation

gentlegiantJGC
Copy link
Member

Improved code finding module paths. No longer need to import the packages.

Added code to obfuscate private variables (variables starting with a single underscore) so that third parties cannot access or edit the private state.

The previous method required importing the modules to inspect the path attribute.
The new method gets the path using importlib without importing it.
It would be useful to be able to stop third party code poking around in private variables.
Python does not have true private variables but we can get close by obfuscating the private variable names.
Python does have double underscore attributes and methods but these are not available in first party subclasses so are not very useful in a lot of cases.
True obfuscation would be difficult and require tracking variables across modules.
This implementation is much simpler and just prefixes all private variables with the same random string.
The obfuscation will also rename _[a-zA-Z0-9_] in the import path.
The file paths also need obfuscating to fix this
Fixed issues with files through symbolic links.
Fixed makedirs bug.
Fixed glob directory bug.
Removed pymct obfuscation. Due to dynamic private attribute access it cannot currently be obfuscated. This should get fixed in the future though.
@gentlegiantJGC gentlegiantJGC requested a review from Podshot May 31, 2022 11:24
@gentlegiantJGC gentlegiantJGC changed the base branch from 0.9 to 0.10 May 31, 2022 11:24
@CLAassistant
Copy link

CLAassistant commented May 31, 2022

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants