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

Support encrypting bytecode to obfuscate source #265

Closed
johnthagen opened this issue Jun 7, 2020 · 4 comments
Closed

Support encrypting bytecode to obfuscate source #265

johnthagen opened this issue Jun 7, 2020 · 4 comments
Labels
enhancement New feature or request

Comments

@johnthagen
Copy link
Contributor

To raise the bar for accessing bundled .pyc files within a PyOxidizer executable, would you consider adding a feature to encrypt the embedded .pyc files?

This makes it more difficult to recover the original source code (though, of course it's possible given enough work because the key is stored in the binary).

Pyinstaller supports this using the --key option.

MATLAB also does something similar to allow better protection of source code: https://www.mathworks.com/products/compiler.html#encrypted-royalty-free

This was originally discussed in #38.

@johnthagen
Copy link
Contributor Author

@indygreg indygreg added the enhancement New feature or request label Jun 12, 2020
@indygreg
Copy link
Owner

I'm not opposed to adding this feature.

However, encrypted bytecode with a distributed key to decrypt is essentially "security theater" since it merely raises the bar and doesn't really protect anything from a determined attacker. However, I'm a pragmatist and realize some customers insist on this feature. So it makes sense to add someday.

Thank you for the link to PyInstaller's equivalent feature!

If someone could do the heavy lifting and post a technical explanation for how the feature works and/or link to source code, that would save time on implementation...

@johnthagen
Copy link
Contributor Author

@indygreg Completely agree with all of your thoughts.

Also, it's worth noting in their default configurations, PyOxidizer is already more obfuscated than PyInstaller. PyInstaller must extract the .pyc files to a temporary directory while running, while PyOxidizer does not. This makes it easier for a low-bar attacker to copy the .pyc files from PyInstaller without having to dissect the binary.

PyInstaller Implementation

@johnthagen
Copy link
Contributor Author

FWIW, Pyinstaller is removing this feature for reasons stated below.

Since I'm the one who originally opened this request, I'm going to simply close it as I don't think the benefits are high enough to justify the complexity.

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

No branches or pull requests

2 participants