Skip to content
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

Add IMDSv1 fallback (#2609) #2610

Merged
merged 2 commits into from
Aug 30, 2022
Merged

Conversation

tustvold
Copy link
Contributor

Which issue does this PR close?

Closes #2609

Rationale for this change

What changes are included in this PR?

Are there any user-facing changes?

@github-actions github-actions bot added the object-store Object Store Interface label Aug 30, 2022
@@ -583,4 +595,84 @@ mod tests {
assert!(!secret.is_empty());
assert!(!token.is_empty())
}

#[tokio::test]
async fn test_mock() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

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 😄

@tustvold tustvold force-pushed the add-imdsv1-fallback branch from d485141 to fb7c505 Compare August 30, 2022 10:57

let token = match token_result {
Ok(t) => Some(t.text().await?),
Err(e) if matches!(e.status(), Some(StatusCode::FORBIDDEN)) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

If I understand this correctly, this means a sligthly lower security level. Maybe allowing this should be a client option?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

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 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/]
Copy link
Contributor

Choose a reason for hiding this comment

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

I really like that you describe the implications here and include some really helpful links to official docs 👍

@tustvold tustvold merged commit 62eeaa5 into apache:master Aug 30, 2022
@ursabot
Copy link

ursabot commented Aug 30, 2022

Benchmark runs are scheduled for baseline = 171f80b and contender = 62eeaa5. 62eeaa5 is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
Conbench compare runs links:
[Skipped ⚠️ Benchmarking of arrow-rs-commits is not supported on ec2-t3-xlarge-us-east-2] ec2-t3-xlarge-us-east-2
[Skipped ⚠️ Benchmarking of arrow-rs-commits is not supported on test-mac-arm] test-mac-arm
[Skipped ⚠️ Benchmarking of arrow-rs-commits is not supported on ursa-i9-9960x] ursa-i9-9960x
[Skipped ⚠️ Benchmarking of arrow-rs-commits is not supported on ursa-thinkcentre-m75q] ursa-thinkcentre-m75q
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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
object-store Object Store Interface
Projects
None yet
Development

Successfully merging this pull request may close these issues.

IMDSv1 Fallback for S3
3 participants