SlideShare a Scribd company logo
2
Most read
5
Most read
15
Most read
Rest API Security
A Quick Introduction Of Rest API security
Mohammed Fazuluddin
Topics
 Overview
 Rest API Security Methods
 Details Of Security Methods
 Comparisons Oauth2, OpenId and SAML
 Selection Of Rest API Security Method
 Best Practices To Secure REST API’S
Overview
 Authentication is common way to handle security for all applications.
 The basic keywords engaged in this process is “Authentication” and “Authorization”.
Authentication can be defined as the process of verifying someone’s identity by using pre-
required details (Commonly username and password).
 Authorization is the process of allowing an authenticated user to access a specified resource (Ex:-
right to access a file).
 To secure the information which will be rendered in the client side then it should controlled be
access the data with Authentication.
 Currently lot of websites has integrated with security systems to protect their data from the
hackers and to protect the data they should access the Rest API’s securely.
Rest API Security Methods
 Following are the commonly used Rest API security methods which can be used to protect the
Rest API access from the hackers.
 Cookie-Based authentication
 Token-Based authentication
 Third party access(OAuth, API-token)
 OpenId
 SAML
Details Of Security Methods
 Cookie based authentication:
 has been the default method for handling user authentication for a long time.
 The client posts the login credential to the server, server verifies the credential and creates session id
which is stored in server(state-full) and returned to client via set-cookie.
 On subsequent request the session id from the cookie is verified in the server and the request get
processed.
 Upon logout session id will be cleared from both client cookie and server.
Details Of Security Methods
Details Of Security Methods
 Token based authentication:
 single page applications(SPA) and statelessness(RESTful API’s)of the application.
 There are different ways to implement token based authentication, we will focusing on most commonly
used JSON Web Token(JWT).
 On receiving the credentials from client the server validates the credentials and generates a signed JWT
which contains the user information. Note, the token will never get stored in server(stateless).
 On subsequent request the token will be passed to server and gets verified(decoded) in the server. The
token can be maintained at client side in local storage, session storage or even in cookies.
Details Of Security Methods
Details Of Security Methods
 Third party access(OAuth, API-token):
 if we have a need to expose our API’s outside of our system like third party app or even to access it from
mobile apps we end up in two common ways to share the user information.
 Via API-token which is same as JWT token, where the token will be send via Authorization header which
will get handled at API gateway to authenticate the user.
 The other option is via Open Authentication(OAuth),OAuth is a protocol that allows an application to
authenticate against server as a user.
 The recommendation is to implement OAuth 1.0a or OAuth 2.0. OAuth 2.0 relies on HTTPS for security
and it currently implemented by Google, Facebook, Twitter etc., OAuth 2 provides secured delegate
access to a resource based on user..
Details Of Security Methods
Details Of Security Methods
 OpenId:
 is HTTP based protocol that uses identity provider to validate a user.
 The user password is secured with one identity provider, this allows other service providers a way to
achieve Single SignOn(SSO) without requiring password from user.
 There are many OpenId enabled account on the internet and organizations such as Google, Facebook,
Wordpress, Yahoo, PayPal etc., uses OpenId to authenticate users.
 The latest version of OpenId is OpenId Connect, which provides OpenId(authentication) on top of OAuth
2.0(authorization) for complete security solution.
Details Of Security Methods
Details Of Security Methods
 SAML:
 Security assertion markup language makes use of the same Identity provider which we saw in OpenId,
but it is XML based and more flexible.
 The recommended version for SAML is 2.0. SAML also provides a way to achieve Single SignOn(SSO).
 User can make use of the Identity provider URL to login into the system which redirects with XML data
back to your application page which can then be decoded to get the user information.
 We have SAML providers like G Suite, Office 365, OneLogin, Okta etc.,.
Details Of Security Methods
Comparisons Oauth2, OpenId and SAML
Selection Of Rest API Security Method
 If you have to support a web application only, either cookies or tokens are fine - for cookies think
about XSRF, for JWT take care of XSS.
 If you have to support both a web application and a mobile client, go with an API that supports
token-based authentication.
 If you are building APIs that communicate with each other, go with request signing.
Best Practices To Secure REST API’S
 Protect HTTP Methods:
 RESTful APIs often use GET (read), POST (create), PUT (replace/update) and DELETE (to delete a
record).Not all of these are valid choices for every single resource collection, user, or action.
 Make sure the incoming HTTP method is valid for the session token/API key and associated resource
collection, action, and record.
 Protect HTTP Methods:
 It is common with RESTful services to allow multiple methods for a given URL for different operations on
that entity.For example, a GET request might read the entity, while PUT would update an existing entity,
POST would create a new entity, and DELETE would delete an existing entity.
Best Practices To Secure REST API’S
 Protect Privileged Actions and Sensitive Resource Collections:
 The session token or API key should be sent along as a cookie or body parameter to ensure that
privileged collections or actions are properly protected from unauthorized use.
 Protect Against Cross-Site Request Forgery:
 For resources exposed by RESTful web services, it's important to make sure any PUT, POST, and DELETE
request is protected from Cross-Site Request Forgery.
 Typically, one would use a token-based approach. CSRF is easily achieved — even using random tokens
— if any XSS exists within your application, so please make sure you understand how to prevent XSS.
Best Practices To Secure REST API’S
 URL Validations:
 Web applications/web services use input from HTTP requests (and occasionally files) to determine how
to respond.
 Attackers can tamper with any part of an HTTP request, including the URL, query string, headers,
cookies, form fields, and hidden fields, to try to bypass the site’s security mechanisms.
 XML Input Validation:
 XML-based services must ensure that they are protected against common XML-based attacks by using
secure XML-parsing.
 This typically means protecting against XML External Entity attacks, XML-signature wrapping, etc.
Best Practices To Secure REST API’S
 Security Headers:
 To make sure the content of a given resource is interpreted correctly by the browser, the server should
always send the Content-Type header with the correct Content-Type, and the Content-Type header
should preferably include a charset.
 The server should also send an X-Content-Type-Options: nosniff to make sure the browser does not try
to detect a different Content-Type than what is actually sent (as this can lead to XSS).
 JSON Encoding:
 A key concern with JSON encoders is preventing arbitrary JavaScript remote code execution within the
browser... or, if you're using Node.js, on the server.
 It's vital that you use a proper JSON serializer to encode user-supplied data properly to prevent the
execution of user-supplied input on the browser.
THANKS
If you feel that it is helpful and worthy to share with others then please like and share the same.

More Related Content

PDF
API Security Best Practices & Guidelines
PDF
REST API Authentication Methods.pdf
PPTX
Getting Started with API Security Testing
PPTX
API Security Lifecycle
PPTX
API Design- Best Practices
PPTX
Restful api
PDF
Peeling the Onion: Making Sense of the Layers of API Security
API Security Best Practices & Guidelines
REST API Authentication Methods.pdf
Getting Started with API Security Testing
API Security Lifecycle
API Design- Best Practices
Restful api
Peeling the Onion: Making Sense of the Layers of API Security

What's hot (20)

PDF
Api security-testing
PPTX
API Security Fundamentals
PPTX
REST API Design & Development
PPTX
Rest API Security
PDF
API Security Best Practices and Guidelines
PDF
OWASP API Security Top 10 - API World
PPTX
Spring Security 5
PDF
Adopting HashiCorp Vault
PDF
OAuth 2.0
PPTX
Spring boot
PDF
OWASP API Security Top 10 Examples
PDF
OWASP Top 10 Web Application Vulnerabilities
PDF
API Security Best Practices & Guidelines
PPTX
security misconfigurations
PPT
iOS Application Pentesting
PPTX
Practical Application of the API Security Top Ten: A Tester's Perspective
PPTX
OWASP Top 10 2021 Presentation (Jul 2022)
PPTX
Understanding REST APIs in 5 Simple Steps
PDF
Spring Security
PDF
Api presentation
Api security-testing
API Security Fundamentals
REST API Design & Development
Rest API Security
API Security Best Practices and Guidelines
OWASP API Security Top 10 - API World
Spring Security 5
Adopting HashiCorp Vault
OAuth 2.0
Spring boot
OWASP API Security Top 10 Examples
OWASP Top 10 Web Application Vulnerabilities
API Security Best Practices & Guidelines
security misconfigurations
iOS Application Pentesting
Practical Application of the API Security Top Ten: A Tester's Perspective
OWASP Top 10 2021 Presentation (Jul 2022)
Understanding REST APIs in 5 Simple Steps
Spring Security
Api presentation
Ad

Similar to Rest API Security - A quick understanding of Rest API Security (20)

PDF
PPT
Securing RESTful API
PPTX
Unit 3_detailed_automotiving_mobiles.pptx
PPTX
HTTP Services & REST API Security
PPTX
APIs: The New Security Layer
PDF
RESTful Day 5
PPTX
REST API Security: OAuth 2.0, JWTs, and More!
PDF
Enhancing your Security APIs
PDF
Techniques for securing rest
PDF
Protecting Your APIs Against Attack & Hijack
PPTX
Best Practices You Must Apply to Secure Your APIs - Scott Morrison, SVP & Dis...
PPTX
Enterprise Access Control Patterns for Rest and Web APIs
PPTX
Secure Coding: SSL, SOAP, and REST
PDF
APIsecure 2023 - API Security - doing more with less, Nir Paz (Standard.ai)
PPTX
How to build Simple yet powerful API.pptx
PPTX
REST-Api Design & Develop
PPTX
Web API Security
PPTX
Secureyourrestapi 140530183606-phpapp02
PDF
APIsecure 2023 - OAuth, OIDC and protecting third-party credentials, Ed Olson...
PDF
Oauth Nightmares Abstract OAuth Nightmares
Securing RESTful API
Unit 3_detailed_automotiving_mobiles.pptx
HTTP Services & REST API Security
APIs: The New Security Layer
RESTful Day 5
REST API Security: OAuth 2.0, JWTs, and More!
Enhancing your Security APIs
Techniques for securing rest
Protecting Your APIs Against Attack & Hijack
Best Practices You Must Apply to Secure Your APIs - Scott Morrison, SVP & Dis...
Enterprise Access Control Patterns for Rest and Web APIs
Secure Coding: SSL, SOAP, and REST
APIsecure 2023 - API Security - doing more with less, Nir Paz (Standard.ai)
How to build Simple yet powerful API.pptx
REST-Api Design & Develop
Web API Security
Secureyourrestapi 140530183606-phpapp02
APIsecure 2023 - OAuth, OIDC and protecting third-party credentials, Ed Olson...
Oauth Nightmares Abstract OAuth Nightmares
Ad

More from Mohammed Fazuluddin (20)

PDF
Cloud Providers and Their Key Features Explained
PDF
Database Performance Handling : A comprehensive guide
PDF
Design patterns Q&A | Important question and answers
PDF
Software-Requirements-to-System-Design Basics
PDF
MEAN-vs-MERN-A-Developers-Guide and Explanation
PDF
Cloud AI Deployment Design Patterns - Learn the Basic Deployment Patterns
PDF
Auto-scaling-real-time-software-applications-and-best-practices.pdf
PDF
Java Version(v5 -v23) Features with sample code snippet
PDF
Cloud Architecture Framework Pillar’s.pdf
PDF
Implementing Generative AI and Machine Learning on GCP: Architectures, Use Ca...
PDF
LEVERAGING AWS GENERATIVE AI: ARCHITECTURAL INSIGHTS AND REAL-WORLD IMPLEMENT...
PDF
Basics of GraphQL : Unlocking the Power of GraphQL
PPTX
SQL Injection Introduction and Prevention
PPTX
DOMAIN DRIVER DESIGN
PPTX
New Relic Basics
PPTX
Terraform Basics
PPTX
Software architectural patterns - A Quick Understanding Guide
PPTX
Mule ESB - An Enterprise Service Bus
PPTX
Docker - A Quick Introduction Guide
PPTX
Cassandra - A Basic Introduction Guide
Cloud Providers and Their Key Features Explained
Database Performance Handling : A comprehensive guide
Design patterns Q&A | Important question and answers
Software-Requirements-to-System-Design Basics
MEAN-vs-MERN-A-Developers-Guide and Explanation
Cloud AI Deployment Design Patterns - Learn the Basic Deployment Patterns
Auto-scaling-real-time-software-applications-and-best-practices.pdf
Java Version(v5 -v23) Features with sample code snippet
Cloud Architecture Framework Pillar’s.pdf
Implementing Generative AI and Machine Learning on GCP: Architectures, Use Ca...
LEVERAGING AWS GENERATIVE AI: ARCHITECTURAL INSIGHTS AND REAL-WORLD IMPLEMENT...
Basics of GraphQL : Unlocking the Power of GraphQL
SQL Injection Introduction and Prevention
DOMAIN DRIVER DESIGN
New Relic Basics
Terraform Basics
Software architectural patterns - A Quick Understanding Guide
Mule ESB - An Enterprise Service Bus
Docker - A Quick Introduction Guide
Cassandra - A Basic Introduction Guide

