Skip to content

Commit 681f85e

Browse files
committed
Merge remote-tracking branch 'origin/main' into hyper1
2 parents 94c242b + c606065 commit 681f85e

File tree

64 files changed

+1607
-443
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+1607
-443
lines changed

.changelog/1728582276.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
applies_to:
3+
- aws-sdk-rust
4+
authors:
5+
- aajtodd
6+
references:
7+
- aws-sdk-rust#1193
8+
breaking: false
9+
new_feature: false
10+
bug_fix: true
11+
---
12+
Fix default credential provider chain not respecting endpoint URL overrides from environment

.changelog/1729271936.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
applies_to:
3+
- aws-sdk-rust
4+
authors:
5+
- ysaito1001
6+
references:
7+
- smithy-rs#3883
8+
breaking: false
9+
new_feature: false
10+
bug_fix: false
11+
---
12+
Client SDKs built with the `awsQueryCompatible` trait now include the `x-amzn-query-mode` header. This header signals the service that the clients are operating in compatible mode.

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ jobs:
6565
with:
6666
path: smithy-rs
6767
ref: ${{ inputs.git_ref }}
68+
# `generate-smithy-rs-release` requires access to previous tags to determine if a numerical suffix is needed
69+
# to make the release tag unique
70+
fetch-depth: 0
6871
# The models from aws-sdk-rust are needed to generate the full SDK for CI
6972
- uses: actions/checkout@v4
7073
with:

.github/workflows/release-scripts/create-release.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const assert = require("assert");
1010
const fs = require("fs");
1111

1212
const smithy_rs_repo = {
13-
owner: "awslabs",
13+
owner: "smithy-lang",
1414
repo: "smithy-rs",
1515
};
1616

.github/workflows/release.yml

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -181,12 +181,18 @@ jobs:
181181
ref: ${{ inputs.commit_sha }}
182182
path: smithy-rs
183183
token: ${{ secrets.RELEASE_AUTOMATION_BOT_PAT }}
184+
fetch-depth: 0
184185
- name: Generate release artifacts
185186
uses: ./smithy-rs/.github/actions/docker-build
186187
with:
187188
action: generate-smithy-rs-release
188189
- name: Download all artifacts
189190
uses: ./smithy-rs/.github/actions/download-all-artifacts
191+
# This step is not idempotent, as it pushes release artifacts to the `smithy-rs-release-1.x.y` branch. However,
192+
# if this step succeeds but a subsequent step fails, retrying the release workflow is "safe" in that it does not
193+
# create any inconsistent states; this step would simply fail because the release branch would be ahead of `main`
194+
# due to previously pushed artifacts.
195+
# To successfully retry a release, revert the commits in the release branch that pushed the artifacts.
190196
- name: Push smithy-rs changes
191197
shell: bash
192198
working-directory: smithy-rs-release/smithy-rs
@@ -202,7 +208,7 @@ jobs:
202208
# to retry a release action execution that failed due to a transient issue.
203209
# In that case, we expect the commit to be releasable as-is, i.e. the changelog should have already
204210
# been processed.
205-
git fetch --unshallow
211+
git fetch
206212
if [[ "${DRY_RUN}" == "true" ]]; then
207213
# During dry-runs, "git push" without "--force" can fail if smithy-rs-release-x.y.z-preview is behind
208214
# smithy-rs-release-x.y.z, but that does not matter much during dry-runs.
@@ -214,18 +220,7 @@ jobs:
214220
fi
215221
fi
216222
echo "commit_sha=$(git rev-parse HEAD)" > $GITHUB_OUTPUT
217-
- name: Tag release
218-
uses: actions/github-script@v7
219-
with:
220-
github-token: ${{ secrets.RELEASE_AUTOMATION_BOT_PAT }}
221-
script: |
222-
const createReleaseScript = require("./smithy-rs/.github/workflows/release-scripts/create-release.js");
223-
await createReleaseScript({
224-
github,
225-
isDryRun: ${{ inputs.dry_run }},
226-
releaseManifestPath: "smithy-rs-release/smithy-rs-release-manifest.json",
227-
releaseCommitish: "${{ steps.push-changelog.outputs.commit_sha }}"
228-
});
223+
# This step is idempotent; the `publisher` will not publish a crate if the version is already published on crates.io.
229224
- name: Publish to crates.io
230225
shell: bash
231226
working-directory: smithy-rs-release/crates-to-publish
@@ -247,7 +242,23 @@ jobs:
247242
else
248243
publisher publish -y --location .
249244
fi
245+
# This step is not idempotent and MUST be performed last, as it will generate a new release in the `smithy-rs`
246+
# repository with the release tag that is always unique and has an increasing numerical suffix.
247+
- name: Tag release
248+
uses: actions/github-script@v7
249+
with:
250+
github-token: ${{ secrets.RELEASE_AUTOMATION_BOT_PAT }}
251+
script: |
252+
const createReleaseScript = require("./smithy-rs/.github/workflows/release-scripts/create-release.js");
253+
await createReleaseScript({
254+
github,
255+
isDryRun: ${{ inputs.dry_run }},
256+
releaseManifestPath: "smithy-rs-release/smithy-rs-release-manifest.json",
257+
releaseCommitish: "${{ steps.push-changelog.outputs.commit_sha }}"
258+
});
250259
260+
# If this step fails for any reason, there's no need to retry the release workflow, as this step is auxiliary
261+
# and the release itself was successful. Instead, manually trigger `backport-pull-request.yml`.
251262
open-backport-pull-request:
252263
name: Open backport pull request to merge the release branch back to main
253264
needs:

