Patrick Poulin
�API Fortress
a Sauce Labs company
© 2021 SAUCE LABS | PRIVATE AND CONFIDENTIAL | 14 SEP 2021
1
Keys to API Testing
© 2021 SAUCE LABS | PRIVATE AND CONFIDENTIAL
2
2
API FORTRESS
Patrick Poulin
DIRECTOR OF PRODUCT
API FORTRESS
Who are we?
API Fortress has been in the API testing and monitoring space since 2014 when we started building the platform’s SaaS version
Now we have thousands of users spread all over the world, and offer both a SaaS and self-hosted version
3
TEXT & IMAGE
© 2021 SAUCE LABS, INC | PRIVATE & CONFIDENTIAL
Fun API facts
© 2021 SAUCE LABS | PRIVATE AND CONFIDENTIAL
4
4
API FUN FACTS
Of security fails
Of website traffic
83% of all web traffic in 2018 was API traffic
Through 2022, at least 95% of cloud security failures will be the customer’s fault
5
95%
83%
State of the Internet 2018
Jay Heiser, VP Analyst
© 2021 SAUCE LABS, INC | PRIVATE & CONFIDENTIAL
FUNCTIONAL TESTING = SECURITY
India Public Utilities
United States Postal Service
3 recent vulnerabilities
Exposed the phone numbers of 17 million accounts
1.1 billion customer identities exposed
Exposed the data of 60 million users
6
© 2021 SAUCE LABS, INC | PRIVATE & CONFIDENTIAL
RECENT VULNERABILITIES
7
Exposed the phone numbers of 17 million accounts
Twitter’s breach may have been due to a simple design flaw. During registration, you could connect with people in your Contacts.
The problem was a lack of rate limiting. This led to bad actor countries guessing phone numbers and connecting people’s personal numbers with their Twitter accounts. Not everyone wants their Twitter identities tied to them personally and professionally for reasons that may include blackmail.
© 2021 SAUCE LABS, INC | PRIVATE & CONFIDENTIAL
RECENT VULNERABILITIES
8
1.1 Billion customer identities exposed
In India, there was a huge breach with a company named Indane, a large utility company in India. When creating an account, they would verify your personal information using the Aadhar API.
The problem was that it was publicly accessible and had no rate limiting. This meant that anyone could guess millions of “social security” numbers, and if they were right, they got someone’s personal information. Aadhar exposed 1.1 billion customers as part of the breach.
India & Public Utilities
© 2021 SAUCE LABS, INC | PRIVATE & CONFIDENTIAL
RECENT VULNERABILITIES
9
Exposed data of 60 million users
The USPS had 60 million customers with private information potentially exposed due to their package tracker API.
All a bad actor had to do was when making the API call, search for a package. Then the hacker would replace tracking numbers with an asterisk (wildcard), causing it to return all customer data.
US Postal Service
© 2021 SAUCE LABS, INC | PRIVATE & CONFIDENTIAL
© 2021 SAUCE LABS, INC | PRIVATE & CONFIDENTIAL
What is continuous quality?
© 2021 SAUCE LABS | PRIVATE AND CONFIDENTIAL
10
10
CONTINUOUS QUALITY
11
MONITORING
PERFORMANCE
TESTING
AUTOMATED
CI/CD
FUNCTIONAL + INTEGRATION
TESTING
© 2021 SAUCE LABS, INC | PRIVATE & CONFIDENTIAL
SHOW ME HOW
One Successful Work Flow
12
© 2021 SAUCE LABS, INC | PRIVATE & CONFIDENTIAL
REMOVE THE SILOS
13
© 2021 SAUCE LABS, INC | PRIVATE & CONFIDENTIAL
START WITH A SPEC
Open API initiative
Swagger
Postman
14
© 2021 SAUCE LABS, INC | PRIVATE & CONFIDENTIAL
FUNCTIONAL TEST
15
[
{
quantity: 5,
color: ["white","red"],
price: 29.99,
imageURL: http://apif.com/baseball_cap.jpg,
name: "Baseball Cap",
description: "Boston Red Sox Baseball Cap",
id: 1,
category: "head",
},
{
quantity: 7,
color: ["blue","yellow","red"],
price: 39.99,
imageURL: http://apif.com/long_sleev_shirt.jpg,
name: "Long Sleeve Shirt",
description: "A wonderful long sleeve shirt",
id: 2,
category: "body",
},
{
quantity: 50,
color: ["red","gray"],
price: 49.99,
imageURL: http://apif.com/earmuffs.jpg,
name: "Earmuffs",
description: "Keep those ears warm in the winter!",
id: 3,
category: "ears",
},
]
http://demoapi.apifortress.com/api/retail/product?q=red
© 2021 SAUCE LABS, INC | PRIVATE & CONFIDENTIAL
REPRODUCE USER FLOWS
16
© 2021 SAUCE LABS, INC | PRIVATE & CONFIDENTIAL
END-TO-END / INTEGRATION TEST
17
[
{
quantity: 50,
color: ["red","gray"],
price: 49.99,
imageURL: http://apif.com/earmuffs.jpg,
name: "Earmuffs",
description: "Keep those ears warm in the winter!",
id: 3,
category: "ears",
},
]
http://demoapi.apifortress.com/api/retail/product?q=red
http://demoapi.apifortress.com/api/retail/product/3
© 2021 SAUCE LABS, INC | PRIVATE & CONFIDENTIAL
Who Owns Functional Uptime?
© 2021 SAUCE LABS | PRIVATE AND CONFIDENTIAL
18
18
MONITORING PLATFORMS
19
© 2021 SAUCE LABS, INC | PRIVATE & CONFIDENTIAL
PLATFORM SHORTCOMINGS
20
© 2021 SAUCE LABS, INC | PRIVATE & CONFIDENTIAL
Show Me
© 2021 SAUCE LABS | PRIVATE AND CONFIDENTIAL
21
21
Best Practices
© 2021 SAUCE LABS | PRIVATE AND CONFIDENTIAL
22
22
BEST PRACTICES
Test everything
Test objects & data
Monitor production using function tests
23
© 2021 SAUCE LABS, INC | PRIVATE & CONFIDENTIAL
Variabilize for test reuse
Confirm business logic and datatypes
Use dynamic data
Integration / End-to-end test
Confirm response matches request
BEST PRACTICES
24
z
© 2021 SAUCE LABS, INC | PRIVATE & CONFIDENTIAL
Thank you
25
25
PATRICK.POULIN@SAUCELABS.COM
Patrick Poulin
Director of Product