drognisep
drognisep

Reputation: 609

Disable Postman SSL certificate verification with script

TL;DR I have two questions.

  1. Is the SSL verification setting, either global or request level, available to the Postman scripting sandbox?
  2. Where is it and how to I access its value (globals.get, variables.get, etc)?

I'm writing a Go/Gin based API that serves HTTPS requests but uses a self-signed cert locally. I'd like to be able to run tests with Postman locally without having to disable SSL cert verification for each individual request or globally, and then re-enable SSL cert verification after the response is received (considering the security implications of forgetting this step).

The ideal case would be using a (Postman) environment variable to trigger collection pre-request script logic to temporarily disable SSL verification, but I haven't found anything in the documentation that clearly points to a way to do this. I tried console.logging out the different variable scopes with toObject(), but nothing really sticks out to me.

Since there is a per-request setting to disable SSL cert verification, as well as a global setting, it stands to reason that this should be able to be made available at the global and request script variable levels, but I can't say for sure if this is exposed to the scripting sandbox or not.

Upvotes: 0

Views: 3011

Answers (2)

PDHide
PDHide

Reputation: 19979

http://www.postmanlabs.com/postman-collection/

Try using postman collection sdk

var Certificate = require('postman-collection').Certificate,
   certificate = new Certificate({
    name: 'Certificate for example.com',
    matches: ['example.com'],
    key: { src: '/User/path/to/certificate/key' },
    cert: { src: '/User/path/to/certificate' },
    passphrase: 'iampassphrase'
});

Upvotes: 1

drognisep
drognisep

Reputation: 609

I checked Postman's Github page and it looks like this is currently not possible, although there's an issue open to address it.

Upvotes: 0

Related Questions