Skip to content
Open
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions tdx-cli/cmd/token.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ func getToken(cmd *cobra.Command) error {
return errors.New("Either Trust Authority API URL or Trust Authority API Key is missing in config")
}

if !strings.HasPrefix(config.TrustAuthorityApiUrl, "https://") {
return errors.New("Invalid Trust Authority API URL, must start with 'https://'")
}

_, err = url.ParseRequestURI(config.TrustAuthorityApiUrl)
if err != nil {
return errors.Wrap(err, "Invalid Trust Authority API URL")
Expand Down
5 changes: 5 additions & 0 deletions tdx-cli/cmd/verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"fmt"
"net/url"
"os"
"strings"

"github.com/intel/trustauthority-client/go-connector"
"github.com/intel/trustauthority-client/tdx-cli/constants"
Expand Down Expand Up @@ -65,6 +66,10 @@ func verifyToken(cmd *cobra.Command) error {
return errors.New("Trust Authority URL is missing in config")
}

if !strings.HasPrefix(config.TrustAuthorityUrl, "https://") {
return errors.New("Invalid Trust Authority URL, must start with 'https://'")
}

_, err = url.ParseRequestURI(config.TrustAuthorityUrl)
if err != nil {
return errors.Wrap(err, "Invalid Trust Authority URL")
Expand Down