Skip to content

Fix IMDSv2 attestation: pass non-null clientPayload to AttestKeyGuardImportKey#6022

Closed
RyAuld wants to merge 1 commit into
mainfrom
ryauld/fix-imdsv2-attestation-clientpayload
Closed

Fix IMDSv2 attestation: pass non-null clientPayload to AttestKeyGuardImportKey#6022
RyAuld wants to merge 1 commit into
mainfrom
ryauld/fix-imdsv2-attestation-clientpayload

Conversation

@RyAuld
Copy link
Copy Markdown
Contributor

@RyAuld RyAuld commented May 21, 2026

Problem

All 4 ManagedIdentityImdsV2Tests (mTLS PoP with attestation) have been failing since May 20 with:

AADSTS1000901: certificate 'token_not_after' extension has expired

Root Cause

The native AttestationClientLib.dll now requires the clientPayload parameter to be a valid JSON string (at minimum "{}"). Passing null causes error code -8 (ERRORINVALIDINPUTPARAMETER) with native log: "Error parsing the client payload Json"

Confirmed by direct P/Invoke testing on the MSIV2 VM:

  • null -> rc=-8, attestation fails
  • "{}" -> rc=0, valid JWT returned (24h lifetime, exp in the future)

Fix

Pass "{}" instead of null for the clientPayload parameter in AttestationClient.Attest().

Testing

Verified on MSIV2 VM as dcadmin (same user as ADO agent) - attestation succeeds and returns a valid token with correct timestamps.

The native AttestationClientLib.dll now requires a non-null clientPayload
parameter (at minimum an empty JSON object) when calling
AttestKeyGuardImportKey. Passing null results in error code -8
(ERRORINVALIDINPUTPARAMETER) with the native log message:
'Error parsing the client payload Json'.

This was confirmed by direct P/Invoke testing on the MSIV2 VM where
passing '{}' succeeds while null fails.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@RyAuld RyAuld requested a review from a team as a code owner May 21, 2026 21:32
Copilot AI review requested due to automatic review settings May 21, 2026 21:32
@RyAuld RyAuld marked this pull request as draft May 21, 2026 21:37
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 regression in the Key Attestation interop used by IMDSv2 managed identity (mTLS PoP with attestation) by ensuring the native attestation call receives a non-null JSON payload, matching updated AttestationClientLib.dll input requirements.

Changes:

  • Pass "{}" (minimal valid JSON) instead of null for the clientPayload parameter when calling AttestKeyGuardImportKey.

@bgavrilMS bgavrilMS requested a review from gladjohn May 22, 2026 10:19
@bgavrilMS
Copy link
Copy Markdown
Member

Hmm, strange. That contract was tested extensively. Let's have @gladjohn have a look.

@RyAuld RyAuld closed this May 27, 2026
@RyAuld RyAuld deleted the ryauld/fix-imdsv2-attestation-clientpayload branch May 27, 2026 16:29
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.

3 participants