fix: AWS4 authentication method didn't sign request body (#430)

Co-authored-by: Gregory Schier <gschier1990@gmail.com>
This commit is contained in:
Mark Fulton
2026-08-14 13:07:05 -07:00
committed by GitHub
co-authored by Gregory Schier
parent 2383f06e71
commit 68671377fd
7 changed files with 18 additions and 2 deletions
+1
View File
@@ -80,6 +80,7 @@ pub(crate) async fn build_metadata<R: Runtime>(
value: value.to_string(),
})
.collect(),
body: None,
};
let plugin_result = plugin_manager
.call_http_authentication(
@@ -251,6 +251,7 @@ pub async fn cmd_ws_connect<R: Runtime>(
.into_iter()
.map(|h| HttpHeader { name: h.name, value: h.value })
.collect(),
body: None,
};
let plugin_result = plugin_manager
.call_http_authentication(
+1 -1
View File
@@ -16,7 +16,7 @@ export type CallHttpAuthenticationActionArgs = { contextId: string, values: { [k
export type CallHttpAuthenticationActionRequest = { index: number, pluginRefId: string, args: CallHttpAuthenticationActionArgs, };
export type CallHttpAuthenticationRequest = { contextId: string, values: { [key in string]?: JsonPrimitive }, method: string, url: string, headers: Array<HttpHeader>, };
export type CallHttpAuthenticationRequest = { contextId: string, values: { [key in string]?: JsonPrimitive }, method: string, url: string, headers: Array<HttpHeader>, body: string | null, };
export type CallHttpAuthenticationResponse = {
/**
+1
View File
@@ -746,6 +746,7 @@ pub struct CallHttpAuthenticationRequest {
pub method: String,
pub url: String,
pub headers: Vec<HttpHeader>,
pub body: Option<String>,
}
#[derive(Debug, Clone, Default, Serialize, Deserialize, TS)]
+12
View File
@@ -41,6 +41,7 @@ use yaak_tls::find_client_certificate;
const HTTP_EVENT_CHANNEL_CAPACITY: usize = 100;
const REQUEST_BODY_CHUNK_SIZE: usize = 1024 * 1024;
const RESPONSE_PROGRESS_UPDATE_INTERVAL_MS: u128 = 100;
const MAX_AUTH_BODY_BYTES: usize = 10 * 1024 * 1024;
#[derive(Debug, Error)]
pub enum SendHttpRequestError {
@@ -1086,6 +1087,17 @@ pub async fn apply_plugin_authentication(
value: value.to_string(),
})
.collect(),
body: match &sendable_request.body {
// Bodies above the cap are not passed to auth plugins. Copying
// them across the plugin IPC is too expensive, and payloads that
// large are usually uploads that signing schemes treat as
// unsigned anyway. Streamed bodies (files, multipart) are never
// passed for the same reason.
Some(SendableBody::Bytes(bytes)) if bytes.len() <= MAX_AUTH_BODY_BYTES => {
String::from_utf8(bytes.to_vec()).ok()
}
_ => None,
},
};
let plugin_result = plugin_manager
.call_http_authentication(plugin_context, authentication_type, req)
+1 -1
View File
@@ -16,7 +16,7 @@ export type CallHttpAuthenticationActionArgs = { contextId: string, values: { [k
export type CallHttpAuthenticationActionRequest = { index: number, pluginRefId: string, args: CallHttpAuthenticationActionArgs, };
export type CallHttpAuthenticationRequest = { contextId: string, values: { [key in string]?: JsonPrimitive }, method: string, url: string, headers: Array<HttpHeader>, };
export type CallHttpAuthenticationRequest = { contextId: string, values: { [key in string]?: JsonPrimitive }, method: string, url: string, headers: Array<HttpHeader>, body: string | null, };
export type CallHttpAuthenticationResponse = {
/**
+1
View File
@@ -65,6 +65,7 @@ export const plugin: PluginDefinition = {
service: String(values.service || "sts"),
region: values.region ? String(values.region) : undefined,
headers,
body: args.body ?? undefined,
doNotEncodePath: true,
},
{