邓良驹 编写更安全的Python代码编写安全的Python代码 邓良驹 2019.10.19 思考题 if user.balance >= product.price: user.balance -= product.price ? 目录 CONTENTS 常见不安全代码 代码检查的工具 总结:如何规避风险 常见不安全代码 小心 eval 应对: 在生产环境中,任何情况下都不要使用eval。 import sys "__main__": shellcode = pickle.dumps(ShellExp()) pickle.loads(shellcode) 应对: 绝不对不可信/未认证数据进行unpickle,使用更安全的JSON 或YAML做序列化。必须使用pickle时在沙盒环境执行。 小心 PyYAML 应对: 使用yaml.safe_load,必要时编写自定义 Loader 做更严格的检查。 对不可信来源的序列化检查后操作。 有的甚至是故意、恶意为之。 应对: 谨慎选择第三方 PyPI 包,尽量少导入 PyPI 包; 利用 https://pyup.io/ 等服务保持检查和更新依赖; 利用 Chef InSpect 落实代码安全规范的检查。 *参考资料:“驹说码事” 《如何import一个不存在的对象》 https://mp.weixin.qq.com/s/0_ivKVDU-nKf3r-c96sqrA 利用 Bandit0 码力 | 18 页 | 988.40 KB | 1 年前3
10 为Python Function自动生成Web UI 彭未康为 Python Function 自动生成 Web UI 彭未康 Touch-Callable The web framework for less serious application. Touch-Callable vs (Flask, Django) • Django, Flask • 起步快且容易(getting started quick and easy) • 扩展为复杂应用(scale 扩展为复杂应用(scale up to complex applications) • 非常安全(Reassuringly secure, only Django) • Touch-Callable • 起步非常快 • 非常容易 • 对新手非常友好 工作原理 导入模块 枚举函数 获取元信息 前端渲染 用户提交 类型转换 调用函数 返回结果 前端展示 3.6 例子:生成测试用户 例子:生成测试用户0 码力 | 11 页 | 791.38 KB | 1 年前3
PyConChina2022-深圳-Python Web大型项目开发进击之路-黄志武Python大型Web项目进击 之路 主讲人: 黄志武 – 华世界集团创始人 目录 • Python web开发有什么优势 • 现在的python Web 有哪些选择 • 我们到底是在解决谁的问题 • 业务需求和技术需求哪个更重要 • 技术的价值到底在哪里 Python Web开发有什么优势 • 为什么选择python django框架做web开发 • 基于后端数据模型生成的web模板 • 管理后台 现在的python web开发有哪些选择 • 小型web python全栈开发,Django 框架仍然值得推荐 • 轻量的简洁框架 flask依然是很好的选择,不管是用来做api还是全 栈开发 • 异步高性能web框架 fastapi 和 sanic 都是不错的选择 我们到底是在解决谁的问题 • 为什么我还在分享python web开发技术? • 因为web用户是用户群体最广的,不 因为web用户是用户群体最广的,不管是pc端,web端,app端,都需要调用后端的api接口,这些 api接口都是基于web后端技术演化而来 • 只要有需要web开发的,app开发的,拥有数据交互需求的,web和api后端开发需求依然是庞 大的 • 分享一个团队里的问题,别人用python都在搞AI,大数据,物联网这些新的应用领域的高精尖 新技术,我们做python web开发的还有前(钱)途吗? • 用户问题和技术问题:0 码力 | 9 页 | 722.41 KB | 1 年前3
3 Thautwarm 解放python的表达力 性能和安全性 语法和语义扩展 JIT 静态检查解放Python的 表达力,性能和安全性 Thautwarm 目录 CONTENTS 语法和语义扩展 JIT 静态类型 语法和语义扩展 表达力的扩展, 可用性的保留,白来的午餐? 演示一小部分: 模式匹配, Quick Lambda, Pipe运算 语言决定思维模型 GNU-APL C++ Haskell 说 到 质 数 � 人 们 想 到 什 么 � 语言决定思维模型 54 -> 0.59 3.14 -> 0.93 2.00 -> 0.03 2.60 -> 0.96 如果还有时间,我们用静态类型 来写一个简单的网页生成框架 一个用起来,没有学习曲线的框架。 很安全,因为没有程序员需要付出心 智负担的工作。 THANK YOU thautwarm: - github.com/thautwarm - twshere@outlook.com0 码力 | 43 页 | 10.71 MB | 1 年前3
PyWebIO v1.6.1 Documentation. . . 9 4.2 pywebio.input — Get input from web browser . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 4.3 pywebio.output — Make output to web browser . . . . . . . . . . . . . . . . . . . content on the browser, turning the browser into a “rich text terminal”, and can be used to build simple web applications or browser-based GUI applications. Using PyWebIO, developers can write applications just intrusive: old script code can be transformed into a Web service only by modifying the input and output operation • Support integration into existing web services, currently supports Flask, Django, Tornado0 码力 | 108 页 | 1.37 MB | 1 年前3
PyWebIO v1.3.3 Documentation. . . 9 4.2 pywebio.input — Get input from web browser . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 4.3 pywebio.output — Make output to web browser . . . . . . . . . . . . . . . . . . . output on the browser, turning the browser into a “rich text terminal”, and can be used to build simple web applications or browser-based GUI applications. Using PyWebIO, developers can write applications just without the need to have knowledge of HTML and JS. PyWebIO can also be easily integrated into existing Web services. PyWebIO is very suitable for quickly building applications that do not require complex UI0 码力 | 100 页 | 1.34 MB | 1 年前3
PyWebIO v1.7.1 Documentationcontent on the browser, turning the browser into a “rich text terminal”, and can be used to build simple web applications or browser-based GUI applications. Using PyWebIO, developers can write applications just intrusive: old script code can be transformed into a Web service only by modifying the input and output operation Support integration into existing web services, currently supports Flask, Django, Tornado bmi web service on port 80 ( online Demo [http://pywebio-demos.pywebio.online/bmi] ). If you want to integrate the bmi() service into an existing web framework, you can visit Integration with a web framework0 码力 | 152 页 | 7.47 MB | 1 年前3
PyWebIO v1.8.1 Documentationcontent on the browser, turning the browser into a “rich text terminal”, and can be used to build simple web applications or browser-based GUI applications. Using PyWebIO, developers can write applications just intrusive: old script code can be transformed into a Web service only by modifying the input and output operation Support integration into existing web services, currently supports Flask, Django, Tornado bmi web service on port 80 ( online Demo [http://pywebio-demos.pywebio.online/bmi] ). If you want to integrate the bmi() service into an existing web framework, you can visit Integration with a web framework0 码力 | 160 页 | 7.47 MB | 1 年前3
PyWebIO v1.5.2 Documentation. . . 9 4.2 pywebio.input — Get input from web browser . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 4.3 pywebio.output — Make output to web browser . . . . . . . . . . . . . . . . . . . content on the browser, turning the browser into a “rich text terminal”, and can be used to build simple web applications or browser-based GUI applications. Using PyWebIO, developers can write applications just intrusive: old script code can be transformed into a Web service only by modifying the input and output operation • Support integration into existing web services, currently supports Flask, Django, Tornado0 码力 | 108 页 | 1.37 MB | 1 年前3
PyWebIO v1.8.2 Documentationcontent on the browser, turning the browser into a “rich text terminal”, and can be used to build simple web applications or browser-based GUI applications. Using PyWebIO, developers can write applications just intrusive: old script code can be transformed into a Web service only by modifying the input and output operation Support integration into existing web services, currently supports Flask, Django, Tornado bmi web service on port 80 ( online Demo [http://pywebio-demos.pywebio.online/bmi] ). If you want to integrate the bmi() service into an existing web framework, you can visit Integration with a web framework0 码力 | 160 页 | 7.47 MB | 1 年前3
共 544 条
- 1
- 2
- 3
- 4
- 5
- 6
- 55













