SlideShare a Scribd company logo
April 27, 2018
PRESENTED
BY
Designing & Building Secure Web APIs
Vivek Thuravupala
Software Engineer @ Postman
Postman, API Development Environment
Relevance
APIs have been
exploding.
THOUSANDS
OF APIs!
So has API usage.
15B+ 10B+ 7B+
Average Daily API Calls
(2016)
Source: Programmable Web
The API Lifecycle
Designing & Building Secure Web APIs
Application & API
Collation, Transformation...
Data-source
Database, cache, 3rd Party
API, etc.
Client
API Consumption & Presentation


Let’s build a GitHub proxy API!
Application & API
Collation, Transformation...
Data-source
Database, cache, 3rd Party
API, etc.
Client
API Consumption & Presentation


Design
! Why build this API?
! Who is your consumer?
! What can they do with your API?
! Public consumption of private resources
! An open public-facing website
! Fetch activity frequency
Planning
! Why build this API?
! Who is your consumer?
! What can they do with your API?
! Public consumption of private resources
! An open public-facing website
! Fetch activity frequency
Planning
! Public consumption of private resources
! An open public-facing website
! Fetch activity frequency
! Why build this API?
! Who is your consumer?
! What can they do with your API?
Planning
Let’s take a quick peek
at the GitHub API
TODO: Add API screenshots here
TODO: Add API screenshots here
TODO: Add API screenshots here
Application & API
Collation, Transformation...
Data-source
Database, cache, 3rd Party
API, etc.
Client
API Consumption & Presentation


Browser
Security Blanket
! CORS
! HTTPS
! Strict-Transport-Security
! Set-Cookie: SameSite, Secure,
HttpOnly
! X-Frame-Options
! Hide Application/Framework Headers
Leverage the ecosystem
Security Blanket
Reference: MDN
Cross-origin Resource Sharing
Chrome 4+, Edge 12+, FF 3.5+, IE 10+, Safari 4+
https://www.origin2.com
Get all emails
https://www.origin1.com
XHR/Fetch call
Security Blanket
Reference: MDN
Cross-origin Resource Sharing
https://www.origin2.com
https://www.origin1.com
XHR/Fetch call
Chrome 4+, Edge 12+, FF 3.5+, IE 10+, Safari 4+
Security Blanket
Reference: MDN
Cross-origin Resource Sharing
https://www.origin2.com
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: POST
https://www.origin1.com
XHR/Fetch call
OPTIONS POST
Chrome 4+, Edge 12+, FF 3.5+, IE 10+, Safari 4+
Cross-origin Resource Sharing
Security Blanket
! XMLHttpRequest , Fetch API follow
same-origin policy
! Different domain, protocol, or port
! Uses a pre-flight request if necessaryChrome 4+, Edge 12+, FF 3.5+, IE 10+, Safari 4+
Reference: MDN
Security Blanket
! HTTP over TLS
! Enforced on the client
! Does not hide origin/destination IP
Chrome 4+, Edge 12+, FF 4+, IE 11, Safari 7+
Reference: MDN
HTTPS + HSTS
Security Blanket
Reference: MDN
HTTPS + HSTS
Server
https://www.origin1.com
XHR/Fetch call, Document request
GET, *
Strict-Transport-Security
max-age: 31536000;
includeSubdomains
Chrome 4+, Edge 12+, FF 4+, IE 11, Safari 7+
Security Blanket
Reference: MDN
HTTPS + HSTS
Server
https://www.origin1.com
XHR/Fetch call, Document request
HTTP *
Chrome 4+, Edge 12+, FF 4+, IE 11, Safari 7+
Security Blanket
! Secure
○ Transmit only over HTTPS
! HttpOnly
○ Disallow access via JS
! SameSite (Chrome, Opera)
○ Useful against CSRF
Reference: MDN
Set-Cookie Flags
Chrome 1+, Edge, FF 3+, IE 9, Safari 5+
Security Blanket
! CSP
! X-XSS-Options
! X-Content-Type-Options
! Referrer-Policy
! Subresource Integrity
Just to note, if you’re serving a UI and not just an API.
Reference: MDN
Resource Representation
! Decoupled representation
! Sanitized
! Leverage HTTP(s)
○ Keep real-world quirks in mind!
Internal vs. External
Design, Mock, Debug
! Do it all in one place
Our first priority is to get a usable API.
TODO: Add mock/test screenshots/video herehttps://www.townscript.com/e/walmart-meetup/booking
TODO: Add mock/test screenshots/video here
TODO: Add mock/test screenshots/video herehttps://www.townscript.com/e/walmart-meetup/booking
TODO: Add mock/test screenshots/video here
Versioning
A quick word.
Versioning
! Twitter, 3 versions, 5 years
! Google Maps, 3 versions, 8+ years
! GitHub, 3 versions, 6+ years
Try to avoid (breaking) versioning
Versioning ! Facebook Graph API
! Versions: ¯_(ツ)_/¯Try to avoid (breaking) versioning
Versioning
! Publishers want to update ASAP
! Consumers want to avoid updating
! Multiple versions = increased attack
surface
Try to avoid (breaking) versioning
Build
Security Blanket
! Enforce using static code analysis &
testing
! Architecture as a forcing function
Reference: MDN
Security Blanket
! Lint for security
! Test for security
! Make it harder to be insecure
Static code analysis & testing
Security Blanket
Architecture as a forcing function
! The larger your team, the more difficult
it is to enforce your design
“A forcing function is an aspect of a
design that prevents the user from
taking an action without consciously
considering information relevant to
that action.”
Security Blanket
Reference: Interaction Design Foundation
Architecture as a forcing function
Security Blanket
! Make it much harder to be insecure
Architecture as a forcing function
Incoming Request Controller
Application logic, doesn’t
have to worry about
headers at all.
Outgoing Policy
Adds all security headers
by default. Can be
configured with a list if
necessary.
Response
Response has headers
by default. It’s more work
to get rid of them.
Architecture as a forcing function
! Guidelines, not rules
! Do your own research
! Security comes in layers
Wrapping up
Thank You!
@godfrzero @postmanclient

