test: user REST permission, signature tests

This commit is contained in:
Luke McCrone
2025-03-14 18:45:34 -03:00
parent 73b07eb8c5
commit ff305d0efc
7 changed files with 189 additions and 48 deletions
+6
View File
@@ -34,6 +34,8 @@ expires="$EXPIRES"
# use this parameter to check incorrect checksums
# shellcheck disable=SC2153,SC2154
checksum_hash="$CHECKSUM"
# shellcheck disable=SC2153,SC2154
fake_signature="$SIGNATURE"
current_date_time=$(date -u +"%Y%m%dT%H%M%SZ")
if [ "$payload" == "" ]; then
@@ -83,6 +85,10 @@ build_canonical_request "${cr_data[@]}"
# shellcheck disable=SC2119
create_canonical_hash_sts_and_signature
if [ "$fake_signature" != "" ]; then
signature="$fake_signature"
fi
curl_command+=(curl -ks -w "\"%{http_code}\"" -X PUT "$AWS_ENDPOINT_URL/$bucket_name/$key")
curl_command+=(-H "\"Authorization: AWS4-HMAC-SHA256 Credential=$aws_access_key_id/$year_month_day/$aws_region/s3/aws4_request,SignedHeaders=$param_list,Signature=$signature\"")
curl_command+=("${header_fields[@]}")