-
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
Use crypto.randomBytes for ID generation #235
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Math.random is not cryptographically secure, and IDs generated with it could potentially be predicted. Use crypto.randomBytes instead.
Thanks for the PR. Could you add a test that confirms that the new strings returned are the same length as the old strings? |
added test 👍 |
Thanks, released. Changelog is here: https://github.com/bergie/passport-saml/releases |
cjbarth
added a commit
to cjbarth/passport-saml
that referenced
this pull request
Sep 10, 2018
…-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
cjbarth
added a commit
to cjbarth/passport-saml
that referenced
this pull request
Sep 10, 2018
…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
cjbarth
added a commit
to cjbarth/passport-saml
that referenced
this pull request
Sep 10, 2018
* 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
cjbarth
added a commit
to cjbarth/passport-saml
that referenced
this pull request
Sep 10, 2018
* 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
cjbarth
added a commit
to cjbarth/passport-saml
that referenced
this pull request
Sep 11, 2018
…-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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Math.random is not cryptographically secure, and IDs generated with it could potentially be predicted. Use crypto.randomBytes instead.
I kept the length of the generated ID the same, but it might also be worth increasing it if that's OK everywhere this function is used, as 20 hex chars is only an 80 bit ID, for which collisions could conceivably occur with a realistic number of stored IDs.