Skip to content

Merge development into master to recover lost #390 fix#441

Merged
jankapunkt merged 6 commits into
node-oauth:masterfrom
dhensby:merge/development-into-master
Jun 16, 2026
Merged

Merge development into master to recover lost #390 fix#441
jankapunkt merged 6 commits into
node-oauth:masterfrom
dhensby:merge/development-into-master

Conversation

@dhensby

@dhensby dhensby commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

What

Merges the development branch back into master to recover the refresh-token "validate scope before revoking" fix that was lost between releases.

Closes #390.

Why

The fix for #390 was made in #389, merged into development, and released as 5.2.2-rc.0. However development was never merged back into master, so when 5.3.0 was cut from master it shipped without the fix. The bug is therefore live in the current 5.3.0 release: a refresh_token request that asks for an invalid/extra scope revokes the token before scope validation runs, so validation fails after the token has already been destroyed — permanently breaking refresh for that client. (Reported again on #390 on 2026-06-11.)

How

development had fallen 47 commits behind master (which since added lib/model.js, migrated the docs from Sphinx .rst to VitePress .md, and refactored broadly). A straight merge would have tried to revert all of that, so the merge was resolved entirely in favour of master, letting only the #390 change through:

  • package.json / package-lock.json → kept master (stays at 5.3.0; the stray 5.2.2-rc.0 bump is discarded).
  • Everything else auto-merged to master's state (git only conflicts where both sides changed a file; development never touched master's new work).

Net change versus master is exactly the fix + its test:

 lib/grant-types/refresh-token-grant-type.js        |  4 ++-
 test/integration/grant-types/refresh-token-grant-type_test.js | 29 +++++++++++++++

The merge is a real merge commit (history preserved — development's commits, including the original fix authored by @runeb, become ancestors of master).

Verification

  • lib/model.js present, 37 .md docs present, 0 .rst files — no regression from the stale branch.
  • npm run lint clean.
  • Full suite green (458 passing), including the new should throw an error if extra \scope` is requested` test.

Follow-up

After this lands, development is fully contained in master and is otherwise stale. Recommend deleting it (or resetting it to master) to prevent the same drift/lost-fix situation recurring.

runeb and others added 6 commits January 7, 2026 13:17
…e-revoke

fix(refresh-token): validate scope before revoking token node-oauth#390
The refresh-token "validate scope before revoking" fix (PR node-oauth#389, issue
node-oauth#390) was merged into `development` and released as 5.2.2-rc.0, but
`development` was never merged back into `master`. As a result 5.3.0
shipped from `master` without the fix, and a refresh request with an
invalid scope still revokes the token before scope validation, leaving
the client unable to refresh.

`development` had since fallen 47 commits behind `master`. This merge
brings `development`'s history back into `master`, resolving all
conflicts in favour of `master` (keeping lib/model.js, the VitePress
`.md` docs, refactors and the 5.3.0 version/lockfile). The only net
change versus master is the node-oauth#390 fix and its accompanying test.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR restores the fix for issue #390 on master by adjusting the refresh-token grant flow so scope validation happens before refresh token revocation, preventing refresh tokens from being destroyed when an invalid/extra scope is requested during a refresh.

Changes:

  • Reordered refresh-token handling to validate requested scope before calling revokeToken().
  • Added an integration test that asserts an InvalidScopeError is thrown for extra scopes and that revocation/saving do not occur in that failure case.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
lib/grant-types/refresh-token-grant-type.js Validates scope prior to token revocation during refresh-token grant handling to avoid destroying tokens on scope errors.
test/integration/grant-types/refresh-token-grant-type_test.js Adds coverage ensuring extra/invalid refresh scope fails with InvalidScopeError without revoking or saving a new token.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jankapunkt jankapunkt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much for pointing this out! We should discuss how to continue after this merge with getting master and development on par again.

@jankapunkt jankapunkt merged commit 37aeaf4 into node-oauth:master Jun 16, 2026
7 checks passed
@dhensby

dhensby commented Jun 16, 2026

Copy link
Copy Markdown
Contributor Author

If we move to semantic releases, they define some sane defaults for where pre-release/next development goes.

@dhensby dhensby deleted the merge/development-into-master branch June 16, 2026 07:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refresh token revoked before scope validation

4 participants