aws/rust-runtime/Cargo.lock

Lines changed: 5 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

aws/rust-runtime/aws-config/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

aws/rust-runtime/aws-config/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "aws-config"
3-
version = "1.5.8"
3+
version = "1.5.9"
44
authors = [
55
"AWS Rust SDK Team <[email protected]>",
66
"Russell Cohen <[email protected]>",

aws/rust-runtime/aws-config/src/profile/credentials.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ use aws_credential_types::{
3333
Credentials,
3434
};
3535
use aws_smithy_types::error::display::DisplayErrorContext;
36-
use aws_types::SdkConfig;
3736
use std::borrow::Cow;
3837
use std::collections::HashMap;
3938
use std::error::Error;
@@ -142,7 +141,6 @@ pub struct ProfileFileCredentialsProvider {
142141
#[derive(Debug)]
143142
struct Config {
144143
factory: exec::named::NamedProviderFactory,
145-
sdk_config: SdkConfig,
146144
provider_config: ProviderConfig,
147145
}
148146

@@ -493,7 +491,6 @@ impl Builder {
493491
ProfileFileCredentialsProvider {
494492
config: Arc::new(Config {
495493
factory,
496-
sdk_config: conf.client_config(),
497494
provider_config: conf,
498495
}),
499496
inner_provider: ErrorTakingOnceCell::new(),
@@ -542,9 +539,13 @@ impl ChainProvider {
542539
return Err(CredentialsError::provider_error(e));
543540
}
544541
};
542+
543+
// we want to create `SdkConfig` _after_ we have resolved the profile or else
544+
// we won't get things like `service_config()` set appropriately.
545+
let sdk_config = config.provider_config.client_config();
545546
for provider in chain.chain().iter() {
546547
let next_creds = provider
547-
.credentials(creds, &config.sdk_config)
548+
.credentials(creds, &sdk_config)
548549
.instrument(tracing::debug_span!("load_assume_role", provider = ?provider))
549550
.await;
550551
match next_creds {
@@ -609,7 +610,14 @@ mod test {
609610
#[cfg(feature = "sso")]
610611
make_test!(sso_credentials);
611612
#[cfg(feature = "sso")]
613+
make_test!(sso_override_global_env_url);
614+
#[cfg(feature = "sso")]
612615
make_test!(sso_token);
616+
617+
make_test!(assume_role_override_global_env_url);
618+
make_test!(assume_role_override_service_env_url);
619+
make_test!(assume_role_override_global_profile_url);
620+
make_test!(assume_role_override_service_profile_url);
613621
}
614622

615623
#[cfg(all(test, feature = "sso"))]

aws/rust-runtime/aws-config/src/provider_config.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
//! Configuration Options for Credential Providers
77
8+
use crate::env_service_config::EnvServiceConfig;
89
use crate::profile;
910
#[allow(deprecated)]
1011
use crate::profile::profile_file::ProfileFiles;
@@ -196,13 +197,26 @@ impl ProviderConfig {
196197
Self::without_region().load_default_region().await
197198
}
198199

200+
/// Attempt to get a representation of `SdkConfig` from this `ProviderConfig`.
201+
///
202+
///
203+
/// **WARN**: Some options (e.g. `service_config`) can only be set if the profile has been
204+
/// parsed already (e.g. by calling [`ProviderConfig::profile()`]). This is an
205+
/// imperfect mapping and should be used sparingly.
199206
pub(crate) fn client_config(&self) -> SdkConfig {
207+
let profiles = self.parsed_profile.get().and_then(|v| v.as_ref().ok());
208+
let service_config = EnvServiceConfig {
209+
env: self.env(),
210+
env_config_sections: profiles.cloned().unwrap_or_default(),
211+
};
212+
200213
let mut builder = SdkConfig::builder()
201214
.retry_config(RetryConfig::standard())
202215
.region(self.region())
203216
.time_source(self.time_source())
204217
.use_fips(self.use_fips().unwrap_or_default())
205218
.use_dual_stack(self.use_dual_stack().unwrap_or_default())
219+
.service_config(service_config)
206220
.behavior_version(crate::BehaviorVersion::latest());
207221
builder.set_http_client(self.http_client.clone());
208222
builder.set_sleep_impl(self.sleep_impl.clone());
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"HOME": "/home",
3+
"AWS_ENDPOINT_URL": "http://aws.global-env-override"
4+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[default]
2+
region = us-east-1
3+
role_arn = arn:aws:iam::123456789:role/integration-test
4+
source_profile = base
5+
6+
[profile base]
7+
region = us-east-1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[base]
2+
aws_access_key_id = AKIAFAKE
3+
aws_secret_access_key = FAKE
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
{
2+
"events": [
3+
{
4+
"connection_id": 0,
5+
"action": {
6+
"Request": {
7+
"request": {
8+
"uri": "http://aws.global-env-override",
9+
"headers": {
10+
"content-type": [
11+
"application/x-www-form-urlencoded"
12+
],
13+
"authorization": [
14+
"AWS4-HMAC-SHA256 Credential=AKIAFAKE/20210810/us-east-1/sts/aws4_request, SignedHeaders=content-length;content-type;host;x-amz-date;x-amz-user-agent, Signature=cd5cb2aa1d20717ca17692bcbda711797ae9eb8bb1130690b021b3952b7ae56e"
15+
],
16+
"user-agent": [
17+
"aws-sdk-rust/0.1.0 os/macos lang/rust/1.55.0-nightly"
18+
],
19+
"content-length": [
20+
"146"
21+
],
22+
"x-amz-date": [
23+
"20210810T003833Z"
24+
],
25+
"host": [
26+
"aws.global-env-override"
27+
],
28+
"x-amz-user-agent": [
29+
"aws-sdk-rust/0.1.0 api/sts/0.0.14-alpha os/macos lang/rust/1.55.0-nightly"
30+
]
31+
},
32+
"method": "POST"
33+
}
34+
}
35+
}
36+
},
37+
{
38+
"connection_id": 0,
39+
"action": {
40+
"Data": {
41+
"data": {
42+
"Utf8": "Action=AssumeRole&Version=2011-06-15&RoleArn=arn%3Aaws%3Aiam%3A%3A123456789%3Arole%2Fintegration-test&RoleSessionName=assume-role-provider-session"
43+
},
44+
"direction": "Request"
45+
}
46+
}
47+
},
48+
{
49+
"connection_id": 0,
50+
"action": {
51+
"Eof": {
52+
"ok": true,
53+
"direction": "Request"
54+
}
55+
}
56+
},
57+
{
58+
"connection_id": 0,
59+
"action": {
60+
"Response": {
61+
"response": {
62+
"Ok": {
63+
"status": 200,
64+
"version": "HTTP/1.1",
65+
"headers": {
66+
"date": [
67+
"Thu, 05 Aug 2021 18:58:02 GMT"
68+
],
69+
"content-length": [
70+
"1491"
71+
],
72+
"content-type": [
73+
"text/xml"
74+
],
75+
"x-amzn-requestid": [
76+
"c2e971c2-702d-4124-9b1f-1670febbea18"
77+
]
78+
}
79+
}
80+
}
81+
}
82+
}
83+
},
84+
{
85+
"connection_id": 0,
86+
"action": {
87+
"Data": {
88+
"data": {
89+
"Utf8": "<AssumeRoleResponse xmlns=\"https://sts.amazonaws.com/doc/2011-06-15/\">\n <AssumeRoleResult>\n <AssumedRoleUser>\n <AssumedRoleId>AROARABCDEFGHIJKLMNOP:assume-role-provider-session</AssumedRoleId>\n <Arn>arn:aws:sts::123456789012:assumed-role/integration-test/assume-role-provider-session</Arn>\n </AssumedRoleUser>\n <Credentials>\n <AccessKeyId>ASIARTESTID</AccessKeyId>\n <SecretAccessKey>TESTSECRETKEY</SecretAccessKey>\n <SessionToken>TESTSESSIONTOKEN</SessionToken>\n <Expiration>2021-08-05T19:58:02Z</Expiration>\n </Credentials>\n </AssumeRoleResult>\n <ResponseMetadata>\n <RequestId>c2e971c2-702d-4124-9b1f-1670febbea18</RequestId>\n </ResponseMetadata>\n</AssumeRoleResponse>\n"
90+
},
91+
"direction": "Response"
92+
}
93+
}
94+
},
95+
{
96+
"connection_id": 0,
97+
"action": {
98+
"Eof": {
99+
"ok": true,
100+
"direction": "Response"
101+
}
102+
}
103+
}
104+
],
105+
"docs": "standard request / response with STS",
106+
"version": "V0"
107+
}

0 commit comments

Comments
 (0)