Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
Add requirement for ssh issue credentials command to include either outFilePath or addToAgent flag
Tuan Dangf5a064167170
diff --git a/cli/packages/cmd/ssh.go b/cli/packages/cmd/ssh.goindex 2b3c4f9a82..d7c1f1e269 100644--- a/cli/packages/cmd/ssh.go+++ b/cli/packages/cmd/ssh.go@@ -235,6 +235,15 @@ func issueCredentials(cmd *cobra.Command, args []string) {util.HandleError(err, "Unable to parse flag")}+ addToAgent, err := cmd.Flags().GetBool("addToAgent")+ if err != nil {+ util.HandleError(err, "Unable to parse addToAgent flag")+ }++ if outFilePath == "" && addToAgent == false {+ util.PrintErrorMessageAndExit("You must provide either --outFilePath or --addToAgent flag to use this command")+ }+var (outputDir stringprivateKeyPath string@@ -357,12 +366,7 @@ func issueCredentials(cmd *cobra.Command, args []string) {fmt.Println("Successfully wrote SSH certificate to:", signedKeyPath)}- // Check if we need to add the key to the SSH agent- addToAgent, err := cmd.Flags().GetBool("addToAgent")- if err != nil {- util.HandleError(err, "Unable to parse addToAgent flag")- }-+ // Add SSH credentials to the SSH agent if neededif addToAgent {// Call the helper function to handle add-to-agent flowerr := addCredentialsToAgent(creds.PrivateKey, creds.SignedKey)