-
Notifications
You must be signed in to change notification settings - Fork 644
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
Implemented authentication via EC2 instance role for ECR #1186
Implemented authentication via EC2 instance role for ECR #1186
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1186 +/- ##
============================================
- Coverage 52.27% 52.06% -0.21%
Complexity 1484 1484
============================================
Files 150 150
Lines 7906 7934 +28
Branches 1183 1185 +2
============================================
- Hits 4133 4131 -2
- Misses 3369 3397 +28
- Partials 404 406 +2
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot !
Looks good to me with some minor comment on validation and encoding.
Also, could you please add a Changelog entry too please ?
|
||
// read instance role | ||
try (InputStream is = response.getEntity().getContent()) { | ||
instanceRole = IOUtils.toString(is, StandardCharsets.UTF_8); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any validation of this instance role needed ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What exactly do you mean with "validation" in this context?
|
||
// get temporary credentials | ||
request = new HttpGet( | ||
"http://169.254.169.254/latest/meta-data/iam/security-credentials/" + instanceRole); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
URL encoding required as instanceRole is an externally (aka 'tainted') data ?
4a54859
to
68b0bf9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks ! lgtm except some minor formatting issue. If you could fix that, we are ready to merge.
try (InputStream is = response.getEntity().getContent()) { | ||
instanceRole = IOUtils.toString(is, StandardCharsets.UTF_8); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
formatting seems to be messed up a bit
68b0bf9
to
ebed8a6
Compare
ebed8a6
to
2261002
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, looks good to me !
This PR adds support for EC2 instance roles as described in issue #1177.
I didn't add any tests since they would only work when run on a correctly configured EC2 instance.