Fix nullref in Identity on netfx/netstandard - #68460
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a NullReferenceException in Identity’s RFC 6238 TOTP computation when running on NETSTANDARD2_0 / NETFRAMEWORK by ensuring modifierBytes: null is handled without calling ApplyModifier.
Changes:
- In the non-
NET6_0_OR_GREATERcode path, compute the hash directly fromtimestepAsByteswhenmodifierBytesisnull. - Update
ApplyModifierto take aReadOnlySpan<byte>input to align with how it’s used across framework-specific branches.
Show a summary per file
| File | Description |
|---|---|
| src/Identity/Extensions.Core/src/Rfc6238AuthenticationService.cs | Avoids calling ApplyModifier with null modifier bytes on netstandard/netfx, preventing the reported NRE during TOTP validation. |
Review details
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
- Files reviewed: 1/1 changed files
- Comments generated: 0
- Review effort level: Lite
javiercn
approved these changes
Aug 13, 2026
Member
|
@BrennanConroy getting this in. Ping me in case we want to revert. |
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.
Fixes #54634
I don't think null analysis runs on netstandard/netfx so this was missed in #44557
Specifically, https://github.com/dotnet/aspnetcore/pull/44557/changes#diff-fbad76b3623a1dfa54927dc4b3509ef75bfeb5425852e5640e9a035643ac3275L70 where we used to return the input array but now nullref.