Skip to content

Commit

Permalink
Fixes #180: Added additional empty cert validation to SAML initialize
Browse files Browse the repository at this point in the history
  • Loading branch information
Aidan Anderson committed Oct 23, 2018
1 parent 00ea774 commit 6f127f5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 19 deletions.
10 changes: 4 additions & 6 deletions lib/passport-saml/saml.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ SAML.prototype.initialize = function (options) {
options = {};
}

if (options.hasOwnProperty('cert') && !options.cert) {
throw new Error('Invalid property: cert must not be empty');
}

if (!options.path) {
options.path = '/saml/consume';
}
Expand Down Expand Up @@ -558,12 +562,6 @@ SAML.prototype.validateSignatureForCert = function (signature, cert, fullXml, cu
};

SAML.prototype.validatePostResponse = function (container, callback) {
// if the cert is provided with an empty value it is invalid
if (this.options.hasOwnProperty('cert') &&
!this.options.cert) {
return callback(new Error('Invalid signature'));
}

var self = this;

var xml, doc, inResponseTo;
Expand Down
19 changes: 6 additions & 13 deletions test/tests.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6f127f5

Please sign in to comment.