More Related Content

PDF
Java Cloud and Container Ready
PPTX
Advanced Postman for Better APIs - Web Summit 2018 - Cisco DevNet
PPTX
DevOops Redux Ken Johnson Chris Gates - AppSec USA 2016
PPTX
DEVNET-2003 Coding 203: Python - User Input, File I/O, Logging and REST API C...
PDF
Automated Infrastructure Security: Monitoring using FOSS
PDF
Operating Docker
PDF
Csaba fitzl - Mount(ain) of Bugs
PDF
Security Patterns for Microservice Architectures - London Java Community 2020
Java Cloud and Container Ready
Advanced Postman for Better APIs - Web Summit 2018 - Cisco DevNet
DevOops Redux Ken Johnson Chris Gates - AppSec USA 2016
DEVNET-2003 Coding 203: Python - User Input, File I/O, Logging and REST API C...
Automated Infrastructure Security: Monitoring using FOSS
Operating Docker
Csaba fitzl - Mount(ain) of Bugs
Security Patterns for Microservice Architectures - London Java Community 2020

What's hot (20)

PDF
Batten Down the Hatches: A Practical Guide to Securing Kubernetes - RMISC 2019
PDF
20+ ways to bypass your mac os privacy mechanisms
PDF
20+ Ways to Bypass Your macOS Privacy Mechanisms
PDF
Lock That Shit Down! Auth Security Patterns for Apps, APIs, and Infra - Joker...
PDF
The Future of Security and Productivity in Our Newly Remote World
PDF
How to debug IoT Agents
PPTX
Agility Requires Safety
PDF
Abusing, Exploiting and Pwning with Firefox Add-ons
PPTX
Hacking Tizen : The OS of Everything - Nullcon Goa 2015
PDF
JHipster and Okta - JHipster Virtual Meetup December 2020
PDF
Exploiting XPC in AntiVirus
PPTX
DevOOPS: Attacks and Defenses for DevOps Toolchains
PDF
Lares from LOW to PWNED
PDF
Mitigating Exploits Using Apple's Endpoint Security
PDF
Open Canary - novahackers
PDF
WebRTC beyond Audio and Video
PDF
Drone Continuous Integration
PDF
Roberto Clapis/Stefano Zanero - Night of the living vulnerabilities: forever-...
PDF
20+ Ways To Bypass Your Macos Privacy Mechanisms
PDF
Security in Serverless world
Batten Down the Hatches: A Practical Guide to Securing Kubernetes - RMISC 2019
20+ ways to bypass your mac os privacy mechanisms
20+ Ways to Bypass Your macOS Privacy Mechanisms
Lock That Shit Down! Auth Security Patterns for Apps, APIs, and Infra - Joker...
The Future of Security and Productivity in Our Newly Remote World
How to debug IoT Agents
Agility Requires Safety
Abusing, Exploiting and Pwning with Firefox Add-ons
Hacking Tizen : The OS of Everything - Nullcon Goa 2015
JHipster and Okta - JHipster Virtual Meetup December 2020
Exploiting XPC in AntiVirus
DevOOPS: Attacks and Defenses for DevOps Toolchains
Lares from LOW to PWNED
Mitigating Exploits Using Apple's Endpoint Security
Open Canary - novahackers
WebRTC beyond Audio and Video
Drone Continuous Integration
Roberto Clapis/Stefano Zanero - Night of the living vulnerabilities: forever-...
20+ Ways To Bypass Your Macos Privacy Mechanisms
Security in Serverless world
Ad

