Skip to content

Commit

Permalink
VULN-44842 Add a flag that allows users to not send the Access JWT to…
Browse files Browse the repository at this point in the history
… stdout
  • Loading branch information
jroyal committed Nov 16, 2023
1 parent e0a55f9 commit 45236a1
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions cmd/cloudflared/access/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
)

const (
loginQuietFlag = "quiet"
sshHostnameFlag = "hostname"
sshDestinationFlag = "destination"
sshURLFlag = "url"
Expand Down Expand Up @@ -90,6 +91,13 @@ func Commands() []*cli.Command {
Once authenticated with your identity provider, the login command will generate a JSON Web Token (JWT)
scoped to your identity, the application you intend to reach, and valid for a session duration set by your
administrator. cloudflared stores the token in local storage.`,
Flags: []cli.Flag{
&cli.BoolFlag{
Name: loginQuietFlag,
Aliases: []string{"q"},
Usage: "do not print the jwt to the command line",
},
},
},
{
Name: "curl",
Expand Down Expand Up @@ -246,6 +254,10 @@ func login(c *cli.Context) error {
fmt.Fprintln(os.Stderr, "token for provided application was empty.")
return errors.New("empty application token")
}

if c.Bool(loginQuietFlag) {
return nil
}
fmt.Fprintf(os.Stdout, "Successfully fetched your token:\n\n%s\n\n", cfdToken)

return nil
Expand Down

0 comments on commit 45236a1

Please sign in to comment.