Repository navigation
fix: validate refresh token signature and type - #31
Merged
Merged
Conversation
ValidateRefreshToken now: - requires a signed token (RequireSignedTokens was false) - requires the rt+jwt token type, so an access token is not accepted - validates against the configured SecretKey or the last JWKS keys - uses the same issuer logic as token creation - rejects tokens of deleted users instead of throwing - uses UserManager.IsLockedOutAsync (the lockout check was inverted) - uses the async JsonWebTokenHandler.ValidateTokenAsync Adds NetDevPack.Identity.Tests (net8.0/net10.0) with regression tests.
Pin System.Security.Cryptography.Xml/Pkcs (8.0.5/8.0.2 on net8.0, 10.0.15 on net10.0), Microsoft.* 8.0.34/10.0.15, System.IdentityModel.Tokens.Jwt 8.23.0.
brunobritodev
added a commit
that referenced
this pull request
Nov 17, 2026
Same fix as #31 (8.x): signed rt+jwt tokens only, last JWKS keys or SecretKey, same issuer logic as creation, deleted users rejected, lockout check fixed (IsLockedOutAsync), async validation. Adds RefreshTokenSecurityTests.
The package exists to issue tokens that other services validate through JWKS. JwksIntegrationTests starts a host with UseJwksDiscovery and checks that: - /jwks publishes public keys only - a third party validates the access token with only the published JWKS - refresh tokens are signed with the JWKS key and still validate Test parallelization is disabled: PersistKeysInMemory() uses a static store shared by every host in the process and /jwks publishes only the last keys.
brunobritodev
added a commit
that referenced
this pull request
Nov 17, 2026
Same JwksIntegrationTests as #31: /jwks publishes public keys only, a third party validates the access token with the published JWKS, refresh tokens are signed with the JWKS key. Test parallelization disabled (static in-memory key store).
github-actions Bot
pushed a commit
that referenced
this pull request
Nov 18, 2026
## [8.0.1](v8.0.0...v8.0.1) (2026-11-18) ### Bug Fixes * validate refresh token signature and type ([#31](#31)) ([811df9a](811df9a))
|
🎉 This PR is included in version 8.0.1 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
brunobritodev
added a commit
that referenced
this pull request
Nov 18, 2026
* feat!: target .NET 10 and update dependencies - Target net10.0 only (drop net8.0; remove dead net7.0 conditions) - NetDevPack.Security.Jwt.AspNetCore 8.2.2 -> 10.0.0, Microsoft.* 10.0.15, System.IdentityModel.Tokens.Jwt 8.23.0; pin patched System.Security.Cryptography.Xml/Pkcs 10.0.15 (high severity advisories) - Central Package Management, NuGet Audit as errors, global.json, .editorconfig, dependabot - Sample: Swashbuckle 7 -> 10.3.1 (Microsoft.OpenApi 2 security requirement API) - Add NetDevPack.Identity.Tests (xunit.v3 + AwesomeAssertions): access token claims and signature, user lookup by id/username/email, one-time refresh tokens - CI: actions/checkout v7, setup-dotnet v6; publish now restores, builds and tests before releasing; vulnerable package check; pack/push only on new release - Package metadata: repository/project URL pointed to EduardoPires/NetDevPack, duplicated Authors, README now packed; LangVersion follows the SDK BREAKING CHANGE: the package now targets .NET 10 only and depends on NetDevPack.Security.Jwt 10. Stay on 8.x for .NET 8. * fix: point package URLs to Security.Identity * ci: use conventionalcommits release preset * fix: validate refresh token signature and type Same fix as #31 (8.x): signed rt+jwt tokens only, last JWKS keys or SecretKey, same issuer logic as creation, deleted users rejected, lockout check fixed (IsLockedOutAsync), async validation. Adds RefreshTokenSecurityTests. * style: remove redundant parentheses * test: cover JWKS issuance end to end Same JwksIntegrationTests as #31: /jwks publishes public keys only, a third party validates the access token with the published JWKS, refresh tokens are signed with the JWKS key. Test parallelization disabled (static in-memory key store).
github-actions Bot
pushed a commit
that referenced
this pull request
Nov 18, 2026
## [9.0.0](v8.0.1...v9.0.0) (2026-11-18) ### ⚠ BREAKING CHANGES * the package now targets .NET 10 only and depends on NetDevPack.Security.Jwt 10. Stay on 8.x for .NET 8. * fix: point package URLs to Security.Identity * ci: use conventionalcommits release preset * fix: validate refresh token signature and type ### Features * target .NET 10 and update dependencies ([#30](#30)) ([9af62e2](9af62e2)), closes [#31](#31) [#31](#31)
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.
Summary
Security patch for the 8.x line (net8.0 / net10.0). It should release 8.0.1. The same fix is also applied to the .NET 10 upgrade in #30.
ValidateRefreshTokenhardeningRequireSignedTokens = false.rt+jwttoken type, so an access token (at+jwt) is no longer accepted as a refresh token. Every refresh token issued since 6.1.0 already has this type.SecretKey, or the last keys of the JWKS store. Before, only the current key was used, so refresh tokens stopped working after a key rotation and never worked inSecretKeymode.IsValid = false("User not found") instead of throwingNullReferenceException.LockoutEnd < DateTime.Now, so it blocked users whose lockout had already ended and let locked-out users through. It now usesUserManager.IsLockedOutAsync.JsonWebTokenHandler.ValidateTokenAsync; the sync method is obsolete.Vulnerable dependencies
System.Security.Cryptography.Xml/Pkcs: 8.0.5/8.0.2 on net8.0 and 10.0.15 on net10.0. The previous versions had high severity advisories, coming in through DataProtection and NetDevPack.Security.Jwt.System.IdentityModel.Tokens.Jwt8.23.0.Tests (new)
tests/NetDevPack.Identity.Tests(xunit.v3 on Microsoft.Testing.Platform, enabled viaglobal.json) runs on net8.0 and net10.0.RefreshTokenSecurityTestscovers: a valid token, an unsigned token, a token signed by an unknown key, an access token used as a refresh token, malformed tokens, a locked-out user, an expired lockout, and a deleted user.mastercode.JwtBuilderTestscovers access token claims and signature, user lookup by id/username/email, and one-time refresh tokens.Test plan
dotnet test -c Release: 28/28 passed (14 tests × net8.0/net10.0), three runs in a rowJwtBuilderInject: 5 failures (expected)dotnet list package --vulnerable --include-transitive: no vulnerable packagesRecommendation
After 8.0.1 is published, consider publishing a GitHub Security Advisory for versions ≤ 8.0.0 so dependents are notified.