Similar to Designing & Building Secure Web APIs (20)

PDF
Protecting Your APIs Against Attack & Hijack
PDF
Api security-testing
PDF
Creating a RESTful api without losing too much sleep
PPTX
Best Practices You Must Apply to Secure Your APIs - Scott Morrison, SVP & Dis...
PDF
PDF
APIsecure 2023 - Exploring Advanced API Security Techniques and Technologies,...
PDF
OWASP API Security Top 10 Examples
PPTX
API Security - Null meet
PPTX
Rest WebAPI with OData
PDF
WebApp_to_Container_Security.pdf
PDF
Consumer centric api design v0.4.0
PPTX
Unit 3_detailed_automotiving_mobiles.pptx
PDF
Virtual Meetup - API Security Best Practices
PPTX
Secure Coding: SSL, SOAP, and REST
PPTX
How to get along with HATEOAS without letting the bad guys steal your lunch?
PDF
SecDevOps for API Security
PDF
APIdays Paris 2019 - API Security Tips for Developers by Isabelle Mauny, 42Cr...
PPTX
JSFoo Chennai 2012
PDF
APIdays London 2019 - API Security Tips for Developers with Isabelle Mauny, 4...
PPTX
A Starters Guide to Building APIs with Javascript
Protecting Your APIs Against Attack & Hijack
Api security-testing
Creating a RESTful api without losing too much sleep
Best Practices You Must Apply to Secure Your APIs - Scott Morrison, SVP & Dis...
APIsecure 2023 - Exploring Advanced API Security Techniques and Technologies,...
OWASP API Security Top 10 Examples
API Security - Null meet
Rest WebAPI with OData
WebApp_to_Container_Security.pdf
Consumer centric api design v0.4.0
Unit 3_detailed_automotiving_mobiles.pptx
Virtual Meetup - API Security Best Practices
Secure Coding: SSL, SOAP, and REST
How to get along with HATEOAS without letting the bad guys steal your lunch?
SecDevOps for API Security
APIdays Paris 2019 - API Security Tips for Developers by Isabelle Mauny, 42Cr...
JSFoo Chennai 2012
APIdays London 2019 - API Security Tips for Developers with Isabelle Mauny, 4...
A Starters Guide to Building APIs with Javascript
Ad

More from CodeOps Technologies LLP (20)

