Repository navigation
Rename reset-token input to passwordHash - #1083
Merged
Merged
Conversation
Make the stored password hash contract explicit and avoid treating it as plaintext password storage in CodeQL. Token bytes and CommonJS exports stay unchanged. Breaking change: resetToken.generateHash and compare now require passwordHash instead of password. Release with the next major version and update Ghost callers together.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1083 +/- ##
==========================================
+ Coverage 98.13% 99.05% +0.92%
==========================================
Files 87 6 -81
Lines 3210 106 -3104
Branches 574 14 -560
==========================================
- Hits 3150 105 -3045
+ Misses 16 0 -16
+ Partials 44 1 -43 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configuration
📒 Files selected for processing: 3
✨ Finishing Touches
Comment |
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.
The reset-token helpers take an existing stored password hash, but call the option
password. Rename it topasswordHashingenerateHash()andcompare()so the API states its contract and CodeQL does not classify it as plaintext password hashing. Remove the ineffective inline suppression and use stored-hash fixtures in the tests.This is a breaking API change for the next major release of
@tryghost/security. Ghost must update both caller options when adopting that release. The token algorithm, format and CommonJS exports are unchanged; a regression test checks generation and validation against a token produced by the old API.The TypeScript conversion remains separate in #1081, after this change merges.
Validation:
corepack pnpm --filter @tryghost/security test— 39 tests pass, with 100% line coverage.corepack pnpm lintcorepack pnpm format:checkPacked the package and installed the tarball into a disposable Ghost checkout. After updating the two production caller options and five test fixtures, 132 focused Ghost tests pass. Temporary compatibility tests exercise Ghost's real
generateToken()anddoReset()orchestration with database doubles: generation succeeds, a token produced by the previous API is accepted, and a changed stored hash invalidates it. The unchanged callers failed those checks before the update.Also verified that Ghost resolves the packed CommonJS JavaScript and the existing
lib/tokensentry point. These Ghost caller changes must accompany the dependency upgrade after the major release; they are not included in this Framework PR.