Skip to content

Fix nullref in Identity on netfx/netstandard - #68460

Merged
javiercn merged 1 commit into
mainfrom
brecon/identity
Aug 13, 2026
Merged

Fix nullref in Identity on netfx/netstandard#68460
javiercn merged 1 commit into
mainfrom
brecon/identity

Conversation

@BrennanConroy

Copy link
Copy Markdown
Member

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.

Copilot AI lite review requested due to automatic review settings August 12, 2026 18:22
@BrennanConroy BrennanConroy added the area-identity Includes: Identity and providers label Aug 12, 2026

@Youssef1313 Youssef1313 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.

LGTM

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

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_GREATER code path, compute the hash directly from timestepAsBytes when modifierBytes is null.
  • Update ApplyModifier to take a ReadOnlySpan<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

Copy link
Copy Markdown
Member

@BrennanConroy getting this in. Ping me in case we want to revert.

@javiercn
javiercn merged commit 1825bfe into main Aug 13, 2026
35 checks passed
@javiercn
javiercn deleted the brecon/identity branch August 13, 2026 11:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-identity Includes: Identity and providers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RFC 6238 Two-Factor Authentication service fails on .NET Framework 4.8

4 participants