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

Revisions from the MAA API Review #20558

Merged
merged 55 commits into from
Apr 29, 2021
Merged
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
30e5042
Revisions from the MAA API Review
LarryOsterman Apr 20, 2021
65b8d3c
Added MAA code owners
LarryOsterman Apr 20, 2021
6929e97
Fixed typo in codeowners
LarryOsterman Apr 20, 2021
c560614
Updated API definitions
LarryOsterman Apr 20, 2021
9f3524a
Fixed typo in README.md introduced while cleaning up md errors
LarryOsterman Apr 21, 2021
18b7990
More pull request feedback
LarryOsterman Apr 21, 2021
d659679
Next round of API review feedback
LarryOsterman Apr 22, 2021
c5e50e4
Regenerated swagger
LarryOsterman Apr 22, 2021
6f1cde1
Obsoleted deprecated claims in output token
LarryOsterman Apr 23, 2021
c4fb52c
Renamed AttestRequest -> AttestationRequst
LarryOsterman Apr 23, 2021
b1610a5
Update sdk/attestation/Azure.Security.Attestation/README.md
LarryOsterman Apr 23, 2021
e6d80da
Updated with code review feedback from Jesse Squires
LarryOsterman Apr 23, 2021
6561fd5
Merge branch 'LarryO-ApiReviewFeedback' of https://github.com/LarryOs…
LarryOsterman Apr 23, 2021
f37d8a4
Updated APIs
LarryOsterman Apr 23, 2021
9f47173
Updated snippets
LarryOsterman Apr 23, 2021
069f515
Nightly tests also run samples
LarryOsterman Apr 24, 2021
ad0450d
Added locationShortName to tests.yml to fix live test failures on *nix
LarryOsterman Apr 24, 2021
85fbf83
Update sdk/attestation/Azure.Security.Attestation/src/AttestationToke…
LarryOsterman Apr 26, 2021
121f324
Update sdk/attestation/Azure.Security.Attestation/src/AttestationToke…
LarryOsterman Apr 26, 2021
ad3d0c7
Update sdk/attestation/Azure.Security.Attestation/src/AttestationToke…
LarryOsterman Apr 26, 2021
47b675c
Update sdk/attestation/Azure.Security.Attestation/src/AttestationToke…
LarryOsterman Apr 26, 2021
012853e
Update sdk/attestation/Azure.Security.Attestation/src/Models/Attestat…
LarryOsterman Apr 26, 2021
b646363
Update sdk/attestation/Azure.Security.Attestation/src/AttestationToke…
LarryOsterman Apr 26, 2021
a1b4fb8
Update sdk/attestation/Azure.Security.Attestation/src/AttestationToke…
LarryOsterman Apr 26, 2021
b3f76a4
Update sdk/attestation/Azure.Security.Attestation/src/Models/PolicyCe…
LarryOsterman Apr 26, 2021
4809fdf
Update sdk/attestation/Azure.Security.Attestation/src/Models/PolicyCe…
LarryOsterman Apr 26, 2021
7eb6f68
Pull request feedback
LarryOsterman Apr 26, 2021
5a74e5c
Merge branch 'LarryO-ApiReviewFeedback' of https://github.com/LarryOs…
LarryOsterman Apr 26, 2021
d09153d
Regenerate API surface
LarryOsterman Apr 26, 2021
b37d489
Added a reference to the MAA Sample code to readme file; Cleaned up s…
LarryOsterman Apr 26, 2021
f7669b5
All validation exceptions return a new AttestationTokenValidationFail…
LarryOsterman Apr 27, 2021
4bf60b2
Updated changelog to flag more breaking changes; cleaned up some docc…
LarryOsterman Apr 27, 2021
dc149c1
Added model factory for private model types; Added test collateral fo…
LarryOsterman Apr 28, 2021
58b5844
Updated exported API - PolicyTokenHash is now a BinaryData
LarryOsterman Apr 28, 2021
4b59011
Update sdk/attestation/Azure.Security.Attestation/src/AttestationToke…
LarryOsterman Apr 28, 2021
9640944
Update sdk/attestation/Azure.Security.Attestation/src/AttestationAdmi…
LarryOsterman Apr 28, 2021
d479052
Update sdk/attestation/Azure.Security.Attestation/src/AttestationAdmi…
LarryOsterman Apr 28, 2021
d076102
Update sdk/attestation/Azure.Security.Attestation/src/AttestationAdmi…
LarryOsterman Apr 28, 2021
0c37f46
Update sdk/attestation/Azure.Security.Attestation/src/AttestationToke…
LarryOsterman Apr 28, 2021
086c1f3
Update sdk/attestation/Azure.Security.Attestation/src/AttestationAdmi…
LarryOsterman Apr 28, 2021
b98c829
Update sdk/attestation/Azure.Security.Attestation/src/AttestationToke…
LarryOsterman Apr 28, 2021
5cc34cf
Update sdk/attestation/Azure.Security.Attestation/src/AttestationToke…
LarryOsterman Apr 28, 2021
7459a75
Update sdk/attestation/Azure.Security.Attestation/src/AttestationToke…
LarryOsterman Apr 28, 2021
6d060a0
Update sdk/attestation/Azure.Security.Attestation/src/AttestationToke…
LarryOsterman Apr 28, 2021
92f6e93
Update sdk/attestation/Azure.Security.Attestation/src/AttestationToke…
LarryOsterman Apr 28, 2021
69f3587
Update sdk/attestation/Azure.Security.Attestation/src/AttestationToke…
LarryOsterman Apr 28, 2021
1af7d0e
Update sdk/attestation/Azure.Security.Attestation/src/AttestationToke…
LarryOsterman Apr 28, 2021
bc62864
Apply suggestions from code review
LarryOsterman Apr 28, 2021
ad30053
Added descriptive comments
LarryOsterman Apr 28, 2021
48c6d9a
Update sdk/attestation/Azure.Security.Attestation/src/AttestationToke…
LarryOsterman Apr 28, 2021
49335dc
Update sdk/attestation/Azure.Security.Attestation/src/Models/Attestat…
LarryOsterman Apr 28, 2021
21b0c0e
Merged token validation failed exception to shared helper.
LarryOsterman Apr 28, 2021
b5641a6
Merge branch 'master' into LarryO-ApiReviewFeedback
LarryOsterman Apr 28, 2021
05c9172
Updated generated elements
LarryOsterman Apr 28, 2021
cb00497
Issue #20745
LarryOsterman Apr 29, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@
#/<NotInRepo>/ @antcp @AzureAppServiceCLI