PDF
AWS Serverless Event-driven Architecture - in lastminute.com meetup
PPTX
Understanding azure batch service
PDF
DEVOPS AND MACHINE LEARNING
PDF
SERVERLESS MIDDLEWARE IN AZURE FUNCTIONS
PPT
BUILDING SERVERLESS SOLUTIONS WITH AZURE FUNCTIONS
PPTX
APPLYING DEVOPS STRATEGIES ON SCALE USING AZURE DEVOPS SERVICES
PPTX
BUILD, TEST & DEPLOY .NET CORE APPS IN AZURE DEVOPS
PPTX
CREATE RELIABLE AND LOW-CODE APPLICATION IN SERVERLESS MANNER
PPTX
CREATING REAL TIME DASHBOARD WITH BLAZOR, AZURE FUNCTION COSMOS DB AN AZURE S...
PPTX
WRITE SCALABLE COMMUNICATION APPLICATION WITH POWER OF SERVERLESS
PPTX
Training And Serving ML Model Using Kubeflow by Jayesh Sharma
PPTX
Deploy Microservices To Kubernetes Without Secrets by Reenu Saluja
PDF
Leverage Azure Tech stack for any Kubernetes cluster via Azure Arc by Saiyam ...
PDF
YAML Tips For Kubernetes by Neependra Khare
PDF
Must Know Azure Kubernetes Best Practices And Features For Better Resiliency ...
PPTX
Monitor Azure Kubernetes Cluster With Prometheus by Mamta Jha
PDF
Jet brains space intro presentation
PDF
Functional Programming in Java 8 - Lambdas and Streams
PPTX
Distributed Tracing: New DevOps Foundation
PDF
"Distributed Tracing: New DevOps Foundation" by Jayesh Ahire
AWS Serverless Event-driven Architecture - in lastminute.com meetup
Understanding azure batch service
DEVOPS AND MACHINE LEARNING
SERVERLESS MIDDLEWARE IN AZURE FUNCTIONS
BUILDING SERVERLESS SOLUTIONS WITH AZURE FUNCTIONS
APPLYING DEVOPS STRATEGIES ON SCALE USING AZURE DEVOPS SERVICES
BUILD, TEST & DEPLOY .NET CORE APPS IN AZURE DEVOPS
CREATE RELIABLE AND LOW-CODE APPLICATION IN SERVERLESS MANNER
CREATING REAL TIME DASHBOARD WITH BLAZOR, AZURE FUNCTION COSMOS DB AN AZURE S...
WRITE SCALABLE COMMUNICATION APPLICATION WITH POWER OF SERVERLESS
Training And Serving ML Model Using Kubeflow by Jayesh Sharma
Deploy Microservices To Kubernetes Without Secrets by Reenu Saluja
Leverage Azure Tech stack for any Kubernetes cluster via Azure Arc by Saiyam ...
YAML Tips For Kubernetes by Neependra Khare
Must Know Azure Kubernetes Best Practices And Features For Better Resiliency ...
Monitor Azure Kubernetes Cluster With Prometheus by Mamta Jha
Jet brains space intro presentation
Functional Programming in Java 8 - Lambdas and Streams
Distributed Tracing: New DevOps Foundation
"Distributed Tracing: New DevOps Foundation" by Jayesh Ahire

Recently uploaded (20)

PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PDF
Nekopoi APK 2025 free lastest update
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PDF
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PPTX
L1 - Introduction to python Backend.pptx
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PPTX
ai tools demonstartion for schools and inter college
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PDF
System and Network Administration Chapter 2
PDF
PTS Company Brochure 2025 (1).pdf.......
PDF
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
Nekopoi APK 2025 free lastest update
VVF-Customer-Presentation2025-Ver1.9.pptx
Adobe Illustrator 28.6 Crack My Vision of Vector Design
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
Design an Analysis of Algorithms I-SECS-1021-03
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
L1 - Introduction to python Backend.pptx
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
ai tools demonstartion for schools and inter college
Which alternative to Crystal Reports is best for small or large businesses.pdf
System and Network Administration Chapter 2
PTS Company Brochure 2025 (1).pdf.......
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
Design an Analysis of Algorithms II-SECS-1021-03
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...

