Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Defending APIs

You're reading from   Defending APIs Uncover advanced defense techniques to craft secure application programming interfaces

Arrow left icon
Product type Paperback
Published in Feb 2024
Publisher Packt
ISBN-13 9781804617120
Length 384 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Colin Domoney Colin Domoney
Author Profile Icon Colin Domoney
Colin Domoney
Arrow right icon
View More author details
Toc

Table of Contents (19) Chapters Close

Preface 1. Part 1: Foundations of API Security
2. Chapter 1: What Is API Security? FREE CHAPTER 3. Chapter 2: Understanding APIs 4. Chapter 3: Understanding Common API Vulnerabilities 5. Chapter 4: Investigating Recent Breaches 6. Part 2: Attacking APIs
7. Chapter 5: Foundations of Attacking APIs 8. Chapter 6: Discovering APIs 9. Chapter 7: Attacking APIs 10. Part 3: Defending APIs
11. Chapter 8: Shift-Left for API Security 12. Chapter 9: Defending against Common Vulnerabilities 13. Chapter 10: Securing Your Frameworks and Languages 14. Chapter 11: Shield Right for APIs with Runtime Protection 15. Chapter 12: Securing Microservices 16. Chapter 13: Implementing an API Security Strategy 17. Index 18. Other Books You May Enjoy

Understanding the elements of API security

API security is a complex topic and comprises many elements — a successful API security initiative should be built upon a solid foundation of a DevOps practice and a balanced AppSec program. Just like a house, the strength of the overall structure is dependent on a solid foundation – without these in place, an API security initiative may prove challenging.

Good security is built on a multi-layer system – this is the defense in-depth approach.

It is important to remember that API security is quite different from what has come before with web application security. This means that using existing tools and practices may be insufficient to produce secure APIs. Dedicated API security solutions must be deployed in addition to traditional AppSec tools to provide the optimum coverage and protection specific to APIs.

The elements of the API security hierarchy are shown here:

Figure 1.2: The elements of API security

Figure 1.2: The elements of API security

Let’s explore each of the layers of API security briefly.

DevOps

DevOps is a well-established set of practices to facilitate modern software systems, characterized by close relationships between the development and operations teams to improve methodology and practices and leverage the benefits of automation. DevOps is considered a continuous process with continuous improvements across several key domains in the Software Development Lifecycle (SDLC), as shown here:

Figure 1.3: The DevOps cycle

Figure 1.3: The DevOps cycle

DevOps offers many benefits to the delivery of software, including the following:

  • Improved collaboration and trust
  • Faster release cycles
  • Reduced time to repair
  • Higher levels of automation
  • Use of standard processes, including testing and deployment

From the perspective of API security, the key benefit of DevOps is the ability to build APIs in a deterministic fashion using a standard process. Using standard Continuous Integration / Continuous Delivery (CI/CD) pipelines, API security testing and validation tooling can be injected into the build process to ensure that all deployed APIs have had the specified security checks and controls applied to them. APIs by their nature are well suited to automated testing, and the CI/CD pipeline is the ideal place for this activity.

SAST, DAST, SCA, and WAFs

Static application security testing (SAST), dynamic application security testing (DAST), software composition analysis (SCA), and web application firewalls (WAFs) form the vanguard of traditional application security programs.

The security of any software can be improved by the judicious use of such tools, as follows:

  • SAST can detect basic flaws in source code at the time of development
  • DAST can detect application vulnerabilities at runtime
  • SCA can detect the use of vulnerable components and libraries
  • WAFs can afford some level of protection against certain attack types

SAST can detect common coding vulnerabilities in API code (such as injection flaws) but will not detect API-specific flaws (such as broken authentication or authorization), since the SAST engine does not have contextual awareness of the underlying API code. Similarly, DAST is able to detect certain API vulnerabilities (such as a lack of rate limiting) but lacks the context to understand the API requests and responses.

WAFs are a mature technology for protecting web applications and offer some protection for APIs as well. They operate in line with traffic utilizing a so-called allow list to block suspected malicious traffic and allowing everything else. They can be configured to operate in monitor mode (passive) or blocking mode (active).

Organizations typically have dedicated security teams tasked with deploying and operating these tools within development teams. These teams should evaluate dedicated API security tools to complement some of the gaps that exist with these tools.

API management and gateways

API gateways are the workhorse of the API industry, providing a unified external interface to public clients and traffic routing to the relevant internal API backends after having performed transformation and conversion. Gateways are also responsible for network-level controls such as SSL termination, rate-limiting, IP address restrictions, and load balancing. Gateways can also implement security features such as JWT validation and identity management.

Some of the shortcomings of API gateways include the following:

  • API gateways provide a central point of entry for API traffic and are effective at acting as a gatekeeper at the front door of the customer infrastructure; however, they are less effective at protecting what goes on behind the door
  • Gateways are ineffective at protecting against several of the OWASP API Security Top 10 vulnerabilities
  • Gateways can be inefficient at providing security processing functions such as traffic inspection

Typically, API management portals provide a level of API management on top of a gateway, allowing organizations to control their inventory, versioning, life cycle, and end-user experience by providing API catalogs.

Some of the shortcomings of API management platforms include the following:

  • APIM portals are effective for providing a central view of an API inventory and also a single point of deployment for API policy
  • Effective APIM deployment is contingent on development teams embracing a design-first approach and enrolling their APIs into a central portal

Both API management portals and gateways are vital components of an API security strategy, but their limitations should be borne in mind as part of the overall strategy.

API security platforms

The growth of API adoption has spawned several dedicated API security platforms, with the specific intent of addressing API security as a first-class citizen.

These platforms take different perspectives of securing APIs, including the following:

  • Continuous monitoring of API traffic to detect emergent threats using machine learning (ML) and artificial intelligence (AI) technology
  • Dedicated API firewalls that can protect APIs by enforcing the OpenAPI contract – this is the positive security model covered in the next section
  • Scanning APIs to validate the API behavior against an OpenAPI contract
  • Providing audit tools to ensure OpenAPI contracts adhere to best practices for data and security

Dedicated API security tools are vital to providing the final layer of API security. Now that we understand the elements of API security, let us conclude this chapter by setting API security goals.

You have been reading a chapter from
Defending APIs
Published in: Feb 2024
Publisher: Packt
ISBN-13: 9781804617120
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime