SlideShare a Scribd company logo
Building a secure BFF
Ankit Muchhala - Postman
ankit_muchhala
MicroservicesMonolith
Backend For Frontend
• BFF is an API Gateway designed
for a specific UI to interact with
microservices.
• Abstracts away implementation
details from client.
• Reduces network chatter and
improves performance.
Security concerns?
• Single point of failure and attack.
• Public facing service.
• Handles user input.
• How to quantify these for an API?
Security Parameters
Confidentiality Integrity Availability
Only authorised people
can access appropriate
data.
Data delivered by your
service is not tampered
with.
Content is available to
authorised users to on
demand.
Building a secure BFF at Postman
Service
Server side code which
contains your business logic
Validation
• BFF should not perform all
validations.
• It should perform ecosystem
checks - auth, validate header.
• Business logic specific checks
are deferred to downstream
services.
Critical Path
• Services called before request
reaches the business logic.
• Critical path length is an
indicator of the amount of
validation done on BFF.
• Good to have a short critical
path and fallbacks.
function hasAccess (user, owner) {
}
Principle of Least Privilege
• User only has access to
minimum resources that are
necessary.
• Always assume user does not
have access by default.
• Allow only for specific
conditions.
if (user.isAdmin) {
return true;
}
if (user.id === owner.id) {
return true;
}
return false;
Sample BFF
Architecture
• Make it harder to be insecure.
• Separate business logic from
access control and validation.
• Stack installation with
predefined security setup using
yeoman.
security-hook
orm-hook
auth-hook
Vulnerable Dependencies
• Use strict versions for
dependencies and lockfiles.
• Check vulnerable dependencies
in CI pipeline.
• Tools - nsp, npm audit,
snyk.
$ snyk test
✗ Medium severity vulnerability
Description: ReDoS
Introduced through: something@0.9.1
Resolution: ...
✗ Medium severity vulnerability
Description: TOCTOU
Introduced through: package@1.2.0
Resolution: ...
Enforcing Security
• Security linting.
• System tests to catch
configuration issues.
• E2E tests using Postman
collections integrated into the
CI pipeline.
E2E tests in Newman
Inbound
Interaction with downstream
services
Handling Internal Auth
• Abstracting away internal server
details from developer.
• Prevents server auth leak in
response or logs.
• Allows for secret rotation
without server side code
changes.
user: async function (req, res) {
let user = await internal({
service: 'auth',
path: '/users/current',
query: { populate: true }
});
return user.toJSON();
}
Request tagging
• Associate each incoming
request with a user associated
token.
• Each service can utilize this
token to fetch user meta and
apply validations.
IDOR
• Exposing internal object
references along with incorrect
access control.
• All user initiated actions must
have verifications based on user
tokens.
Logging
• Scrub logs for sensitive
information and user data.
• Use heuristics to prevent
accidental logging.
• Trace logs originating from BFF
to track potential PII movement.
Outbound
Content security while
communicating with the
client.
HTTPS / HSTS
• Choose the certificate based on your need and the level of
user trust required - DV, OV, EV
• Ensure 3rd party calls and redirections are over HTTPS.
• Implement HSTS (+ preload) once you have verified
everything is over HTTPS.
RFC 2818, 6797
CSP
• Reduces the harm caused by
malicious code injection.
• Start by using report-only mode
to prevent side effects.
• Not ideal to prevent data
exfiltration - hrefs not covered.
Content-Security-Policy:
connect-src: 'self'
script-src: 'none'
img-src: *
default-src: 'none'
report-uri: 'https://...'
RFC 7762
Other Headers
• CORS: Who can access your resource.
• X-XSS: Detect and prevent XSS in some browsers.
• X-Frame-Options: Permit or deny displaying the website within
an iframe.
• HPKP: Allows HTTPS websites to resist impersonation.
• SRI: Verify 3rd party assets
• Refer OWASP Security Headers Project for more.
Caveats
• The support for all the headers is dependent on client
browser.
• Cannot be solely relied on for securing your BFF.
• Not a replacement for deliberate input validation and output
formatting.
Platform
Security considerations and
processes for infrastructure.
Audits & Automation
• What to audit?
• Developer access
• Setup configuration
• Creation of new resources
• We use collection runs to create
new resources reliably.
• Postman Monitors to perform
periodic audits of our services.
Audit with Collection
Health Check
• Verify critical config based on
environments.
• Prevent deployment if there is
something obviously wrong. Ex.
leaking private keys.
• This is a safety net and not a
testing mechanism.
SDLC
Processes involved to ensure security
Security KPIs
• Vulnerability categorization by
CVSS scores.
• Vulnerability regression.
• Time to resolve - SLA.
• External security reports - user
identified, Hacker One, etc.
VAPT
• Post-development step to
assess the security of a
software release.
• Black box and white box testing
of services.
• Automation of security
processes.
Outro
Revisiting Security Parameters
Confidentiality Integrity Availability
• Validation
• PoLP
• Log scrubbing
• Request tagging
• Access control (IDOR)
• Content security
(HTTPS, SRI, CSP, etc.)
• Short critical path
• Platform audits
• Healthcheck
Key Takeaways
• Security considerations while building a BFF / public API.
• Building a secure API is a gradual process.
• Security is a part of development process.
Thank you
Assets
https://github.com/ankit-m/talks/tree/master/jsfoo-2018

