Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Azure Confidential Container MAA token parse and policy validation logic #140

Merged
merged 9 commits into from
Sep 28, 2023

Conversation

yishi-ttd
Copy link
Contributor

@yishi-ttd yishi-ttd commented Sep 26, 2023

What does this MR do?

  • Logic to parse MAA token, validate signature against MAA server, and check policy.
  • Policy to check for MAA payload:
    • Is running in expected SKU (VM is AMD & Host Utility VM).
    • VM is not in debug mode.
    • Location is not China or EU.
    • PK matches in runtime info.

Test Plan

  • UT to verify token parse and policy check logic
  • E2E verified locally that the real token string can be parsed and validated by MAA

Where should the reviewer start

  • src/main/java/com/uid2/shared/secure/azurecc/AzurePublicKeyProvider.java logic to provide Azure public key.
  • src/main/java/com/uid2/shared/secure/azurecc/MaaTokenSignatureValidator.java logic to parse the token and validate signature against MAA
  • src/main/java/com/uid2/shared/secure/azurecc/PolicyValidator.java logic to check policy against the parsed MAA payload.

Notes

  • Why implements a new publickey provider?
    • MAA certs are stored as x5c(X.509 certificate chain), not supported by Google auth lib.
  • How to generate x-ms-runtime field
    • When generate MAA token, we could pass a RunTime Info string to MAA sever. It's the base64 string of JSON payload: { "location": "East US", "publicKey": "abc" }

Copy link
Contributor

@lunwang-ttd lunwang-ttd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@yishi-ttd yishi-ttd merged commit b2a13aa into master Sep 28, 2023
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.

2 participants