Repository navigation
Fix CodeQL password-hash warnings in the SSO samples - #6097
Draft
Eugene (OEvgeny) wants to merge 2 commits into
Draft
Eugene (OEvgeny) wants to merge 2 commits into
Eugene (OEvgeny) wants to merge 2 commits into
Conversation
added 2 commits
December 3, 2026 11:16
CodeQL js/insufficient-password-hash flagged the SSO samples under 07.advanced-web-chat-apps for deriving the PKCE code verifier and the GitHub OAuth "state" from a seed and a salt with a fast hash (SHA-512 / SHA-384). Derive them with crypto.scryptSync (N: 16384) instead. scrypt is deterministic for the same seed and salt, so any server instance still recomputes the same verifier or state, as the samples' distributed design requires. - createPKCECodeVerifier.js (b, c, d, e): 64 bytes, encoded with Node's base64url (86 characters). The previous encoder left a trailing "=", which is outside the RFC 7636 verifier alphabet. - generateOAuthState.js (b, c, d, e): 5 bytes as hex, still 10 characters. c, d and e carry identical copies of this helper, changed the same way. createPKCECodeChallenge.js (SHA-256 of the verifier, required by S256) is unchanged.
This branch has not been deployed
This file contains hidden or 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
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.
Changelog Entry
Fixed
Description
The SSO samples derived the PKCE code verifier and the GitHub OAuth
statefrom a seed and a salt with SHA-512/SHA-384, a fast hash that CodeQL flags. They now use Node's built-incrypto.scryptSync, a KDF that the rule recommends. Thejs/weak-hasheswarning on__tests__/setup/NUnitTestReporter.jsneeds no change: #5416 removed that file.Design
N: 16384), about 25 ms per call.Specific Changes
createPKCECodeVerifier.js(b, c, d, e): 64 scrypt bytes as base64url (86 characters); the old encoder left a trailing=, which RFC 7636 does not allow.generateOAuthState.js(b, c, d, e): 5 scrypt bytes, still 10 hex characters.Verification (b shown; c, d, e the same)
.changelog/<PR#>-<slug>.mdReview Checklist
z-index)package.jsonandpackage-lock.jsonreviewed