# ServiceLabel: %Attestation %Service Attention
/sdk/attestation/ @anilba06
/sdk/attestation/ @anilba06 @larryosterman
/sdk/attestation/azure-security-attestation @azure/ @larryosterman @Azure/azure-sdk-write-attestation @anilba06

# ServiceLabel: %Authorization %Service Attention
/sdk/authorization/Microsoft.Azure.Management.Authorization/ @darshanhs90 @AshishGargMicrosoft
Expand Down
46 changes: 33 additions & 13 deletions sdk/attestation/Azure.Security.Attestation/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
- Hopefully the final changes for Azure Attestation Service for .Net. Mostly code cleanups, but significant improvements to the `AttestationToken` class.

### Breaking change

- Clients no longer need to instantiate `SecuredAttestationToken` or `UnsecuredAttestationToken` objects to validate the token hash. All of the functionality associated with `SecuredAttestationToken` and `UnsecuredAttestationToken` has been folded into the `AttestationToken` class.
As a result, the `SecuredAttestationToken` and `UnsecuredAttestationToken` types have been removed.

Expand All @@ -14,31 +15,45 @@ As a result, the `SecuredAttestationToken` and `UnsecuredAttestationToken` types
// of an attestation token created locally.
TokenSigningKey signingKey = new TokenSigningKey(<Customer provided signing key>, <Customer provided certificate>)
var policySetToken = new AttestationToken(
new StoredAttestationPolicy { AttestationPolicy = attestationPolicy },
BinaryData.FromObjectAsJson(new StoredAttestationPolicy { AttestationPolicy = attestationPolicy }),
signingKey);

using var shaHasher = SHA256Managed.Create();
var attestationPolicyHash = shaHasher.ComputeHash(Encoding.UTF8.GetBytes(policySetToken.ToString()));
byte[] attestationPolicyHash = shaHasher.ComputeHash(Encoding.UTF8.GetBytes(policySetToken.Serialize()));