Designing & Building Secure Web APIs

  • 1. April 27, 2018 PRESENTED BY Designing & Building Secure Web APIs Vivek Thuravupala Software Engineer @ Postman
  • 5. So has API usage. 15B+ 10B+ 7B+ Average Daily API Calls (2016) Source: Programmable Web
  • 8. Application & API Collation, Transformation... Data-source Database, cache, 3rd Party API, etc. Client API Consumption & Presentation 

  • 9. Let’s build a GitHub proxy API! Application & API Collation, Transformation... Data-source Database, cache, 3rd Party API, etc. Client API Consumption & Presentation 

  • 11. ! Why build this API? ! Who is your consumer? ! What can they do with your API? ! Public consumption of private resources ! An open public-facing website ! Fetch activity frequency Planning
  • 12. ! Why build this API? ! Who is your consumer? ! What can they do with your API? ! Public consumption of private resources ! An open public-facing website ! Fetch activity frequency Planning
  • 13. ! Public consumption of private resources ! An open public-facing website ! Fetch activity frequency ! Why build this API? ! Who is your consumer? ! What can they do with your API? Planning
  • 14. Let’s take a quick peek at the GitHub API
  • 15. TODO: Add API screenshots here
  • 16. TODO: Add API screenshots here
  • 17. TODO: Add API screenshots here
  • 18. Application & API Collation, Transformation... Data-source Database, cache, 3rd Party API, etc. Client API Consumption & Presentation 
 Browser
  • 19. Security Blanket ! CORS ! HTTPS ! Strict-Transport-Security ! Set-Cookie: SameSite, Secure, HttpOnly ! X-Frame-Options ! Hide Application/Framework Headers Leverage the ecosystem
  • 20. Security Blanket Reference: MDN Cross-origin Resource Sharing Chrome 4+, Edge 12+, FF 3.5+, IE 10+, Safari 4+ https://www.origin2.com Get all emails https://www.origin1.com XHR/Fetch call
  • 21. Security Blanket Reference: MDN Cross-origin Resource Sharing https://www.origin2.com https://www.origin1.com XHR/Fetch call Chrome 4+, Edge 12+, FF 3.5+, IE 10+, Safari 4+
  • 22. Security Blanket Reference: MDN Cross-origin Resource Sharing https://www.origin2.com Access-Control-Allow-Origin: * Access-Control-Allow-Methods: POST https://www.origin1.com XHR/Fetch call OPTIONS POST Chrome 4+, Edge 12+, FF 3.5+, IE 10+, Safari 4+
  • 23. Cross-origin Resource Sharing Security Blanket ! XMLHttpRequest , Fetch API follow same-origin policy ! Different domain, protocol, or port ! Uses a pre-flight request if necessaryChrome 4+, Edge 12+, FF 3.5+, IE 10+, Safari 4+ Reference: MDN
  • 24. Security Blanket ! HTTP over TLS ! Enforced on the client ! Does not hide origin/destination IP Chrome 4+, Edge 12+, FF 4+, IE 11, Safari 7+ Reference: MDN HTTPS + HSTS
  • 25. Security Blanket Reference: MDN HTTPS + HSTS Server https://www.origin1.com XHR/Fetch call, Document request GET, * Strict-Transport-Security max-age: 31536000; includeSubdomains Chrome 4+, Edge 12+, FF 4+, IE 11, Safari 7+
  • 26. Security Blanket Reference: MDN HTTPS + HSTS Server https://www.origin1.com XHR/Fetch call, Document request HTTP * Chrome 4+, Edge 12+, FF 4+, IE 11, Safari 7+
  • 27. Security Blanket ! Secure ○ Transmit only over HTTPS ! HttpOnly ○ Disallow access via JS ! SameSite (Chrome, Opera) ○ Useful against CSRF Reference: MDN Set-Cookie Flags Chrome 1+, Edge, FF 3+, IE 9, Safari 5+
  • 28. Security Blanket ! CSP ! X-XSS-Options ! X-Content-Type-Options ! Referrer-Policy ! Subresource Integrity Just to note, if you’re serving a UI and not just an API. Reference: MDN
  • 29. Resource Representation ! Decoupled representation ! Sanitized ! Leverage HTTP(s) ○ Keep real-world quirks in mind! Internal vs. External
  • 30. Design, Mock, Debug ! Do it all in one place Our first priority is to get a usable API.
  • 31. TODO: Add mock/test screenshots/video herehttps://www.townscript.com/e/walmart-meetup/booking
  • 32. TODO: Add mock/test screenshots/video here
  • 33. TODO: Add mock/test screenshots/video herehttps://www.townscript.com/e/walmart-meetup/booking
  • 34. TODO: Add mock/test screenshots/video here
  • 36. Versioning ! Twitter, 3 versions, 5 years ! Google Maps, 3 versions, 8+ years ! GitHub, 3 versions, 6+ years Try to avoid (breaking) versioning
  • 37. Versioning ! Facebook Graph API ! Versions: ¯_(ツ)_/¯Try to avoid (breaking) versioning
  • 38. Versioning ! Publishers want to update ASAP ! Consumers want to avoid updating ! Multiple versions = increased attack surface Try to avoid (breaking) versioning
  • 39. Build
  • 40. Security Blanket ! Enforce using static code analysis & testing ! Architecture as a forcing function Reference: MDN
  • 41. Security Blanket ! Lint for security ! Test for security ! Make it harder to be insecure Static code analysis & testing
  • 42. Security Blanket Architecture as a forcing function ! The larger your team, the more difficult it is to enforce your design
  • 43. “A forcing function is an aspect of a design that prevents the user from taking an action without consciously considering information relevant to that action.” Security Blanket Reference: Interaction Design Foundation Architecture as a forcing function
  • 44. Security Blanket ! Make it much harder to be insecure Architecture as a forcing function
  • 45. Incoming Request Controller Application logic, doesn’t have to worry about headers at all. Outgoing Policy Adds all security headers by default. Can be configured with a list if necessary. Response Response has headers by default. It’s more work to get rid of them. Architecture as a forcing function
  • 46. ! Guidelines, not rules ! Do your own research ! Security comes in layers Wrapping up