Skip to content

Commit cbed4c6

Browse files
committed
docs: auth token's example stops putting the credential in argv
The command's own example interpolated the token into curl's arguments, where any local user can read it from ps for the life of the request — the CLI teaching the unsafe shape. It now leads with flagsmith api, where the credential never leaves the process, and shows a curl form that pipes the header in via -H @- (verified: curl reads @- from stdin). Addresses Themis review on #43 (auth.go:215). beep boop
1 parent d0289db commit cbed4c6

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

internal/cmd/auth.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,9 +211,12 @@ var authTokenCmd = &cobra.Command{
211211
Short: "Print the active Admin API credential (for curl and scripts)",
212212
Example: ` flagsmith auth token
213213
214-
# e.g. drive curl with it
215-
curl -H "Authorization: Api-Key $(flagsmith auth token)" \
216-
https://api.flagsmith.com/api/v1/organisations/`,
214+
# to call the API, prefer flagsmith api: the credential never leaves the process
215+
flagsmith api api/v1/organisations/
216+
217+
# with curl, pipe the header in
218+
flagsmith auth token | sed 's/^/Authorization: Api-Key /' |
219+
curl -H @- https://api.flagsmith.com/api/v1/organisations/`,
217220
RunE: func(cmd *cobra.Command, args []string) error {
218221
if _, err := applyContext(cmd); err != nil {
219222
return err

0 commit comments

Comments
 (0)