Skip to content

fix(acme): 修复挑战验证阶段匿名 {} 载荷在 AOT 下无 JsonTypeInfo 崩溃 - #31

Merged
239573049 merged 1 commit into
mainfrom
fix/acme-challenge-empty-payload-aot
Jul 22, 2026
Merged

fix(acme): 修复挑战验证阶段匿名 {} 载荷在 AOT 下无 JsonTypeInfo 崩溃#31
239573049 merged 1 commit into
mainfrom
fix/acme-challenge-empty-payload-aot

Conversation

@239573049

Copy link
Copy Markdown
Owner

ChallengeContext.Validate 使用 new {} 作为空对象载荷,Native AOT 下 CertesJsonContext.GetTypeInfo(匿名类型) 返回 null,JwsSigner.Sign 调用 JsonSerializer.Serialize(payload, null) 抛出 ArgumentNullException, 导致证书申请在挑战验证阶段失败。

  • 新增已注册的 EmptyObject 载荷类型,序列化为 {}(RFC 8555 §7.5.1)
  • JwsSigner.Sign 对无法解析元数据的载荷抛出可诊断的 InvalidOperationException, 而非深层 STJ 的裸 ArgumentNullException
  • 保留 null 载荷 -> 空串(POST-as-GET)语义

Motivation and Context

How Has This Been Tested?

Breaking Changes

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

ChallengeContext.Validate 使用 new {} 作为空对象载荷,Native AOT 下
CertesJsonContext.GetTypeInfo(匿名类型) 返回 null,JwsSigner.Sign 调用
JsonSerializer.Serialize(payload, null) 抛出 ArgumentNullException,
导致证书申请在挑战验证阶段失败。

- 新增已注册的 EmptyObject 载荷类型,序列化为 {}(RFC 8555 §7.5.1)
- JwsSigner.Sign 对无法解析元数据的载荷抛出可诊断的 InvalidOperationException,
  而非深层 STJ 的裸 ArgumentNullException
- 保留 null 载荷 -> 空串(POST-as-GET)语义

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@239573049
239573049 merged commit b67c2d5 into main Jul 22, 2026
1 check passed
@239573049
239573049 deleted the fix/acme-challenge-empty-payload-aot branch July 22, 2026 10:11
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.

1 participant