Debug.Assert(attestationPolicyHash.SequenceEqual(setResult.Value.PolicyTokenHash));
```

- The JSON Web Token associated properties in the `AttestationToken` class have been converted to nullable types to allow the AttestationToken class to express JSON Web Signature objects.
- The token validation related properties in the `AttestationClientOptions` class (validateAttestationTokens, validationCallback) have been moved into the new `TokenValidationOptions` class.
- The `TokenValidationOptions` class contains a number of options to tweak the JSON Web Token validation process, modeled extremely loosely after constructs in [Nimbus JWT](https://connect2id.com/products/nimbus-jose-jwt) and [PyJWT](https://pypi.org/project/PyJWT/).
- The `TokenSigningKey` type has been renamed `AttestationTokenSigningKey`.
- The `PolicyResult` type has been renamed `PolicyModificationResult`.
- The constructor for the `AttestationToken` class has been changed from taking an `object` to taking a `BinaryData`. This allows callers to use their preferred serialization
mechanism. The constructor for `AttestationToken` will ensure that the `body` parameter is in fact a serialized JSON object to ensure it is compatable wih the JSON Web Signature encoding algorithms.
- The inputs to the AttestSgxEnclave and AttestOpenEnclave APIs have been restructured
to reduce the number of parameters passed into the API.
- When creating an `AttestationData` object specifying that the body type is "JSON", the binary data passed in will be verified that it contains a JSON object.
- The return value of `GetPolicyManagementCertificates` has been changed from `AttestationResult<PolicyCertificatesResult>` to `AttestationResult<IReadOnlyList<X509Certificate2>>` to simplify the experience of retrieving the certificate list. As a consequence of this change, the `PolicyCertificatesResult` type has been removed.
- The unused `TpmAttestationRequest` and `TpmAttestationResponse` types have been removed.
- The `AttestationTokenSigningKey` will now ensure that the public key in the provided certificate is the public key corresponding to the private key.

## 1.0.0-beta.2 (2021-04-06)

### Fixed
- [19708](https://github.com/Azure/azure-sdk-for-net/issues/19708), handle JSON values that are not just simple integers.
- [18183](https://github.com/Azure/azure-sdk-for-net/issues/18183), Significant cleanup of README.md.
- [18739](https://github.com/Azure/azure-sdk-for-net/issues/18739), reference the readme.md file in the azure-rest-apis directory instead of referencing the attestation JSON file directly. Also updated to the most recent version of the dataplane swagger files.

- [19708](https://github.com/Azure/azure-sdk-for-net/issues/19708), handle JSON values that are not just simple integers.
- [18183](https://github.com/Azure/azure-sdk-for-net/issues/18183), Significant cleanup of README.md.
- [18739](https://github.com/Azure/azure-sdk-for-net/issues/18739), reference the readme.md file in the azure-rest-apis directory instead of referencing the attestation JSON file directly. Also updated to the most recent version of the dataplane swagger files.

### Breaking Change

- It is no longer necessary to manually Base64Url encode the AttestationPolicy property in the StoredAttestationPolicy model.
This dramatically simplifies the user experience for interacting with the saved attestation policies - developers can treat attestation policies as string values.
- The `SecuredAttestationToken` and `UnsecuredAttestationToken` parameters have been removed from the APIs which took them. Instead those APIs directly take the underlying type.

Before:

``` C#
string attestationPolicy = "version=1.0; authorizationrules{=> permit();}; issuancerules{};";

Expand All @@ -53,33 +68,38 @@ Before:
```

After:
``` C#
string attestationPolicy = "version=1.0; authorizationrules{=> permit();}; issuancerules{};";
var setResult = client.SetPolicy(AttestationType.SgxEnclave,
attestationPolicy,
TestEnvironment.PolicySigningKey0, policyTokenSigner);
```

```C# Snippet:SetPolicy
string attestationPolicy = "version=1.0; authorizationrules{=> permit();}; issuancerules{};";

X509Certificate2 policyTokenCertificate = new X509Certificate2(<Attestation Policy Signing Certificate>);
AsymmetricAlgorithm policyTokenKey = <Attestation Policy Signing Key>;

var setResult = client.SetPolicy(AttestationType.SgxEnclave, attestationPolicy, new AttestationTokenSigningKey(policyTokenKey, policyTokenCertificate));
```

- The `GetPolicy` API has been changed to directly return the policy requested instead of a `StoredAttestationPolicy` object.

Before:

``` C#
var policyResult = await client.GetPolicyAsync(AttestationType.SgxEnclave);
var result = policyResult.Value.AttestationPolicy;
```

After:

```C# Snippet:GetPolicy
var client = new AttestationAdministrationClient(new Uri(endpoint), new DefaultAzureCredential());

var policyResult = await client.GetPolicyAsync(AttestationType.SgxEnclave);
var result = policyResult.Value;
AttestationResponse<string> policyResult = await client.GetPolicyAsync(AttestationType.SgxEnclave);
string result = policyResult.Value;
```

The net result of these changes is a significant reduction in the complexity of interacting with the attestation administration APIs.

## 1.0.0-beta.1 (2021-01-15)

Released as beta, not alpha.

## 1.0.0-alpha.1 (2020-12-08)
Expand Down
Loading