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

SVLS-6128 fix: set right domain and arn by region on secrets manager #511

Merged
merged 6 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion bottlecap/src/bin/bottlecap/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,13 @@ async fn register(client: &reqwest::Client) -> Result<RegisterResponse> {
}

fn build_function_arn(account_id: &str, region: &str, function_name: &str) -> String {
format!("arn:aws:lambda:{region}:{account_id}:function:{function_name}")
let arn_prefix = if region.starts_with("cn-") {
"aws-cn"
} else {
"aws"
};

format!("arn:{arn_prefix}:lambda:{region}:{account_id}:function:{function_name}")
alexgallotta marked this conversation as resolved.
Show resolved Hide resolved
}

#[tokio::main]
Expand Down
12 changes: 8 additions & 4 deletions bottlecap/src/secrets/decrypt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,14 @@ fn build_get_secret_signed_headers(
) -> Result<HeaderMap, Box<dyn std::error::Error>> {
let amz_date = header_values.time.format("%Y%m%dT%H%M%SZ").to_string();
let date_stamp = header_values.time.format("%Y%m%d").to_string();
let host = format!(
"{}.{}.amazonaws.com",
header_values.service, aws_config.region
);

let domain = if aws_config.region.starts_with("cn-") {
"amazonaws.com.cn"
} else {
"amazonaws.com"
};

alexgallotta marked this conversation as resolved.
Show resolved Hide resolved
let host = format!("{}.{}.{}", header_values.service, aws_config.region, domain);

let canonical_uri = "/";
let canonical_querystring = "";
Expand Down
Loading