Repository navigation
License validation: clear messages for malformed keys, client platforms, and IdentityModel version mismatches - #4670
Conversation
…forms - Check the key's structure (three base64url segments, 342-character RS256 signature) before validating, and log an error-level "incomplete or corrupted" message instead of an IDX signature error (#4661). The key is never logged. - Add a copy/paste hint when validation fails with an invalid signature. - Detect client platforms without RSA support, such as Blazor WASM (#4662). JsonWebTokenHandler swallows the PlatformNotSupportedException and reports IDX10511, with the original exception only as PII-hidden message text, so probe RSA directly before validating. Also walk the result's exception chain for a PlatformNotSupportedException. Fixes #4661 Fixes #4662 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…debug IDX exceptions aren't actionable for customers, and with PII logging off they hide most details anyway. Log one plain critical message per failure kind (invalid signature, undecodable token, wrong issuer/audience, other) without the exception, and log the exception at debug level for support. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Mixed Microsoft.IdentityModel.* package versions surface as IDX14102 wrapping a MissingMethodException (seen in support on MAUI). Report that as a package version problem rather than a corrupted key. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Shipped binaries live for years, so link to redirects we control (license key, client platforms, IdentityModel versions) instead of docs URLs that have already moved once. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Document the new validation messages (incomplete/corrupted key, signature mismatch, not a Lucky Penny key, mismatched Microsoft.IdentityModel versions), the client-platform INFO message, and how to see the underlying exception at Debug level. These sections are the targets of the /go redirects. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 252803384a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| The key is missing characters or contains characters that aren't part of a license key. This usually happens when the key is copied from a PDF or an email, where it can be truncated or wrapped across lines. | ||
|
|
||
| AutoMapper removes whitespace (spaces, tabs, and line breaks) from the key before validating it, so line breaks and trailing newlines, such as those in Kubernetes secrets created from files, are not a problem. Missing characters can't be recovered: copy the full key again from your [account page](https://luckypennysoftware.com/account). |
There was a problem hiding this comment.
Align whitespace troubleshooting advice with the implemented behavior
For keys containing line breaks or a trailing newline, the documented behavior does not match this commit: ResolveLicenseKey returns the configured value unchanged, and IsWellFormed rejects every whitespace character before validation. A valid key loaded from the Kubernetes secret described here therefore still produces the incomplete-or-corrupted error, while this guidance incorrectly rules out the cause. Include the whitespace-normalization dependency before publishing this claim, or document that whitespace must currently be removed by the caller.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
🟡 Changes recommended
Unsupported-platform handling still triggers a downstream missing-license warning instead of the intended informational-only message.
1 open issue
What changed in this PR
This PR improves AutoMapper’s license-validation diagnostics for malformed keys, unsupported client platforms, and IdentityModel package mismatches.
Changes:
- Adds structural key checks and an RSA availability probe.
- Replaces customer-facing exception details with actionable messages and support links, retaining details at Debug level.
- Adds diagnostic tests and troubleshooting documentation; merging remains dependent on #4663 and redirect deployment.
| File | Description |
|---|---|
| src/UnitTests/Licensing/LicenseAccessorTests.cs | Tests malformed keys, failure classification, and logging behavior. |
| src/AutoMapper/Licensing/LicenseAccessor.cs | Adds key checks, platform detection, and clearer validation messages. |
| docs/source/License-configuration.md | Documents troubleshooting, log levels, and client-platform behavior. |
Review effort: Balanced
| LogPlatformNotSupported(); | ||
| return []; |
# Conflicts: # src/AutoMapper/Licensing/LicenseAccessor.cs
- When license keys can't be validated on this platform (no RSA, e.g. Blazor WASM), mark the license as validation-unsupported so the validator skips the "no valid license key" warning after the INFO client-platform message. - Rename LicenseKeyLink to AccountPageLink: CodeQL's name heuristic flagged the URL constant as sensitive data. - Include the debug-level exception in the test failure message for the plain-critical assertions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…pply The test host's AppDomain doesn't use AutoMapper.UnitTests.dll.config, so redirects such as System.Threading.Tasks.Extensions were ignored and license validation failed to load them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…vered With xunit.appDomain=ifAvailable the net471 run reports "No test is available" and passes with zero tests. Back to skipping the end-to-end invalid signature test on .NET Framework. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Fixes #4661
Fixes #4662
Part of #4659 (whitespace stripping is #4663)
Most license support cases show
IDX10511: Signature validation failedat critical level, even when the key itself is fine. This PR replaces the IdentityModel exceptions in customer-facing logs with one plain message per failure, each with a link that says what to do.Changes
Debugfor support. The failures covered are invalid signature, undecodable token, wrong issuer/audience, and mismatchedMicrosoft.IdentityModel.*package versions (IDX14102 wrappingMissingMethodException, seen in support on MAUI).https://luckypennysoftware.com/go/automapper-*redirects, so they can be repointed after release.License-configuration.mdgets a "Troubleshooting License Key Validation" section, an updated log-level list, and a client-platform note.Why #4662's proposed fix doesn't work
The issue proposed finding
PlatformNotSupportedExceptionby walkingInnerException. In IdentityModel 8.14,JsonWebTokenHandler.ValidateSignaturecatches it and turns it into a string inside the IDX10511 message, and by default that string is hidden as PII. Verified in Blazor WASM (.NET 10, Chrome):RSA.Create()throwsPlatformNotSupportedExceptionSecurityTokenInvalidSignatureExceptionwith no inner exceptionSo this PR checks RSA directly. The inner-exception walk and the
catchare kept as a backup.Before (main), Blazor WASM console:
After:
Tests
There's no real test license key, so the tests build a key with the right structure and a bogus signature. They cover truncation (1/5/20 characters), wrong segment counts, invalid characters, the invalid-signature path, an undecodable header, nested/aggregated
PlatformNotSupportedException, IdentityModel version mismatch, and wrong issuer/audience. They also assert that no critical message carries an exception or "IDX". Full unit suite: 1,253 passed. Docs build with no new warnings.Before merging
/go/automapper-*redirects live (LuckyPennySoftware/Website#395)LicenseAccessor.csis expected🤖 Generated with Claude Code