python - 安全与脚本

标签 python security pyscript

我正在编写一个 Python 编辑器,它可以执行 Python 代码并返回输出。我最初的想法是为它编写一个后端服务,它将运行 Python 脚本并返回输出。但是随着 Pyscript 的发布,我想知道我是否可以在前端完成它。

我最大的担忧之一是安全性,因为 Python 编辑器可能需要连接 AWS 资源(例如数据库、Dynamodb、RDS...)。使用凭据连接 AWS 资源是否会成为安全问题?如我所见,Pyscript 也在混淆 Python 代码,因此我有点困惑。

感谢您的回复

最佳答案

However with the release of Pyscript, I am wondering if I can do it in the frontend.

是的。网上有例子。该存储库在浏览器中有一个 repl 示例:

https://github.com/pyscript/pyscript/tree/main/pyscriptjs/examples

One of my biggest concerns is the security, since the Python editor may need to connect AWS resources (such as Databases, Dynamodb, RDS...). Will using credentials to connect AWS resources be a security concern?

这是一个非常大的问题。 Pyscript 将在 Python 代码中公开您的凭据,这些代码可以从浏览器调试窗口轻松读取,或者只需使用 curlwget 等 CLI 即可下载您的 HTML。

As I see, Pyscript is also obfuscating the Python code, thus I am a bit confused.

我不确定您看到了什么混淆,但您无法从可以下载您的 HTML 和 Python 文件的浏览器或工具中隐藏任何内容。这不会提高您的安全性,因为您使用 Pyscript 的源代码安全性为零。

关于python - 安全与脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72084234/

相关文章:

python - 根据键对字典列表进行排序

python latin-1 UnicodeDecodeError 在使用 couchdb cPickle 二进制数据切换到 ubuntu 14 后

python - 将 flask-admin 添加到项目时出现错误的仪表板

php - 防止浏览器控制台修改类(安全问题)

python - 你如何使用 Pyscript 输入和输出文本?

python - 如何在 Pyscript 中获取显示消息

python - 读取 CSV 文件并确定数据结构

mysql - 编辑MySQL表权限的工具?

security - 使用用户输入的 URL 处理安全性并避免 XSS 的最佳方法

python - 在 pyscript py-env 中固定特定的库版本