Using Cookies to Store Your Postman Secrets
Lightning Talk on February 4, 2021
Miguel A. Calles
We are testing the production environment.
We want to test an API in a team collection.
We enter our actual username and password.
We complete the test and move on.
We make a collection public.
We decide to make a "quick" change.
We "temporarily" add an API key.
We get a phone call from our boss.
Strong encryption at-rest and in-transit
Postman Sessions
Role-based access control (RBAC)
Strong security program
Protect your account, installation, and computer
Implement user roles with RBAC
Use Postman Sessions
Be careful what you share
Environments (obviously) have no encryption in-use
Avoid syncing with Sessions
Use cookies as a local data store
Done with the UI and scripts.
Must carefully avoid setting Initial Value
Done with the UI and scripts
Must whitelist domain
Using Cookies to Store Your Postman Secrets
Principal Solutions and Security Engineer
Published Author
https://MiguelACallesMBA.com
https://ServerlessSecurityBook.com
https://www.linkedin.com/in/miguel-a-calles-mb
a/
Using Cookies to Store Your Postman Secrets
const cookieJar = pm.cookies.jar();
const cookieName = "xApiKey"
const domain = "postman.galaxy.demo"
cookieJar.get(domain, cookieName, (error, cookie)
=> {
if (error) {
console.error(error);
pm.variables.set(cookieName, "error");
}
if (cookie) {
pm.variables.set(cookieName, cookie);
} else {
console.error("Cookie is missing")
pm.variables.set(cookieName, "missing");
}
});
pm.variables.unset("xApiKey");
//
https://postman-quick-reference-guide.readthedocs.
io/en/latest/libraries.html
const cookieJar = pm.cookies.jar();
const sessionVarName = "xApiKey";
const cookieName = "secretKey";
const domain = "postman.galaxy.demo";
cookieJar.get(domain, cookieName, (error,
secretKey) => {
if (error) {
console.error(error);
pm.variables.set(sessionVarName, "error");
}
if (secretKey) {
// encryption
const encryptedText =
CryptoJS.AES.encrypt('<data-to-encrypt>',
secretKey).toString();
console.log('encryptedText', encryptedText);
// decryption
console.log('secretKey', secretKey);
const xApiKeyEnc =
pm.environment.get('x-api-key-enc');
console.log('xApiKeyEnc', xApiKeyEnc);
const xApiKey =
CryptoJS.AES.decrypt(xApiKeyEnc,
secretKey).toString(CryptoJS.enc.Utf8);
console.log('xApiKey', xApiKey);
pm.variables.set(sessionVarName, xApiKey);
} else {
console.error("Cookie is missing")
pm.variables.set(sessionVarName, "missing");
}
});
Photo by krakenimages on Unsplash
Photo by Sarah Kilian on Unsplash
Photo by John Salvino on Unsplash
Photo by Erika Fletcher on Unsplash
Photo by Alexander Sinn on Unsplash
Photo by Christina Branco on Unsplash
Photo by Scott Sanker on Unsplash
Photo by Markus Spiske on Unsplash

More Related Content

