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

Fix IoT custom authorizer without token signature #528

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all 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
7 changes: 2 additions & 5 deletions lib/common/aws_iot_shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,10 @@ export function populate_username_string_with_custom_authorizer(
username_string = add_to_username_parameter(username_string, input_authorizer, "x-amz-customauthorizer-name=");
}

if (is_string_and_not_empty(input_signature) || is_string_and_not_empty(input_token_value) || is_string_and_not_empty(input_token_key_name)) {
if (!input_token_value || !input_token_key_name || !input_signature) {
if (is_string_and_not_empty(input_signature) && input_signature) {
if (!is_string_and_not_empty(input_token_value) || !is_string_and_not_empty(input_token_key_name)) {
throw new Error("Signing-based custom authentication requires all token-related properties to be set");
}
}

if (is_string_and_not_empty(input_signature) && input_signature) {
username_string = add_to_username_parameter(username_string, input_signature, "x-amz-customauthorizer-signature=");
}

Expand Down