Skip to content

Commit

Permalink
Merge pull request #307 from common-fate/CF-153-sanity-check-for-gran…
Browse files Browse the repository at this point in the history
…ted-sso-start-url

CF-153 Add sanity check for granted-sso-start-url
  • Loading branch information
Eddie023 authored Nov 15, 2022
2 parents c485ecf + 7b315a9 commit 9bf8cbc
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pkg/cfaws/granted_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ package cfaws
import (
"context"
"fmt"
"net/url"
"strings"

"github.com/aws/aws-sdk-go-v2/config"
"github.com/common-fate/clio"
"gopkg.in/ini.v1"
)

Expand Down Expand Up @@ -37,6 +39,14 @@ func ParseGrantedSSOProfile(ctx context.Context, profile *Profile) (*config.Shar
if err != nil {
return nil, err
}

// sanity check to verify if the provided value is a valid url
_, err = url.ParseRequestURI(item.Value())
if err != nil {
clio.Debug(err)
return nil, fmt.Errorf("invalid value '%s' provided for 'granted_sso_start_url'", item.Value())
}

cfg.SSOStartURL = item.Value()
return &cfg, err
}
Expand Down

0 comments on commit 9bf8cbc

Please sign in to comment.