More Related Content

PPT
Vb introduction.
ZIP
Blood bank-data-abstract-php-project
PDF
Full report on blood bank management system
PDF
Book management system
PPTX
Hospital management
PDF
PPTX
Implicit and explicit sequence control with exception handling
Vb introduction.
Blood bank-data-abstract-php-project
Full report on blood bank management system
Book management system
Hospital management
Implicit and explicit sequence control with exception handling

What's hot (20)

DOCX
E-commerce documentation
PPTX
Blood Donation Database
PPT
Bank management system with java
DOCX
Java Exception handling
DOCX
Ans.tutorial#2
PPTX
Web development ppt
DOCX
A Software Engineering Project on Cyber cafe management
PDF
Flipkart Software requirements specification SRS
PPT
Project proposal presentation(blood bank management system)
DOCX
farming assistant web service
DOCX
Online bus ticket booking
DOCX
CoffeeShop Management
PPTX
E-BOOK MANAGEMENT SYSTEM PowerPoint Presentation
DOC
Synopsis on billing system
PPTX
Fake Note Detection of Bangladesh
PDF
blockchain technology -unit-3-notes.pdf for engineering students
PDF
Student result management system project using angular.pdf
PPTX
Library Management System Project in C
PDF
Backend for Frontend in Microservices
E-commerce documentation
Blood Donation Database
Bank management system with java
Java Exception handling
Ans.tutorial#2
Web development ppt
A Software Engineering Project on Cyber cafe management
Flipkart Software requirements specification SRS
Project proposal presentation(blood bank management system)
farming assistant web service
Online bus ticket booking
CoffeeShop Management
E-BOOK MANAGEMENT SYSTEM PowerPoint Presentation
Synopsis on billing system
Fake Note Detection of Bangladesh
blockchain technology -unit-3-notes.pdf for engineering students
Student result management system project using angular.pdf
Library Management System Project in C
Backend for Frontend in Microservices
Ad

Similar to Building a secure BFF at Postman (20)

