Skip to content

Conversation

rix0rrr
Copy link
Contributor

@rix0rrr rix0rrr commented Sep 22, 2025

Because IAlias extends IKey, IAlias inherits the new keyRef: KeyReference.

It was originally implemented by referencing the underlying key, but that's wrong: it should reference the alias itself, but using the field names it shares with IKey.

In fact, we should have introduced a new interface like IKeyLike to do this job, but instead we overloaded IKey to behave like a hypothetical IKeyLike, and IKeyRef now inherits this double duty.

Therefore, we now make the IKeyRef implementation of Alias behave like a IKeyLikeRef, and satisfy the contract using its own fields.

Closes #35543


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

Because `IAlias` extends `IKey`, `IAlias` inherits the new `keyRef:
KeyReference`.

It was originally implemented by referencing the underlying key, but
that's wrong: it should reference the alias itself, but using the field
names it shares with `IKey`.

In fact, we should have introduced a new interface like `IKeyLike` to do
this job, but instead we overloaded `IKey` to behave like a hypothetical
`IKeyLike`, and `IKeyRef` now inherits this double duty.

Therefore, we now make the `IKeyRef` implementation of `Alias` behave
like a `IKeyLikeRef`, and satisfy the contract using its own fields.
@rix0rrr rix0rrr added the pr-linter/exempt-integ-test The PR linter will not require integ test changes label Sep 22, 2025
@github-actions github-actions bot added bug This issue is a bug. p2 labels Sep 22, 2025
@aws-cdk-automation aws-cdk-automation requested a review from a team September 22, 2025 11:48
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Sep 22, 2025
Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

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

(This review is outdated)

@rix0rrr rix0rrr changed the title fix(kms): Alias reference incorrectly resolves to underlying Key fix(kms): Alias reference incorrectly resolves to underlying Key Sep 22, 2025
@aws-cdk-automation aws-cdk-automation dismissed their stale review September 22, 2025 11:59

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

rix0rrr added a commit that referenced this pull request Sep 22, 2025
The `IFunctionRef` implementation of `LatestVersion` returns the
underlying function ARN, instead of the version's ARN.

This is a similar situation and fix to #35545.
Copy link
Contributor

mergify bot commented Sep 22, 2025

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

Copy link
Contributor

mergify bot commented Sep 22, 2025

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot merged commit 43ffcff into main Sep 22, 2025
19 checks passed
@mergify mergify bot deleted the huijbers/kms-alias-ref branch September 22, 2025 16:28
Copy link
Contributor

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 22, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug This issue is a bug. contribution/core This is a PR that came from AWS. p2 pr-linter/exempt-integ-test The PR linter will not require integ test changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

rds: upgrade to 2.215.0 causes replacement on DatabaseCluster due to changed KmsKeyId
3 participants