You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/08/30 10:52:19 UTC
[GitHub] [arrow-rs] tustvold opened a new pull request, #2610: Add IMDSv1 fallback (#2609)
tustvold opened a new pull request, #2610:
URL: https://github.com/apache/arrow-rs/pull/2610
# Which issue does this PR close?
<!--
We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123.
-->
Closes #2609
# Rationale for this change
<!--
Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.
-->
# What changes are included in this PR?
<!--
There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR.
-->
# Are there any user-facing changes?
<!--
If there are user-facing changes then we may require documentation to be updated before approving the PR.
-->
<!---
If there are any breaking changes to public APIs, please add the `breaking change` label.
-->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-rs] crepererum commented on a diff in pull request #2610: Add IMDSv1 fallback (#2609)
Posted by GitBox <gi...@apache.org>.
crepererum commented on code in PR #2610:
URL: https://github.com/apache/arrow-rs/pull/2610#discussion_r958363403
##########
object_store/src/aws/mod.rs:
##########
@@ -446,6 +447,23 @@ impl AmazonS3Builder {
self
}
+ /// By default instance credentials will only be fetched over [IMDSv2], as AWS recommends
+ /// against having IMDSv1 enabled on EC2 instances as it is vulnerable to [SSRF attack]
+ ///
+ /// However, certain deployment environments, such as those running old versions of kube2iam,
+ /// may not support IMDSv2. This option will enable automatic fallback to using IMDSv1
+ /// if the token endpoint returns a 403 error indicating that IMDSv2 is not supported.
+ ///
+ /// This option has no effect if not using instance credentials
+ ///
+ /// [IMDSv2]: [https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/configuring-instance-metadata-service.html]
+ /// [SSRF attack]: [https://aws.amazon.com/blogs/security/defense-in-depth-open-firewalls-reverse-proxies-ssrf-vulnerabilities-ec2-instance-metadata-service/]
Review Comment:
I really like that you describe the implications here and include some really helpful links to official docs :+1:
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-rs] ursabot commented on pull request #2610: Add IMDSv1 fallback (#2609)
Posted by GitBox <gi...@apache.org>.
ursabot commented on PR #2610:
URL: https://github.com/apache/arrow-rs/pull/2610#issuecomment-1231921663
Benchmark runs are scheduled for baseline = 171f80b31dbdea9b34ea516f392b018272dcaebf and contender = 62eeaa5ebd59ac611b8d17f2fc26373fc30af53f. 62eeaa5ebd59ac611b8d17f2fc26373fc30af53f is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
Conbench compare runs links:
[Skipped :warning: Benchmarking of arrow-rs-commits is not supported on ec2-t3-xlarge-us-east-2] [ec2-t3-xlarge-us-east-2](https://conbench.ursa.dev/compare/runs/2cfc8c1ed20b4e9ca79ee8f0c3c46d0e...3d045cee22c94cc39d3a673192b1d3c8/)
[Skipped :warning: Benchmarking of arrow-rs-commits is not supported on test-mac-arm] [test-mac-arm](https://conbench.ursa.dev/compare/runs/2e317977dd884800a8edb19fdc5a89f3...bcaa44293335478083278e1bf887a3d8/)
[Skipped :warning: Benchmarking of arrow-rs-commits is not supported on ursa-i9-9960x] [ursa-i9-9960x](https://conbench.ursa.dev/compare/runs/27b7f5b5fa5547a095ca00723287bf2f...26a90283c1904e1da7d337fbd9e3efe7/)
[Skipped :warning: Benchmarking of arrow-rs-commits is not supported on ursa-thinkcentre-m75q] [ursa-thinkcentre-m75q](https://conbench.ursa.dev/compare/runs/49faa95a0b0540ea8ea1889cd0505084...b0ce1dca9cd5428bad6562fd5d0200e6/)
Buildkite builds:
Supported benchmarks:
ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python, R. Runs only benchmarks with cloud = True
test-mac-arm: Supported benchmark langs: C++, Python, R
ursa-i9-9960x: Supported benchmark langs: Python, R, JavaScript
ursa-thinkcentre-m75q: Supported benchmark langs: C++, Java
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-rs] tustvold commented on a diff in pull request #2610: Add IMDSv1 fallback (#2609)
Posted by GitBox <gi...@apache.org>.
tustvold commented on code in PR #2610:
URL: https://github.com/apache/arrow-rs/pull/2610#discussion_r958355255
##########
object_store/src/aws/credential.rs:
##########
@@ -365,31 +366,39 @@ async fn instance_creds(
const AWS_EC2_METADATA_TOKEN_HEADER: &str = "X-aws-ec2-metadata-token";
let token_url = format!("{}/latest/api/token", endpoint);
- let token = client
+
+ let token_result = client
.request(Method::PUT, token_url)
.header("X-aws-ec2-metadata-token-ttl-seconds", "600") // 10 minute TTL
.send_retry(retry_config)
- .await?
- .text()
- .await?;
+ .await;
+
+ let token = match token_result {
+ Ok(t) => Some(t.text().await?),
+ Err(e) if matches!(e.status(), Some(StatusCode::FORBIDDEN)) => {
Review Comment:
Tbh the security issue is the fact the endpoint has IMDSv1 enabled, not whether the application is actually using it. However, adding an option so you can be confident you aren't using IMDSv1 seems sensible
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-rs] tustvold commented on a diff in pull request #2610: Add IMDSv1 fallback (#2609)
Posted by GitBox <gi...@apache.org>.
tustvold commented on code in PR #2610:
URL: https://github.com/apache/arrow-rs/pull/2610#discussion_r958326261
##########
object_store/src/aws/credential.rs:
##########
@@ -583,4 +595,84 @@ mod tests {
assert!(!secret.is_empty());
assert!(!token.is_empty())
}
+
+ #[tokio::test]
+ async fn test_mock() {
Review Comment:
There wasn't an obvious way to use the ec2-metadata-mock to test this fallback, so I opted to reuse the plumbing from the retry tests. More test coverage can't hurt :smile:
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-rs] crepererum commented on a diff in pull request #2610: Add IMDSv1 fallback (#2609)
Posted by GitBox <gi...@apache.org>.
crepererum commented on code in PR #2610:
URL: https://github.com/apache/arrow-rs/pull/2610#discussion_r958345053
##########
object_store/src/aws/credential.rs:
##########
@@ -365,31 +366,39 @@ async fn instance_creds(
const AWS_EC2_METADATA_TOKEN_HEADER: &str = "X-aws-ec2-metadata-token";
let token_url = format!("{}/latest/api/token", endpoint);
- let token = client
+
+ let token_result = client
.request(Method::PUT, token_url)
.header("X-aws-ec2-metadata-token-ttl-seconds", "600") // 10 minute TTL
.send_retry(retry_config)
- .await?
- .text()
- .await?;
+ .await;
+
+ let token = match token_result {
+ Ok(t) => Some(t.text().await?),
+ Err(e) if matches!(e.status(), Some(StatusCode::FORBIDDEN)) => {
Review Comment:
If I understand this correctly, this means a sligthly lower security level. Maybe allowing this should be a client option?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-rs] tustvold merged pull request #2610: Add IMDSv1 fallback (#2609)
Posted by GitBox <gi...@apache.org>.
tustvold merged PR #2610:
URL: https://github.com/apache/arrow-rs/pull/2610
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org