PDF
SecDevOps for API Security
PDF
Api security-testing
PDF
42crunch-API-security-workshop
PDF
APIdays Paris 2019 - API Security Tips for Developers by Isabelle Mauny, 42Cr...
PDF
APIdays London 2019 - API Security Tips for Developers with Isabelle Mauny, 4...
PDF
APIDays Paris Security Workshop
PPTX
How to Build a Fortress with the Security of a Tent - Jacob Ideskog, Curity
PDF
Protecting Microservices APIs with 42Crunch API Firewall
PPTX
Building Secure By Default Nodejs Applications
PPTX
Deep-Dive: Secure API Management
PDF
Serverless Security Guy Podjarny Liran Tal
PDF
APIsecure 2023 - API Security - doing more with less, Nir Paz (Standard.ai)
PDF
PDF
Checkmarx meetup API Security - Solving security at scale - Ante Gulam
PDF
Better API Security with Automation
PDF
Better API Security With A SecDevOps Approach
PDF
OWASP Portland - OWASP Top 10 For JavaScript Developers
PPTX
A Practical Guide to Securing Modern Web Applications
PDF
Designing & Building Secure Web APIs
PDF
apidays LIVE LONDON - Protecting financial-grade APIs - Getting the right API...
SecDevOps for API Security
Api security-testing
42crunch-API-security-workshop
APIdays Paris 2019 - API Security Tips for Developers by Isabelle Mauny, 42Cr...
APIdays London 2019 - API Security Tips for Developers with Isabelle Mauny, 4...
APIDays Paris Security Workshop
How to Build a Fortress with the Security of a Tent - Jacob Ideskog, Curity
Protecting Microservices APIs with 42Crunch API Firewall
Building Secure By Default Nodejs Applications
Deep-Dive: Secure API Management
Serverless Security Guy Podjarny Liran Tal
APIsecure 2023 - API Security - doing more with less, Nir Paz (Standard.ai)
Checkmarx meetup API Security - Solving security at scale - Ante Gulam
Better API Security with Automation
Better API Security With A SecDevOps Approach
OWASP Portland - OWASP Top 10 For JavaScript Developers
A Practical Guide to Securing Modern Web Applications
Designing & Building Secure Web APIs
apidays LIVE LONDON - Protecting financial-grade APIs - Getting the right API...
Ad

Recently uploaded (20)

PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPT
Teaching material agriculture food technology
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
Big Data Technologies - Introduction.pptx
PDF
Encapsulation theory and applications.pdf
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PPTX
Spectroscopy.pptx food analysis technology
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Approach and Philosophy of On baking technology
PDF
Empathic Computing: Creating Shared Understanding
PPTX
Cloud computing and distributed systems.
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
KodekX | Application Modernization Development
PPTX
Programs and apps: productivity, graphics, security and other tools
Per capita expenditure prediction using model stacking based on satellite ima...
Teaching material agriculture food technology
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Spectral efficient network and resource selection model in 5G networks
Building Integrated photovoltaic BIPV_UPV.pdf
Unlocking AI with Model Context Protocol (MCP)
Big Data Technologies - Introduction.pptx
Encapsulation theory and applications.pdf
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
MIND Revenue Release Quarter 2 2025 Press Release
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
“AI and Expert System Decision Support & Business Intelligence Systems”
Spectroscopy.pptx food analysis technology
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Approach and Philosophy of On baking technology
Empathic Computing: Creating Shared Understanding
Cloud computing and distributed systems.
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
KodekX | Application Modernization Development
Programs and apps: productivity, graphics, security and other tools

Building a secure BFF at Postman

  • 1. Building a secure BFF Ankit Muchhala - Postman ankit_muchhala
  • 3. Backend For Frontend • BFF is an API Gateway designed for a specific UI to interact with microservices. • Abstracts away implementation details from client. • Reduces network chatter and improves performance.
  • 4. Security concerns? • Single point of failure and attack. • Public facing service. • Handles user input. • How to quantify these for an API?
  • 5. Security Parameters Confidentiality Integrity Availability Only authorised people can access appropriate data. Data delivered by your service is not tampered with. Content is available to authorised users to on demand.
  • 7. Service Server side code which contains your business logic
  • 8. Validation • BFF should not perform all validations. • It should perform ecosystem checks - auth, validate header. • Business logic specific checks are deferred to downstream services.
  • 9. Critical Path • Services called before request reaches the business logic. • Critical path length is an indicator of the amount of validation done on BFF. • Good to have a short critical path and fallbacks.
  • 10. function hasAccess (user, owner) { } Principle of Least Privilege • User only has access to minimum resources that are necessary. • Always assume user does not have access by default. • Allow only for specific conditions. if (user.isAdmin) { return true; } if (user.id === owner.id) { return true; } return false;
  • 12. Architecture • Make it harder to be insecure. • Separate business logic from access control and validation. • Stack installation with predefined security setup using yeoman. security-hook orm-hook auth-hook
  • 13. Vulnerable Dependencies • Use strict versions for dependencies and lockfiles. • Check vulnerable dependencies in CI pipeline. • Tools - nsp, npm audit, snyk. $ snyk test ✗ Medium severity vulnerability Description: ReDoS Introduced through: something@0.9.1 Resolution: ... ✗ Medium severity vulnerability Description: TOCTOU Introduced through: package@1.2.0 Resolution: ...
  • 14. Enforcing Security • Security linting. • System tests to catch configuration issues. • E2E tests using Postman collections integrated into the CI pipeline.
  • 15. E2E tests in Newman
  • 17. Handling Internal Auth • Abstracting away internal server details from developer. • Prevents server auth leak in response or logs. • Allows for secret rotation without server side code changes. user: async function (req, res) { let user = await internal({ service: 'auth', path: '/users/current', query: { populate: true } }); return user.toJSON(); }
  • 18. Request tagging • Associate each incoming request with a user associated token. • Each service can utilize this token to fetch user meta and apply validations.
  • 19. IDOR • Exposing internal object references along with incorrect access control. • All user initiated actions must have verifications based on user tokens.
  • 20. Logging • Scrub logs for sensitive information and user data. • Use heuristics to prevent accidental logging. • Trace logs originating from BFF to track potential PII movement.
  • 22. HTTPS / HSTS • Choose the certificate based on your need and the level of user trust required - DV, OV, EV • Ensure 3rd party calls and redirections are over HTTPS. • Implement HSTS (+ preload) once you have verified everything is over HTTPS. RFC 2818, 6797
  • 23. CSP • Reduces the harm caused by malicious code injection. • Start by using report-only mode to prevent side effects. • Not ideal to prevent data exfiltration - hrefs not covered. Content-Security-Policy: connect-src: 'self' script-src: 'none' img-src: * default-src: 'none' report-uri: 'https://...' RFC 7762
  • 24. Other Headers • CORS: Who can access your resource. • X-XSS: Detect and prevent XSS in some browsers. • X-Frame-Options: Permit or deny displaying the website within an iframe. • HPKP: Allows HTTPS websites to resist impersonation. • SRI: Verify 3rd party assets • Refer OWASP Security Headers Project for more.
  • 25. Caveats • The support for all the headers is dependent on client browser. • Cannot be solely relied on for securing your BFF. • Not a replacement for deliberate input validation and output formatting.
  • 27. Audits & Automation • What to audit? • Developer access • Setup configuration • Creation of new resources • We use collection runs to create new resources reliably. • Postman Monitors to perform periodic audits of our services.
  • 29. Health Check • Verify critical config based on environments. • Prevent deployment if there is something obviously wrong. Ex. leaking private keys. • This is a safety net and not a testing mechanism.
  • 30. SDLC Processes involved to ensure security
  • 31. Security KPIs • Vulnerability categorization by CVSS scores. • Vulnerability regression. • Time to resolve - SLA. • External security reports - user identified, Hacker One, etc.
  • 32. VAPT • Post-development step to assess the security of a software release. • Black box and white box testing of services. • Automation of security processes.
  • 33. Outro
  • 34. Revisiting Security Parameters Confidentiality Integrity Availability • Validation • PoLP • Log scrubbing • Request tagging • Access control (IDOR) • Content security (HTTPS, SRI, CSP, etc.) • Short critical path • Platform audits • Healthcheck
  • 35. Key Takeaways • Security considerations while building a BFF / public API. • Building a secure API is a gradual process. • Security is a part of development process.