Being such a widely-used language makes Python a target for malicious hackers. Let's see a few ways to secure your Python apps and keep the black-hats at bay.
Python is undoubtedly a popular language. It consistently ranks among the most popular and most loved languages year after year. That's not hard to explain, considering how fluent and expressive it is. Its pseudocode-like syntax makes it extremely easy for beginners to pick it up as their first language, while its vast library of packages (including the likes of giants like Django and TensorFlow) ensure that it scales up for any task required of it.
Being such a widely-used language makes Python a very attractive target for malicious hackers. Let's see a few simple ways to secure your Python apps and keep the black-hats at bay.
Python places a lot of importance on zen, or developer happiness. The clearest evidence of that lies in the fact that the guiding principles of Python are summarized in a poem. Try
import this in a Python shell to read it. Here are some security concerns that might disturb your zen, along with solutions to restore it to a state of calm.
OWASP Top Ten, a basic checklist for web security, mentions unsafe deserialization as one of the ten most common security flaws. While it's common knowledge that executing anything coming from the user is a terrible idea, serializing and deserializing user input does not seem equally serious. After all, no code is being run, right? Wrong,
PyYAML is the de-facto standard for YAML serialization and deserialization in Python. The library supports serializing custom data types to YAML and deserializing them back to Python objects. See this serialization code here and the YAML produced by it.
Deserializing this YAML gives back the original data type.
$ python deserialize.py ↵ <Person: Dhruv - 24>
As you can see, the line
!!python/object:__main__.Person in the YAML describes how to re-instantiate objects from their text representations. But this opens up a slew of attack vectors that can escalate to RCE when this instantiation can execute code.
Static code analysis is a method of debugging by examining source code before a program is run. It's done by analyzing a set of code against a set (or multiple sets) of coding rules. Static code analysis and static analysis are often used interchangeably, along with source code analysis.
Peer code reviews have increasingly been adopted by engineering teams around the world. Here are 6 tips to make the process better for teams.
The story of Softagram is a long one and has many twists. Everything started in a small company long time ago, from the area of static analysis tools development. After many phases, Softagram is focusing on helping developers to get visual feedback on the code change: how is the software design evolving in the pull request under review.
Author Robert Collier said that "Success is the sum of small efforts repeated day in and day out." That's especially true when it comes to security. Poor maintainability contributed to Heartbleed. To make the case for how maintainable code contributes to security, I'll start with the Heartbleed ...
Book Review — Effective Python, by Brett Slatkin. An overview of Effective Python, by Brett Slatkin (principal software engineer at Google), reveals 90 specific ways to write better Python code.