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

Source code hiding/Minification? #1048

Open
Abdelgha-4 opened this issue Aug 5, 2024 · 2 comments
Open

Source code hiding/Minification? #1048

Abdelgha-4 opened this issue Aug 5, 2024 · 2 comments

Comments

@Abdelgha-4
Copy link

One native feature of Streamlit that may lack in Stlite is the protection of the python source code. With Streamlit, users can never reach the source code used in the application, while in Stlite it should be included in the html by desing. This could repel users who prefer to keep their App's code as closed-source or use some sensitive information in the app code.

Potential solutions:
1- Encoding: I don't know if this is an intended feature, but currently Stlite sharing already encodes python files to base64 when they are uploaded, which could at least prevent shoulder surfing.
2- Minification: minified code can improve rendering times due to less payload size, while also making it harder to understand and reverse engineer.
3- Hiding: With #901, I'm not sure if it's possible to completely hide the original python code after reducing it to a lower level version during the build time ?

@whitphx
Copy link
Owner

whitphx commented Aug 7, 2024

Thanks but it's not possible to protect such code and data by nature of Stlite like other frontend apps.
As you wrote encoding makes it a bit hard to read the data, but it still can't protect the data as it's just a serialization but not encryption and even the serializer/deserializer are open.
Users just have to be aware of this nature.

@Abdelgha-4
Copy link
Author

Well, that's unfortunate, it eliminates the possibility of using Stlite for any project that has any level of privacy or non open source code.

With that said, how about code minification for the sole purpose of reducing the page size? I think that removing comments and docsrtings may have some effect. Minifying the full code source with tools like python-minifier might be even better. @whitphx, What do you think?

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

No branches or pull requests

2 participants