-
Notifications
You must be signed in to change notification settings - Fork 475
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uncatchable Exception Thrown when bad privateCert used #230
Comments
I went ahead and made a pull request (#231) with a simple change that will catch the error and pass it back via the callback instead of throwing the exception. I also added a test with the commit which shows the issue. If this is something you can use then please feel free to pull it in. If there's anything I can do to make the commit better let me know. Thanks again. |
@chriswininger Having issues with privateCert, mine looks pretty much like the one in your example above
What is it about this format that makes it a bad private cert? It appears to have a start line, why is it throwing the PEM_read_bio:no start line error? |
I just had the issue and it seemed that adding the It is important to accept this pull if it is working because this issue really crashes the server. |
For future reference, if you are having trouble figuring out the correct private key format, you can use this little script to test: "use strict";
var fs = require("fs")
var SAML = require("passport-saml").SAML;
var saml = new SAML({
privateCert : fs.readFileSync("./tmp.pem")
})
var message = { SAMLResponse: "BOOM" };
saml.signRequest(message)
console.log(message.Signature) Using that, I determined that the private key must start with It doesn't work to put The certificate itself can be on a single line, or presumably will also work with linebreaks. This behavior is inconsistent with other parts of It also be nice if |
Resolving, since #231 was merged. |
…-string-signing * commit 'da829fc0216ed961ea7cb8a6234df65a60f51114': Use crypto.randomBytes for ID generation (node-saml#235) BugFix: Fail gracefully when SAML Response is invalid. Fixes node-saml#238 docs: Improve docs for privateKey format. Ref node-saml#230 Drop support for Node versions < 4. v0.20.2
…url-params * commit 'da829fc0216ed961ea7cb8a6234df65a60f51114': Use crypto.randomBytes for ID generation (node-saml#235) BugFix: Fail gracefully when SAML Response is invalid. Fixes node-saml#238 docs: Improve docs for privateKey format. Ref node-saml#230 Drop support for Node versions < 4. v0.20.2
* master: (51 commits) start to use the debug module. v0.34.0: release internal: provide unique failure messages for invalid signatures. Fixes node-saml#146 package.json: bump version to 0.33.0 docs: mention that disableRequestAuthnContext helps with AD FS New Feature: allow customizing the name of the strategy. bump version to v0.32.1 README: link to where our Changes are documented. Audience validation README: fix typo `s/ADSF/ADFS/` jshint: fix jshint violation. v0.31.0 release README: update link description for ADFS docs. Upd: Mention ADFS 2016 with NameIDFormatError. (node-saml#242) Support multiple and dynamic signing certificates (node-saml#218) v0.30.0 Ignore .tern-port files Use crypto.randomBytes for ID generation (node-saml#235) BugFix: Fail gracefully when SAML Response is invalid. Fixes node-saml#238 docs: Improve docs for privateKey format. Ref node-saml#230 ... # Conflicts: # README.md # test/samlTests.js # test/tests.js
* master: (51 commits) start to use the debug module. v0.34.0: release internal: provide unique failure messages for invalid signatures. Fixes node-saml#146 package.json: bump version to 0.33.0 docs: mention that disableRequestAuthnContext helps with AD FS New Feature: allow customizing the name of the strategy. bump version to v0.32.1 README: link to where our Changes are documented. Audience validation README: fix typo `s/ADSF/ADFS/` jshint: fix jshint violation. v0.31.0 release README: update link description for ADFS docs. Upd: Mention ADFS 2016 with NameIDFormatError. (node-saml#242) Support multiple and dynamic signing certificates (node-saml#218) v0.30.0 Ignore .tern-port files Use crypto.randomBytes for ID generation (node-saml#235) BugFix: Fail gracefully when SAML Response is invalid. Fixes node-saml#238 docs: Improve docs for privateKey format. Ref node-saml#230 ... # Conflicts: # README.md # test/samlTests.js
…-authn-context * commit 'da829fc0216ed961ea7cb8a6234df65a60f51114': Use crypto.randomBytes for ID generation (node-saml#235) BugFix: Fail gracefully when SAML Response is invalid. Fixes node-saml#238 docs: Improve docs for privateKey format. Ref node-saml#230 Drop support for Node versions < 4. v0.20.2
I'm seeing a similar issue when my cert has the lines when I replace I get the error: using the snippet you posted @markstos any ideas? |
@ZoharLiran Are you using the most recent version of passport-saml? Check your cert with other certificate checking tools to confirm it valid and in the right format. This does not appear to be a bug in passport-saml, so I'm marking this as closed. |
When the authenticate method is used with an incorrect value passed for privateCert the call to
self.signRequest(samlMessage);
throws the exceptionerror:0906D06C:PEM routines:PEM_read_bio:no start line
.When this happens rather than triggering a 500 error response the server crashes. Here is a simple app which shows this
It would be nice to handle this more gracefully. Let me know what you think. Thanks much.
The text was updated successfully, but these errors were encountered: