Cloud Native Application Security
Cloud Native Application Security
Guy Podjarny
Cloud Native Application Security
by Guy Podjarny
Copyright © 2021 O’Reilly Media, Inc. All rights reserved.
Printed in the United States of America.
Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North,
Sebastopol, CA 95472.
O’Reilly books may be purchased for educational, business, or sales
promotional use. Online editions are also available for most titles
(http://oreilly.com). For more information, contact our
corporate/institutional sales department: 800-998-9938 or
[email protected].
The Cloud
The cloud represents a series of technological developments that turned
hardware into APIs, letting developers access and control physical
resources purely with software. The shift to software introduces dramatic
ease and flexibility and is best exemplified by elastic compute, pioneered
by the Amazon Web Services (AWS) Elastic Compute Cloud (EC2) service.
EC2 allows users to rent a virtual machine (VM) by the hour and spin it up
or down with a simple API call. This allows a service to adapt its capacity
dynamically, using little compute when demand is low, incurring low costs,
while automatically scaling up to handle surges in demand and avoid losing
business.
Elastic compute and the broader family of cloud technologies combine to
give developers full control over rich infrastructure controls. These include
additional APIs to control other infrastructure components, such as storage
and network access; developer-oriented replacements to IT tooling, such as
containers and Infrastructure-as-Code (IaC) solutions;1 and new technology
paradigms that build on this elasticity, such as serverless.
The cloud unlocked the opportunity for any company to provide operational
excellence previously reserved to a select few and do so with dramatically
lower costs. However, for a company to tap into the power of the cloud, it
also has to change its IT processes, which is where DevOps comes in.
DevOps
DevOps changed the way software is built and maintained. It is predicated
on independent development teams, who are able to own the application
end to end. The most immediate manifestation of that is having developers
also operate the application, dubbed “you build it, you run it,” hence the
name DevOps. However, the term has grown to encompass a broader
autonomy for development teams, including empowerment to make more
business decisions, choose the underlying technologies they use, and more.
This autonomy powers speed, notably in the form of continuous delivery
(CD). Instead of shipping updates in large, infrequent batches, CD means
shipping small improvements regularly, often multiple times a day. Each
incremental step is verified with automated tests to avoid delays, and
observability tools to flag problems in production as soon as they happen.
Such constant updates allow the business to adapt to customer needs faster,
which improves its commercial performance. This continuous flow of faster
delivery leading to faster market adaptation is most commonly portrayed as
an infinity loop, as shown in Figure 1-1, replacing older waterfall, left-to-
right models.
Figure 1-1. A continuous DevOps practice
Cloud Native
Organizations that started building technology in this DevOps and cloud
surrounding are often referred to as cloud native companies. Their
developers embrace on-call responsibilities, monitoring dashboards
regularly and being paged if the service goes down, whereas their ops teams
focus on building platforms that make it easier to build operable software.
Such software engineering organizations are often called cloud native
development teams because they are designed—across people, process, and
technology—to leverage the cloud to the max. The term has grown to also
encompass organizations that modernize their practices and adopt such
cloud native practices, on both public and private cloud platforms.
Similarly, applications built using cloud native development are referred to
as cloud native apps. This isn’t just a historical honorific, but rather, a
description of how these applications are maintained. It implies that these
apps are constantly updated, can scale to large volumes, and leverage
infrastructure automation to provide a better customer experience.
Organizationally, it’s important to understand that cloud native applications
have a bigger scope than their predecessors had. Older applications are
made up mostly of code and open source libraries and rely on a central IT
team to provide them with infrastructure, such as hardware, VMs, network
access, databases, and more.
Cloud native apps, by contrast, include such underlying infrastructure as
part of their scope. Hardware and VMs are replaced by containers and
managed through Dockerfiles stored in the source code’s repository;2
network configuration is specified in IaC files such as Terraform and
Kubernetes configurations; and databases or similar supporting apps are
provided as services in the cloud platform itself, and managed by the
application team itself.
This change in the scope of the application is shown in Figure 1-2, using a
somewhat arbitrary before-and-after view of pre-cloud and cloud native
apps.
Figure 1-2. Cloud native applications include a much broader scope
Conclusion
Digital transformation is aptly named; it transforms organizations, changing
their business trajectory to be technology focused, with the tools and
practices required to succeed. This change is far reaching, affecting
anything from org structures and business incentives to development
methodologies and technology stacks.
Cloud native applications are designed to thrive in this new reality. They
rely on independent teams, able to deliver customer value end to end. They
use DevOps methodologies and cloud technologies to empower these teams
to succeed. Unfortunately, security functions haven’t kept up with this
change and are continuing to operate largely the same as before, making
them ineffective and a burden on the business.
To secure cloud native applications successfully, security practices need to
undergo a transformation that matches the one that development took on.
We have to embrace a dev-first, Cloud Native Application Security
approach and anchor our practices to this new organizational reality.
In the next two chapters, we’ll dive deeper into what dev-first security and
Cloud Native Application Security mean, and how you can successfully
implement them in your organization.
1 Containers are lightweight packaging of operating system and files, offering a type of virtual
machine but smaller and lighter, allowing better agility and speed. IaC solutions are tools that
define infrastructure in code or declarative files, often stored in repos as part of the app, and
can automatically apply those definitions on an infra platform.
2 Dockerfile is the most common way to define what a container should hold. These are human
editable files, typically managed as source code. Running a build command on a Docker
image creates a container image.
Chapter 2. Dev-First Security
Operating continuously
Security processes still heavily rely on manual gates such as audits or
result reviews, slowing down the continuous process.
For developers, though, the first question isn’t about risk, but rather, about
how the library connects to and affects the app. They don’t look for other
vulnerable libraries, but for other properties of the same library, such as
how outdated it is, so they can weigh the impact of upgrading or replacing
it. Figure 2-3 shows the difference between a security-focused flat list of
vulnerabilities, which focuses on the risk, and a dev-first tree view of
vulnerabilities, which focuses on relation to the app.
Figure 2-3. Tree view and flat view
These solutions can be very valuable in reducing risk, but they are not
developer-friendly tools. They modify the originally coded functionality
(typically after testing) and carry a real risk of breaking legitimate user
actions. More important, they take control away from the developer to
prevent or fix such functionality breakage. Instead of helping developers
secure their apps, they convey a message that the apps are bound to be
broken and aim to patch them after the fact.
Dev-first security solutions should simplify remediation but aim to do so as
part of the developer’s job, instead of taking over the developer’s
responsibilities.
Now that we understand what dev-first security means, let’s discuss how it
relates to two other common terms in this field: shift left and DevSecOps.
In the DevOps era, shifting left isn’t quite as clear. The core concept behind
it is as valid as ever: the shorter the gap between writing a bug and finding
it, the cheaper it is to fix it. However, two key parts are missing.
First, there is no “left” in a continuous process, which is rightfully depicted
as an infinite process. DevOps accepts that certain bugs will only be found
in production and is willing to sacrifice some level of verification in favor
of a faster delivery cycle. It relies on methodologies like observability to
help find such issues post-deployment and doesn’t necessarily see that as
inferior to earlier detection. In other words, it’s often better to find an issue
shortly after deployment than to add a costly and slow security test to
continuous integration/continuous delivery (CI/CD) pipelines, even if it’s
“further left.”2
Second, shift left doesn’t reflect the change in ownership and drive for
independent teams. The truly important change isn’t whether you shift the
technical testing left, but rather, whether you shift the ownership of such
testing to the development team. Pipeline tests that require security teams to
review their results, due to false positives or required expertise, can be more
harmful than post hoc audits. Each dev team should be equipped and
empowered to decide what the best place and time is to run the tests,
adapting it to their workflows and skills.
If you have to pick a direction, you should focus less on shifting left and
more on going top to bottom. This means replacing a controlling, dictatorial
security practice with an empowering one, as I mentioned earlier.
Conclusion
Dev-first security is a new approach to security. It biases in favor of
adoption by those who can fix the problem versus those who manage it.
However, a security program that cares only about the needs of developers
is not good enough either. A good dev-first security program has to help
security teams govern successfully and keep the organization secure.
It requires two teams working together (see Figure 2-6):
An empowered development team, equipped with the right tools
and mandate to secure what they build
A supportive security team, focused on making security easy for
developers and providing the security expertise and governance
required to keep the company safe
Figure 2-6. A successful dev-first security program requires collaboration between dev and security
Alongside DevOps, which drove the need for the dev-first security
approach just discussed, we’ve seen the evolution of the cloud and the era
of cloud native applications. As I mentioned in Chapter 1, cloud native apps
have a broader scope than their predecessors, growing to include more
elements of the underlying stack.
This change in application scope requires a change in the scope of
application security too. This chapter discusses a new and expanded scope
for AppSec called Cloud Native Application Security (CNAS).
Before we dig into the details, let’s take a moment to understand this
transition and what the new scope holds.
Golden images are modified without testing the apps that run on
them, but these underlying changes can cause those apps to break
unexpectedly.
Golden images change on a schedule independent of the app,
introducing risk and noise at potentially sensitive times in the app’s
own rollout schedule.
App-specific images have no inherent traceability to the golden
image they were built from, relying on error-prone manual tracking
to know when they need to be patched due to golden image
security updates.
Golden images are often updated inline, with little or no versioning
or storage of past versions, making it hard to track patching or
rollback.
Containers, especially after the introduction of Docker, are designed to
address this gap. Containers are declared as source code (usually using a
Dockerfile), benefiting from Git versioning and collaboration. Their layers
and, notably, base image are clearly declared, as Figure 3-2 shows, offering
traceability to external or centrally managed golden images. They are built
using a standard CI/CD process and stored in a versioned registry,
providing the tracking and rollback support needed for proper continuous
deployment.
Figure 3-2. Visual of a Dockerfile and the layered container image built from it
Conclusion
Embracing the cloud and cloud native development is about far more than
technology. It’s an enabler for independent teams to run faster, adapting to
market demands faster and driving superior business outcomes. To achieve
this, application teams are given ownership and control over more layers in
the stack, and we need to make sure they can also keep those layers secure.
CNAS is the perspective we need to make this happen. It requires us to
understand that the same people previously tasked solely with securing their
code now make decisions around so much more. We discussed containers
and infrastructure, but dev teams also need to manage data, service, API
gateways, and much more, all areas where decisions can have significant
security implications.
Each of these layers requires us to rethink our security controls in a dev-
first fashion. As we’ve seen with containers and IaC, the resulting solution
could look very different from its predecessors.
Rethinking Tooling
Alongside organizational structure changes, CNAS and dev-first require a
reevaluation of your toolkit. Given this new perspective, you should
reconsider the most important traits you’re looking for in a technology
solution and how you want tools to be bundled.
There are many ways to reevaluate tools, but I would suggest focusing on
three primary areas: dev adoption, platform scope, and governance
approach.
These are just a few of many dev tool best practices. They should be added
to the security-specific recommendations around dev-first security from
Chapter 2. In addition, make sure you involve actual app developers when
evaluating any tool, to get a real-life perspective on how well it fits into
their surroundings (see Figure 4-1).
Figure 4-1. Examples of developer-friendly security tools
Platform Scope
AST platforms today are primarily focused on custom code and, perhaps,
the open source libraries it consumes. Tool suites are primarily composed of
SAST, DAST, and IAST, with SCA recently added to the mix. As you
embrace the broader cloud native application scope, reconsider the makeup
of the platform.
To start, let’s consider what tools benefit from being part of a single
platform. They can be divided into a few big buckets:
Shared users
If different tools are meant for different primary users, there’s little need
for them to be part of a single platform because they’ll be used
separately anyway.
Shared workflows
If multiple tools are used in a similar fashion and integrate in similar
points of the user’s workflow, you can save the integration time and
user time and effort by combining them instead of requiring engagement
with multiple separate tools.
Shared prioritization
If the action items from different tools should be prioritized against one
another, sharing a backlog can increase efficiency and results.
Multiplied value
Finally, the strongest driver for tools to share a platform is when using
tools together can enhance each tool.
This criterion naturally explains why technologies like SAST and SCA
fit well in a single platform. Both serve the same developer users, run
scans and engage users in the same spots, and share a backlog of
security vulnerabilities the same developer will need to prioritize
between. In advanced SCA solutions, SAST technology can indicate
whether your custom code invokes the vulnerable code in a library,
providing greater accuracy—hence multiplied value.
The same logic applies when you consider adding container and IaC
security to the same platform of SAST and SCA:
Shared users
Containers and IaC are now secured by developers, just like SAST and
SCA, who would rather not have multiple disparate products to learn
and engage with.
Shared workflows
Securing containers and IaC requires integration across the life cycle,
such as IDE, Git, and build integrations, just like SAST and SCA.
Shared prioritization
The same developer needs to spend cycles fixing a container or IaC
vulnerability or one in the code or libraries—all one backlog for
securing the app.
Multiplied value
There are many ways in which securing these components combine.
Scanning containers requires exploring the app inside, knowing the
infra config helps prioritize code and library vulnerabilities, and
understanding the flow across components helps mitigate issues; this is
precisely what you do when triaging a vulnerability.
This logic continues to hold even as the CNAS scope expands, and I
encourage you to think about your CNAS tooling as one platform. An easy
guideline is that anything sitting in a Git repository probably relates to the
files around it and follows the same development workflows. As a result, a
CNAS platform should help secure everything in the repo—the entire cloud
native app.
DAST and IAST are slightly awkward participants in such a platform.
Although they deal with securing the app, they typically require different
workflows; it’s hard to fit them into a build pipeline or IDE scans due to the
time they take to run. In my opinion, this is a technical problem, not a
logical one, which will hopefully be solved once IAST and DAST solutions
evolve to become more pipeline friendly.
Rethinking Priorities
Last but not least, CNAS requires rethinking application security priorities.
If developers need to secure the entire cloud native application, where do
you want them to focus the most?
Historically, IT security controls dominated far bigger budgets and
commanded more CISO attention than application security ones did. There
may be historical reasons for this imbalance, but at the end of the day, it
represents a CISO’s view on how best to use their dollars to reduce the risk
to the organization.
In other words, CISOs believe the risk of a breach due to an unpatched
server or misconfigured infrastructure is greater than that of a custom
vulnerability in your code. This perception has a fair bit of data to support
it, showing historical breaches and their causes. In addition, it’s easy to
understand; it’s far easier for an attacker to run known exploits at scale and
look for an open door than to reverse engineer an application and find
custom flaws to let them through.
The cloud doesn’t diminish this equation; in fact, it strengthens it. Adoption
of cloud means more infrastructure and more servers are used, they tend to
be more publicly accessible, and they are defined by teams that are less
familiar with managing them (developers) and equipped with less-mature
tools.
However, whereas the previous balance was between IT security budgets
and AppSec budgets, now it’s all in the AppSec world. When building cloud
native applications, the same developers need to secure their custom code,
manage vulnerabilities in their open source usage, and make the servers and
infrastructure resilient. The same AppSec team needs to help them do so as
well as split the same budget across them.
So we’re back to the opening question: how do you want your precious
developer time and limited CNAS budget distributed?
Left to their own devices, application security budgets and developer
attention focus on securing custom code. AppSec maturity models, industry
best practices, and the personal experience of individuals on the team are all
anchored in the pre-cloud world, where custom code was the majority of
what developers had to secure. Buying tools like SAST and DAST is often
the first thing on a new AppSec leader’s list and is rarely challenged.
However, given the CNAS scope, is that still the best use of your time and
money? The risk of a breach due to a known vulnerability or a
misconfiguration is still higher than that of a custom code flaw, even if
developers are the ones configuring it. If you agree, shouldn’t you tell your
developers and AppSec team to focus first and foremost on securing those
layers, and only then approach their custom code?
This isn’t an easy question to answer. I won’t assume to know what your
priorities should be, because those change from org to org. However, I
strongly encourage you to have this conversation internally and reconsider
your priorities, given the broader scope of CNAS.
Conclusion
Changing how you approach application security isn’t just a thought
exercise. It has very real downstream implications, including people’s
careers, budget allocations, and a reassessment of the best way to keep the
organization secure. It requires shaking off some muscle memory of how
you’ve done things in the past and instead going back to first principles
when choosing solutions, which takes precious time and energy.
The good news is that you don’t have to do it all at once. The changes I
outlined in this chapter are related to one another but can be applied at your
own pace. I suggest you pick the ones you relate to the most, or opt for
other changes you think are more important, and get the changes going.
Step by step, you’ll adapt your security function to the cloud native reality.
Summary
Digital transformation is a force to be reckoned with. Across every vertical,
businesses strive to become technology companies and increasingly
differentiate on how well they live up to that description.
The cloud and DevOps play a massive role in this transformation and
overhaul how we develop and operate software. Software has never been
easier to create, has never been updated as frequently as it is today, and has
never innovated to adapt to customer needs so quickly.
These changes are all made possible by unlocking the power of independent
teams to run fast. Agile drove these teams to be customer centric, iterate on
ideas rapidly, and own the quality of their code. DevOps lets developers
operate what they build, combining code and infrastructure to better deliver
on customer needs. And security, as an industry, has been left behind.
In the face of such change, security has no choice but to adapt. Businesses
must and will continue to strive for speed, and independent teams are the
only way to achieve this. The way we secure applications has to transform,
making it part of the daily work of these independent development teams.
Security teams need to focus, first and foremost, on helping these teams
embrace security. Security needs to become dev-first.
As we shift the security industry to the dev-first approach, we need to catch
up to another change that passed us by. The cloud, and with it cloud native
application development, has moved infrastructure into the hands of
developers. Under the same mantle of unlocking speed, dev teams create,
manage, and monitor their application infrastructure, removing obstacles to
shipping value. We need to make sure they secure these new responsibility
domains well, and expand application security to encompass a broader
CNAS scope.
I hope this book helped you understand the value of embracing a dev-first
CNAS approach and equipped you with some techniques for how to make it
happen. As we work hard to match security transformation with digital
transformation, it’s worth remembering there’s another reward if we get it
right.
DevOps has demonstrated that businesses that employ it well are rewarded
with significant business success. Companies that unlocked the ability of
teams to run fast proved themselves to be resilient and available and are
beating their competition. And ops teams have gone from being a cost
center to a valued business competency.
Security has the opportunity similarly to help the organization thrive. By
helping dev teams build secure software without slowing down, you can not
only reduce risk but also grow the top line. You can help your business
respond to customer needs faster while differentiating on being more secure
and trustworthy. This could similarly turn security from a cost center to a
true business partner, driving the company’s success—which is an even
bigger security transformation.
About the Author
Guy Podjarny is the founder and president of Snyk, building developer-
first security solutions. Guy was previously CTO at Akamai following its
acquisition of his previous start-up, Blaze, and managed the first application
security testing solution, AppScan.
Guy is a frequent public speaker, writer, and author. He wrote O’Reilly’s
Serverless Security, Securing Open Source Libraries, High Performance
Images, and Responsive and Fast.
1. Preface
a. Why I Wrote This Book
b. Who Is This Book For?
2. 1. Digital Transformation
3. 2. Dev-First Security
a. What Is Dev-First Security?
e. Conclusion
5. 4. Adapting to Dev-First CNAS
b. Rethinking Tooling
c. Rethinking Priorities
d. Conclusion
6. Summary