Recently uploaded (20)

PDF
Odoo Companies in India – Driving Business Transformation.pdf
PPTX
Computer Software and OS of computer science of grade 11.pptx
PDF
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
PPTX
CHAPTER 2 - PM Management and IT Context
PDF
System and Network Administration Chapter 2
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PDF
Designing Intelligence for the Shop Floor.pdf
PPTX
Operating system designcfffgfgggggggvggggggggg
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PPTX
assetexplorer- product-overview - presentation
PDF
Understanding Forklifts - TECH EHS Solution
PDF
Softaken Excel to vCard Converter Software.pdf
PDF
medical staffing services at VALiNTRY
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PPT
Introduction Database Management System for Course Database
PPTX
Transform Your Business with a Software ERP System
Odoo Companies in India – Driving Business Transformation.pdf
Computer Software and OS of computer science of grade 11.pptx
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
CHAPTER 2 - PM Management and IT Context
System and Network Administration Chapter 2
How to Migrate SBCGlobal Email to Yahoo Easily
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
Designing Intelligence for the Shop Floor.pdf
Operating system designcfffgfgggggggvggggggggg
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
assetexplorer- product-overview - presentation
Understanding Forklifts - TECH EHS Solution
Softaken Excel to vCard Converter Software.pdf
medical staffing services at VALiNTRY
Design an Analysis of Algorithms I-SECS-1021-03
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
Navsoft: AI-Powered Business Solutions & Custom Software Development
Wondershare Filmora 15 Crack With Activation Key [2025
Introduction Database Management System for Course Database
Transform Your Business with a Software ERP System

Rest API Security - A quick understanding of Rest API Security

  • 1. Rest API Security A Quick Introduction Of Rest API security Mohammed Fazuluddin
  • 2. Topics  Overview  Rest API Security Methods  Details Of Security Methods  Comparisons Oauth2, OpenId and SAML  Selection Of Rest API Security Method  Best Practices To Secure REST API’S
  • 3. Overview  Authentication is common way to handle security for all applications.  The basic keywords engaged in this process is “Authentication” and “Authorization”. Authentication can be defined as the process of verifying someone’s identity by using pre- required details (Commonly username and password).  Authorization is the process of allowing an authenticated user to access a specified resource (Ex:- right to access a file).  To secure the information which will be rendered in the client side then it should controlled be access the data with Authentication.  Currently lot of websites has integrated with security systems to protect their data from the hackers and to protect the data they should access the Rest API’s securely.
  • 4. Rest API Security Methods  Following are the commonly used Rest API security methods which can be used to protect the Rest API access from the hackers.  Cookie-Based authentication  Token-Based authentication  Third party access(OAuth, API-token)  OpenId  SAML
  • 5. Details Of Security Methods  Cookie based authentication:  has been the default method for handling user authentication for a long time.  The client posts the login credential to the server, server verifies the credential and creates session id which is stored in server(state-full) and returned to client via set-cookie.  On subsequent request the session id from the cookie is verified in the server and the request get processed.  Upon logout session id will be cleared from both client cookie and server.
  • 7. Details Of Security Methods  Token based authentication:  single page applications(SPA) and statelessness(RESTful API’s)of the application.  There are different ways to implement token based authentication, we will focusing on most commonly used JSON Web Token(JWT).  On receiving the credentials from client the server validates the credentials and generates a signed JWT which contains the user information. Note, the token will never get stored in server(stateless).  On subsequent request the token will be passed to server and gets verified(decoded) in the server. The token can be maintained at client side in local storage, session storage or even in cookies.
  • 9. Details Of Security Methods  Third party access(OAuth, API-token):  if we have a need to expose our API’s outside of our system like third party app or even to access it from mobile apps we end up in two common ways to share the user information.  Via API-token which is same as JWT token, where the token will be send via Authorization header which will get handled at API gateway to authenticate the user.  The other option is via Open Authentication(OAuth),OAuth is a protocol that allows an application to authenticate against server as a user.  The recommendation is to implement OAuth 1.0a or OAuth 2.0. OAuth 2.0 relies on HTTPS for security and it currently implemented by Google, Facebook, Twitter etc., OAuth 2 provides secured delegate access to a resource based on user..
  • 11. Details Of Security Methods  OpenId:  is HTTP based protocol that uses identity provider to validate a user.  The user password is secured with one identity provider, this allows other service providers a way to achieve Single SignOn(SSO) without requiring password from user.  There are many OpenId enabled account on the internet and organizations such as Google, Facebook, Wordpress, Yahoo, PayPal etc., uses OpenId to authenticate users.  The latest version of OpenId is OpenId Connect, which provides OpenId(authentication) on top of OAuth 2.0(authorization) for complete security solution.
  • 13. Details Of Security Methods  SAML:  Security assertion markup language makes use of the same Identity provider which we saw in OpenId, but it is XML based and more flexible.  The recommended version for SAML is 2.0. SAML also provides a way to achieve Single SignOn(SSO).  User can make use of the Identity provider URL to login into the system which redirects with XML data back to your application page which can then be decoded to get the user information.  We have SAML providers like G Suite, Office 365, OneLogin, Okta etc.,.
  • 16. Selection Of Rest API Security Method  If you have to support a web application only, either cookies or tokens are fine - for cookies think about XSRF, for JWT take care of XSS.  If you have to support both a web application and a mobile client, go with an API that supports token-based authentication.  If you are building APIs that communicate with each other, go with request signing.
  • 17. Best Practices To Secure REST API’S  Protect HTTP Methods:  RESTful APIs often use GET (read), POST (create), PUT (replace/update) and DELETE (to delete a record).Not all of these are valid choices for every single resource collection, user, or action.  Make sure the incoming HTTP method is valid for the session token/API key and associated resource collection, action, and record.  Protect HTTP Methods:  It is common with RESTful services to allow multiple methods for a given URL for different operations on that entity.For example, a GET request might read the entity, while PUT would update an existing entity, POST would create a new entity, and DELETE would delete an existing entity.
  • 18. Best Practices To Secure REST API’S  Protect Privileged Actions and Sensitive Resource Collections:  The session token or API key should be sent along as a cookie or body parameter to ensure that privileged collections or actions are properly protected from unauthorized use.  Protect Against Cross-Site Request Forgery:  For resources exposed by RESTful web services, it's important to make sure any PUT, POST, and DELETE request is protected from Cross-Site Request Forgery.  Typically, one would use a token-based approach. CSRF is easily achieved — even using random tokens — if any XSS exists within your application, so please make sure you understand how to prevent XSS.
  • 19. Best Practices To Secure REST API’S  URL Validations:  Web applications/web services use input from HTTP requests (and occasionally files) to determine how to respond.  Attackers can tamper with any part of an HTTP request, including the URL, query string, headers, cookies, form fields, and hidden fields, to try to bypass the site’s security mechanisms.  XML Input Validation:  XML-based services must ensure that they are protected against common XML-based attacks by using secure XML-parsing.  This typically means protecting against XML External Entity attacks, XML-signature wrapping, etc.
  • 20. Best Practices To Secure REST API’S  Security Headers:  To make sure the content of a given resource is interpreted correctly by the browser, the server should always send the Content-Type header with the correct Content-Type, and the Content-Type header should preferably include a charset.  The server should also send an X-Content-Type-Options: nosniff to make sure the browser does not try to detect a different Content-Type than what is actually sent (as this can lead to XSS).  JSON Encoding:  A key concern with JSON encoders is preventing arbitrary JavaScript remote code execution within the browser... or, if you're using Node.js, on the server.  It's vital that you use a proper JSON serializer to encode user-supplied data properly to prevent the execution of user-supplied input on the browser.
  • 21. THANKS If you feel that it is helpful and worthy to share with others then please like and share the same.