{"record":{"id":"81659659bc67916d","repo":"hatoo/oha","slug":"invalid-aws-signing-params-format-expected-aws-am","errorCode":null,"errorMessage":"Invalid AWS signing params format. Expected aws:amz:region:service","messagePattern":"Invalid AWS signing params format\\. Expected aws:amz:region:service","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/aws_auth.rs","lineNumber":127,"sourceCode":"                .map_err(|_| AwsSignatureError::InvalidAuthorization(signature.to_string()))?,\n        );\n\n        Ok(())\n    }\n\n    pub fn new(\n        access_key: &str,\n        secret_key: &str,\n        signing_params: &str,\n        session_token: Option<String>,\n    ) -> Result<Self, anyhow::Error> {\n        let parts: Vec<&str> = signing_params\n            .strip_prefix(\"aws:amz:\")\n            .unwrap_or_default()\n            .split(':')\n            .collect();\n        if parts.len() != 2 {\n            anyhow::bail!(\"Invalid AWS signing params format. Expected aws:amz:region:service\");\n        }\n\n        Ok(Self {\n            access_key: access_key.into(),\n            secret_key: secret_key.into(),\n            session_token,\n            region: parts[0].to_string(),\n            service: parts[1].to_string(),\n        })\n    }\n}\n","sourceCodeStart":109,"sourceCodeEnd":139,"githubUrl":"https://github.com/hatoo/oha/blob/4efba2d113d165aaaf7533f5d2893e7cc57ebfc1/src/aws_auth.rs#L109-L139","documentation":"AwsSignatureConfig::new parses an AWS SigV4 signing-params string that must have the form `aws:amz:<region>:<service>`. The prefix is stripped, the remainder is split on ':', and if it does not yield exactly two parts (region and service) the constructor fails. This guards against malformed region/service input before any request signing happens.","triggerScenarios":"Calling AwsSignatureConfig::new with a signing_params string that is missing the `aws:amz:` prefix, or whose remainder splits into more or fewer than two colon-separated parts (e.g. `us-east-1` alone, or `aws:amz:region:service:extra`).","commonSituations":"Copy-pasting a SigV4 string from documentation with the wrong prefix; including a colon-bearing extra segment such as a service suffix or profile name; forgetting the prefix entirely and passing just `region:service`.","solutions":["Format the parameter exactly as `aws:amz:<region>:<service>` (e.g. `aws:amz:us-east-1:s3`).","Ensure there are no extra colon-separated segments after region and service.","Check for accidental whitespace or typos in the `aws:amz:` prefix."],"exampleFix":"// before\nAwsSignatureConfig::new(ak, sk, \"us-east-1:s3\", None)?\n// after\nAwsSignatureConfig::new(ak, sk, \"aws:amz:us-east-1:s3\", None)?","handlingStrategy":"validation","validationCode":"fn is_valid_signing_params(s: &str) -> bool {\n    match s.strip_prefix(\"aws:amz:\") {\n        Some(rest) => rest.split(':').count() == 2,\n        None => false,\n    }\n}","typeGuard":"fn valid_signing_params(s: &str) -> Option<(&str, &str)> {\n    let rest = s.strip_prefix(\"aws:amz:\")?;\n    let mut it = rest.splitn(3, ':');\n    let region = it.next()?;\n    let service = it.next()?;\n    if it.next().is_some() { return None; }\n    Some((region, service))\n}","tryCatchPattern":"match AwsSignatureConfig::new(ak, sk, params, token) {\n    Ok(cfg) => /* use cfg */,\n    Err(e) if e.to_string().contains(\"Invalid AWS signing params format\") => {\n        eprintln!(\"Expected format: aws:amz:<region>:<service>, got: {params}\");\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Always build the string with format!(\"aws:amz:{}:{}\", region, service) instead of hand-typing it.","Never embed extra colon-separated fields (tokens, profiles) in the signing params.","Unit-test the params string before passing it to the constructor."],"tags":["aws","sigv4","signing","invalid-argument-format"],"backgroundTag":"invalid-argument-format","analyzedSha":"4efba2d113d165aaaf7533f5d2893e7cc57ebfc1","analyzedAt":"2026-09-09T16:24:23.306Z","contentChangedAt":"2026-09-09T16:24:23.306Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}