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

Kinesis Video Signaling Channels - SDK may not get the correct name with custom endpoint #3367

Closed
3 tasks done
marcotuna opened this issue Jun 11, 2020 · 4 comments · Fixed by #4164
Closed
3 tasks done
Labels
bug This issue is a bug.

Comments

@marcotuna
Copy link

Confirm by changing [ ] to [x] below to ensure that it's a bug:

Describe the bug
When using the AWS SDK for Kinesis Video Signaling Channels the HTTP Post request created by the SDK uses wrong values.
This is an excerpt of the HTTP request header:

Authorization: AWS4-HMAC-SHA256 Credential=**REDACTED**/20200611/eu-west-1/Kinesis Video Signaling/aws4_request, SignedHeaders=content-length;content-type;host;x-amz-date, Signature=**REDACTED**

As you can see, in the excerpt there is the name Kinesis Video Signaling, however that name should be kinesisvideo only.
This ends up resulting in a 403 HTTP error with the following message:

"IncompleteSignatureException: \n\tstatus code: 403, request id: **REDACTED**"

Version of AWS SDK for Go?
v1.32.0

Version of Go (go version)?
1.14.2

To Reproduce (observed behavior)

package main

import (
	"fmt"
        "os"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/credentials"
	"github.com/aws/aws-sdk-go/aws/session"
	"github.com/aws/aws-sdk-go/service/kinesisvideosignalingchannels"
)

// New ...
func main() {

	awsConfig := &aws.Config{
		Region: aws.String("eu-west-1"),
		Credentials: credentials.NewStaticCredentials("**REDACTED**", "**REDACTED**", ""),
		LogLevel:    aws.LogLevel(4096), // Set Log Level to DEBUG
	}

	awsSession, err := session.NewSession(awsConfig)

	if err != nil {
		fmt.Println(err)
		os.Exit(1);
	}

	// Set Endpoint URL to Signaling Server
	awsSession.Config.Endpoint = aws.String("THIS SHOULD BE THE SIGNALING SERVER URL")  // Example: https://xx.kinesisvideo.eu-west-1.amazonaws.com

	kvsc := kinesisvideosignalingchannels.New(awsSession)

	out, err := kvsc.GetIceServerConfig(&kinesisvideosignalingchannels.GetIceServerConfigInput{
		ChannelARN: aws.String("THIS SHOULD BE THE SIGNALING CHANNEL ARN"), // Example: arn:aws:kinesisvideo:eu-west-1:00:channel/SIGNALING_NAME/ID
	})

        if err != nil {
		fmt.Println(err)
		os.Exit(1);
	}

        fmt.Printf("%#v\n", out)
}

Expected behavior
The expected behavior should be an HTTP 200 with a content similar to this:

{
  IceServerList: [{
      Password: "**REDACTED**",
      Ttl: 300,
      Uris: ["turn:3-250-15-63.t-e22a89b9.kinesisvideo.eu-west-1.amazonaws.com:443"],
      Username: "**REDACTED**"
    }]
}

Additional context
https://docs.aws.amazon.com/kinesisvideostreams/latest/dg/API_AWSAcuitySignalingService_GetIceServerConfig.html

One workaround for this problem is to add the following line after the kinesisvideosignalingchannels instantiation
kvsc.Client.ServiceName = "kinesisvideo"

Refer to the following file:
https://github.com/aws/aws-sdk-go/blob/master/service/kinesisvideosignalingchannels/service.go#L61

@marcotuna marcotuna added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jun 11, 2020
@diehlaws diehlaws self-assigned this Jun 24, 2020
@diehlaws diehlaws removed the needs-triage This issue or PR still needs to be triaged. label Jun 24, 2020
@diehlaws
Copy link
Contributor

Hi @marcotuna, thanks for bringing this to our attention. The SigningName for a service is typically what is used when building the Authorization header during the signing process, if that value is not present in the service's API model (as is the case here) the SDK typically falls back on the endpoint model. However, in this case since a custom endpoint is being specified the SDK is falling back on using the ServiceName which in this case is not appropriate for the signature expected by the service.

We'll look into fixing this shortly, once we have additional information we'll update the issue accordingly.

@diehlaws diehlaws removed their assignment Aug 26, 2020
@jasdel
Copy link
Contributor

jasdel commented Mar 26, 2021

Looks like the SDK needs to add a custom request handler for this API if possible, to detect when a custom endpoint is provided, and lookup the signing name for the API.

@KaibaLopez KaibaLopez added the needs-review This issue or pull request needs review from a core team member. label Aug 24, 2021
@KaibaLopez KaibaLopez changed the title Kinesis Video Signaling Channels wrong ServiceName Kinesis Video Signaling Channels - SDK may not get the correct name with custom endpoint Sep 10, 2021
@KaibaLopez KaibaLopez removed the needs-review This issue or pull request needs review from a core team member. label Sep 10, 2021
@skmcgrail
Copy link
Member

Potential solution: Add a model customization to the code generator to inject the correct signing name into the C2J model.

@github-actions
Copy link

github-actions bot commented Jan 4, 2022

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants