Fix cross-account deploys restricted by externalId #117
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue
It's possible to restrict cross-account deploys to a specific
externalId
in IAM role policies.Up until the present fix, however, such deploys with a custom
externalId
fail with HTTP 403 forbidden; removing the restriction from the IAM policy instantly allows for the deploy to happen.My understanding of what's happening is:
AWSCodeDeployPublisher
instance receives theexternalId
through its constructor and saves it:aws-codedeploy-plugin/src/main/java/com/amazonaws/codedeploy/AWSCodeDeployPublisher.java
Lines 108 to 130 in 40d7b24
"iamRoleArn"
as credentials, the instance will retrieveexternalId
from the descriptor:aws-codedeploy-plugin/src/main/java/com/amazonaws/codedeploy/AWSCodeDeployPublisher.java
Lines 204 to 207 in 40d7b24
externalId
randomly:aws-codedeploy-plugin/src/main/java/com/amazonaws/codedeploy/AWSCodeDeployPublisher.java
Lines 460 to 464 in 40d7b24
Description of changes
Functional:
AWSCodeDeployPublisher.externalId
instead of the descriptor'sTooling-related:
[*] closes #107, #115 and #116
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.