Skip to content

Commit

Permalink
Updated checks for validating the API URL
Browse files Browse the repository at this point in the history
  • Loading branch information
GrantKop committed Aug 29, 2023
1 parent 1b4dac2 commit cbc0c35
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cmd/baton-demisto/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main
import (
"context"
"fmt"
"net/url"

"github.com/conductorone/baton-sdk/pkg/cli"
"github.com/spf13/cobra"
Expand All @@ -26,6 +27,13 @@ func validateConfig(ctx context.Context, cfg *config) error {
if cfg.ApiUrl == "" {
return fmt.Errorf("the API URL of the Cortex XSOAR instance must be provided")
}
parsedApiUrl, err := url.Parse(cfg.ApiUrl)
if err != nil {
return fmt.Errorf("failed to parse the API URL: %w", err)
}
if parsedApiUrl.Scheme != "https" {
return fmt.Errorf("the API URL must use the HTTPS scheme")
}

return nil
}
Expand Down

0 comments on commit cbc0c35

Please sign in to comment.