smithy-lang / smithy

Smithy is a protocol-agnostic interface definition language and set of tools for generating clients, servers, and documentation for any programming language.
https://smithy.io
Apache License 2.0
1.7k stars 201 forks source link

Add SigV4 and SigV4A migration diff validation #2245

Closed syall closed 2 months ago

syall commented 2 months ago

Overview

Dependent on #2250, which is the first commit of this PR

These changes add SigV4 (aws.auth#sigv4, sigv4) and SigV4A (aws.auth#sigv4a, sigv4a) migration diff validation.

This is important since not all SigV4 credentials work with SigV4A, so migration from SigV4 to SigV4A is not backward compatible.

At the time of writing, it is uncertain whether migrating from SigV4A to SigV4 is backward compatible.

Simplified, the SigV4 migration validation events are emitted when:

Validation Tables

Keywords:

For both @auth and @smithy.rules#endpointRuleSet auth schemes, these are the following validations:

Old Model Auth New Model Auth Expectation
[no sigv4 + no sigv4a] [any] Skips validation since no migration
[with sigv4 + no sigv4a] [no sigv4a] Skips validation since no migration
[with sigv4a + no sigv4] [no sigv4] Skips validation since no migration
[with sigv4, with sigv4a] [with sigv4, with sigv4a] Skips validation since no migration
[with sigv4 + no sigv4a] [with sigv4a + no sigv4] Danger: sigv4a replaced sigv4, but not all sigv4 credentials are compatible with sigv4a
[with sigv4a + no sigv4] [with sigv4 + no sigv4a] Danger: sigv4 replaced sigv4a, but signing scope could be narrowed (typically from *)
[with sigv4 + no sigv4a] [with sigv4, with sigv4a] Backward compatible: sigv4 will still resolve before sigv4a
[with sigv4a + no sigv4] [with sigv4a, with sigv4] Backward compatible: sigv4a will still resolve before sigv4
[with sigv4 + no sigv4a] [with sigv4a, with sigv4] Danger: sigv4a will resolve before sigv4, but not all sigv4 credentials are compatible with sigv4a
[with sigv4a + no sigv4] [with sigv4, with sigv4a] Danger: sigv4 will resolve before sigv4a, but signing scope could be narrowed (typically from *)
[with sigv4, with sigv4a] [with sigv4a, with sigv4] Danger: sigv4 and sigv4a order is changed, but not all sigv4 credentials are compatible with sigv4a
[with sigv4a, with sigv4] [with sigv4, with sigv4a] Danger: sigv4 and sigv4a order is changed, but signing scope could be narrowed (typically from *)

Testing

Related


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.