PDF
Turn On The Lights
PDF
Building Faster With Your Team's UI Kit
PDF
Consumer-Driven Contract Testing With Postman
PDF
Webinar: “Introduction to the Postman API Network”
PDF
Common Security API Issues and How to Mitigate Them Using Postman
PDF
How to Build a Micro-Application using Single-Spa
PDF
Building Cloud-agnostic Serverless APIs
PDF
Everything you always wanted to know about API Management (but were afraid to...
Turn On The Lights
Building Faster With Your Team's UI Kit
Consumer-Driven Contract Testing With Postman
Webinar: “Introduction to the Postman API Network”
Common Security API Issues and How to Mitigate Them Using Postman
How to Build a Micro-Application using Single-Spa
Building Cloud-agnostic Serverless APIs
Everything you always wanted to know about API Management (but were afraid to...

What's hot (20)

PPTX
A Starters Guide to Building APIs with Javascript
PPTX
Firebase
PDF
Drive API Adoption: Reach Over 13 Million Developers
PDF
Testing Your APIs: Postman, Newman, and Beyond
PPTX
Everybody loves Swagger
PPTX
Postman Enterprise Webinar
PDF
Postman Webinar: How Ping Identity Uses Postman across the API Lifecycle
PDF
Progressive Web Apps by Millicent Convento
PDF
The Journey from Monolith to Microservices: a Guided Adventure
PPTX
PDF
Enterprise E-commerce Webinar Series, Episode 2: Deploying and Monitoring You...
PDF
The Most Common Errors That Aren’t Caught
PDF
Driving Pipeline Automation With Newman and the Postman API
PDF
API Security with Postman and Qualys
PDF
Meteor js - TechPeaks Developers Meeting
PDF
TDD for APIs in a Microservice World (Short Version) by Michael Kuehne-Schlin...
PDF
Lock That Shit Down! Auth Security Patterns for Apps, APIs, and Infra - Sprin...
PDF
Postman Webinar: "From APIs to Serverless Cloud Applications in Minutes"
PPTX
Firebase Overview
PDF
Postman Galaxy Tour: San Francisco - Workshop Presentation
A Starters Guide to Building APIs with Javascript
Firebase
Drive API Adoption: Reach Over 13 Million Developers
Testing Your APIs: Postman, Newman, and Beyond
Everybody loves Swagger
Postman Enterprise Webinar
Postman Webinar: How Ping Identity Uses Postman across the API Lifecycle
Progressive Web Apps by Millicent Convento
The Journey from Monolith to Microservices: a Guided Adventure
Enterprise E-commerce Webinar Series, Episode 2: Deploying and Monitoring You...
The Most Common Errors That Aren’t Caught
Driving Pipeline Automation With Newman and the Postman API
API Security with Postman and Qualys
Meteor js - TechPeaks Developers Meeting
TDD for APIs in a Microservice World (Short Version) by Michael Kuehne-Schlin...
Lock That Shit Down! Auth Security Patterns for Apps, APIs, and Infra - Sprin...
Postman Webinar: "From APIs to Serverless Cloud Applications in Minutes"
Firebase Overview
Postman Galaxy Tour: San Francisco - Workshop Presentation
Ad

Similar to Using Cookies to Store Your Postman Secrets (10)

PPT
Cookies and sessions
PPTX
WORKING WITH IN COOKIES JAVA SEMINAR.pptx
PPTX
Working with in cookies java seminar.pptx
PPTX
Backend Technologies Notes ajef;asnfkndfdsa
PDF
Defcon 22-david-wyde-client-side-http-cookie-security
PPTX
cookie attributes and tokens,jwt tokens1.ppt
PDF
OWASP AppSec USA 2017: Cookie Security – Myths and Misconceptions by David Jo...
PDF
Getting Single Page Application Security Right
PDF
A Comprehensive Guide to Cookie Management Using HeadSpin's Cutting-Edge Remo...
PPTX
Cookies and sessions
Cookies and sessions
WORKING WITH IN COOKIES JAVA SEMINAR.pptx
Working with in cookies java seminar.pptx
Backend Technologies Notes ajef;asnfkndfdsa
Defcon 22-david-wyde-client-side-http-cookie-security
cookie attributes and tokens,jwt tokens1.ppt
OWASP AppSec USA 2017: Cookie Security – Myths and Misconceptions by David Jo...
Getting Single Page Application Security Right
A Comprehensive Guide to Cookie Management Using HeadSpin's Cutting-Edge Remo...
Cookies and sessions
Ad

More from Postman (20)

PDF
Advanced AI and Documentation Techniques
PDF
WeTestAthens: Postman's AI & Automation Techniques
PDF
Elevating Developer Experiences with AI-Powered API Testing & Documentation
PDF
Discovering Public APIs and Public API Network with Postman
PDF
Optimizing Teamwork: Harnessing Collections & Workspaces for Collaboration
PDF
API testing Beyond the Basics AI & Automation Techniques
PDF
Not Your Grandma’s Rate Limiting (slides)
PDF
Five Ways to Automate API Testing with Postman
PDF
How to Scale APIs-as-Product for Future Success
PPTX
Revolutionizing API Development: Collaborative Workflows with Postman
PDF
Everything You Always Wanted to Know About AsyncAPI
PDF
Elevating Event-Driven World: A Deep Dive into AsyncAPI v3
PDF
Five Things You SHOULD Know About Postman
PDF
Integration-, Snapshot- and Performance-Testing APIs
PDF
How ChatGPT led OpenAPI's Recent Spike in Popularity
PDF
Exploring Postman’s VS Code Extension
PDF
2023 State of the API Report: Key Findings and Trends
PDF
Nordic- APIOps is here What will you build in an API First World
PDF
Testing and Developing gRPC APIs
PDF
Testing and Developing GraphQL APIs
Advanced AI and Documentation Techniques
WeTestAthens: Postman's AI & Automation Techniques
Elevating Developer Experiences with AI-Powered API Testing & Documentation
Discovering Public APIs and Public API Network with Postman
Optimizing Teamwork: Harnessing Collections & Workspaces for Collaboration
API testing Beyond the Basics AI & Automation Techniques
Not Your Grandma’s Rate Limiting (slides)
Five Ways to Automate API Testing with Postman
How to Scale APIs-as-Product for Future Success
Revolutionizing API Development: Collaborative Workflows with Postman
Everything You Always Wanted to Know About AsyncAPI
Elevating Event-Driven World: A Deep Dive into AsyncAPI v3
Five Things You SHOULD Know About Postman
Integration-, Snapshot- and Performance-Testing APIs
How ChatGPT led OpenAPI's Recent Spike in Popularity
Exploring Postman’s VS Code Extension
2023 State of the API Report: Key Findings and Trends
Nordic- APIOps is here What will you build in an API First World
Testing and Developing gRPC APIs
Testing and Developing GraphQL APIs

Recently uploaded (20)

PDF
Top 10 Software Development Trends to Watch in 2025 🚀.pdf
PDF
AI-Powered Threat Modeling: The Future of Cybersecurity by Arun Kumar Elengov...
PDF
Time Tracking Features That Teams and Organizations Actually Need
PDF
EaseUS PDF Editor Pro 6.2.0.2 Crack with License Key 2025
PPTX
Introduction to Windows Operating System
PDF
How Tridens DevSecOps Ensures Compliance, Security, and Agility
PDF
AI/ML Infra Meetup | LLM Agents and Implementation Challenges
PPTX
"Secure File Sharing Solutions on AWS".pptx
PPTX
GSA Content Generator Crack (2025 Latest)
PPTX
CNN LeNet5 Architecture: Neural Networks
PDF
Salesforce Agentforce AI Implementation.pdf
PDF
Microsoft Office 365 Crack Download Free
PDF
CCleaner 6.39.11548 Crack 2025 License Key
PDF
Topaz Photo AI Crack New Download (Latest 2025)
PPTX
Patient Appointment Booking in Odoo with online payment
PPTX
Log360_SIEM_Solutions Overview PPT_Feb 2020.pptx
PDF
AI/ML Infra Meetup | Beyond S3's Basics: Architecting for AI-Native Data Access
PPTX
AMADEUS TRAVEL AGENT SOFTWARE | AMADEUS TICKETING SYSTEM
PPTX
Cybersecurity: Protecting the Digital World
PDF
Cost to Outsource Software Development in 2025
Top 10 Software Development Trends to Watch in 2025 🚀.pdf
AI-Powered Threat Modeling: The Future of Cybersecurity by Arun Kumar Elengov...
Time Tracking Features That Teams and Organizations Actually Need
EaseUS PDF Editor Pro 6.2.0.2 Crack with License Key 2025
Introduction to Windows Operating System
How Tridens DevSecOps Ensures Compliance, Security, and Agility
AI/ML Infra Meetup | LLM Agents and Implementation Challenges
"Secure File Sharing Solutions on AWS".pptx
GSA Content Generator Crack (2025 Latest)
CNN LeNet5 Architecture: Neural Networks
Salesforce Agentforce AI Implementation.pdf
Microsoft Office 365 Crack Download Free
CCleaner 6.39.11548 Crack 2025 License Key
Topaz Photo AI Crack New Download (Latest 2025)
Patient Appointment Booking in Odoo with online payment
Log360_SIEM_Solutions Overview PPT_Feb 2020.pptx
AI/ML Infra Meetup | Beyond S3's Basics: Architecting for AI-Native Data Access
AMADEUS TRAVEL AGENT SOFTWARE | AMADEUS TICKETING SYSTEM
Cybersecurity: Protecting the Digital World
Cost to Outsource Software Development in 2025

Using Cookies to Store Your Postman Secrets

  • 1. Using Cookies to Store Your Postman Secrets Lightning Talk on February 4, 2021 Miguel A. Calles
  • 2. We are testing the production environment. We want to test an API in a team collection. We enter our actual username and password. We complete the test and move on.
  • 3. We make a collection public. We decide to make a "quick" change. We "temporarily" add an API key. We get a phone call from our boss.
  • 4. Strong encryption at-rest and in-transit Postman Sessions Role-based access control (RBAC) Strong security program
  • 5. Protect your account, installation, and computer Implement user roles with RBAC Use Postman Sessions Be careful what you share
  • 6. Environments (obviously) have no encryption in-use Avoid syncing with Sessions Use cookies as a local data store
  • 7. Done with the UI and scripts. Must carefully avoid setting Initial Value
  • 8. Done with the UI and scripts Must whitelist domain
  • 10. Principal Solutions and Security Engineer Published Author https://MiguelACallesMBA.com https://ServerlessSecurityBook.com https://www.linkedin.com/in/miguel-a-calles-mb a/
  • 12. const cookieJar = pm.cookies.jar(); const cookieName = "xApiKey" const domain = "postman.galaxy.demo" cookieJar.get(domain, cookieName, (error, cookie) => { if (error) { console.error(error); pm.variables.set(cookieName, "error"); } if (cookie) { pm.variables.set(cookieName, cookie); } else { console.error("Cookie is missing") pm.variables.set(cookieName, "missing"); } });
  • 14. // https://postman-quick-reference-guide.readthedocs. io/en/latest/libraries.html const cookieJar = pm.cookies.jar(); const sessionVarName = "xApiKey"; const cookieName = "secretKey"; const domain = "postman.galaxy.demo";
  • 15. cookieJar.get(domain, cookieName, (error, secretKey) => { if (error) { console.error(error); pm.variables.set(sessionVarName, "error"); } if (secretKey) { // encryption const encryptedText = CryptoJS.AES.encrypt('<data-to-encrypt>', secretKey).toString(); console.log('encryptedText', encryptedText);
  • 16. // decryption console.log('secretKey', secretKey); const xApiKeyEnc = pm.environment.get('x-api-key-enc'); console.log('xApiKeyEnc', xApiKeyEnc); const xApiKey = CryptoJS.AES.decrypt(xApiKeyEnc, secretKey).toString(CryptoJS.enc.Utf8); console.log('xApiKey', xApiKey); pm.variables.set(sessionVarName, xApiKey); } else { console.error("Cookie is missing") pm.variables.set(sessionVarName, "missing"); } });
  • 17. Photo by krakenimages on Unsplash Photo by Sarah Kilian on Unsplash Photo by John Salvino on Unsplash Photo by Erika Fletcher on Unsplash Photo by Alexander Sinn on Unsplash Photo by Christina Branco on Unsplash Photo by Scott Sanker on Unsplash Photo by Markus Spiske on Unsplash