Skip to content

Commit 4f6ea97

Browse files
committed
change flag to use env to not allow secret retrieval by ps aux
1 parent 07f73a3 commit 4f6ea97

2 files changed

Lines changed: 5 additions & 6 deletions

File tree

e2e/packages/infisical/compose.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,6 @@ func (s *Stack) ApiUrl(ctx context.Context) (string, error) {
228228

229229
func BackendOptionsFromEnv() BackendOptions {
230230
backendDir, found := os.LookupEnv("INFISICAL_BACKEND_DIR")
231-
fmt.Println("backendDir", backendDir)
232231
if !found {
233232
panic("INFISICAL_BACKEND_DIR not set, in order fo the e2e tests to work, you need to set the INFISICAL_BACKEND_DIR environment variable to the path of the backend directory, e.g. /Users/your-username/code/infisical/backend")
234233
}

packages/cmd/proxy.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,18 +129,18 @@ func startProxyServer(cmd *cobra.Command, args []string) {
129129
util.HandleError(err, "Unable to parse use-sse flag")
130130
}
131131

132-
clientId, err := cmd.Flags().GetString("client-id")
132+
clientId, err := util.GetCmdFlagOrEnvWithDefaultValue(cmd, "client-id", []string{util.INFISICAL_UNIVERSAL_AUTH_CLIENT_ID_NAME}, "")
133133
if err != nil {
134134
util.HandleError(err, "Unable to parse client-id flag")
135135
}
136136

137-
clientSecret, err := cmd.Flags().GetString("client-secret")
137+
clientSecret, err := util.GetCmdFlagOrEnvWithDefaultValue(cmd, "client-secret", []string{util.INFISICAL_UNIVERSAL_AUTH_CLIENT_SECRET_NAME}, "")
138138
if err != nil {
139139
util.HandleError(err, "Unable to parse client-secret flag")
140140
}
141141

142142
if useSSE && (clientId == "" || clientSecret == "") {
143-
util.PrintErrorMessageAndExit("--client-id and --client-secret are required when --use-sse is enabled")
143+
util.PrintErrorMessageAndExit("--client-id and --client-secret are required when --use-sse is enabled. Set via flags or INFISICAL_UNIVERSAL_AUTH_CLIENT_ID / INFISICAL_UNIVERSAL_AUTH_CLIENT_SECRET environment variables.")
144144
}
145145

146146
domainURL, err := url.Parse(domain)
@@ -616,8 +616,8 @@ func init() {
616616
proxyStartCmd.Flags().String("tls-key-file", "", "The path to the TLS key file for the proxy server. Required when `tls-enabled` is set to true (default)")
617617
proxyStartCmd.Flags().Bool("tls-enabled", true, "Whether to enable TLS for the proxy server. Defaults to true")
618618
proxyStartCmd.Flags().Bool("use-sse", false, "Enable SSE (Server-Sent Events) mode for real-time cache invalidation. When enabled, the static secrets refresh loop is disabled and --client-id/--client-secret are required.")
619-
proxyStartCmd.Flags().String("client-id", "", "Universal auth client ID for SSE (required when --use-sse is enabled)")
620-
proxyStartCmd.Flags().String("client-secret", "", "Machine identity client secret for universal auth (required when --use-sse is enabled)")
619+
proxyStartCmd.Flags().String("client-id", "", "Universal auth client ID for SSE (env: INFISICAL_UNIVERSAL_AUTH_CLIENT_ID)")
620+
proxyStartCmd.Flags().String("client-secret", "", "Machine identity client secret for universal auth (env: INFISICAL_UNIVERSAL_AUTH_CLIENT_SECRET)")
621621

622622
proxyDebugCmd.Flags().String("listen-address", "localhost:8081", "The address where the proxy server is listening. Defaults to localhost:8081")
623623

0 commit comments

Comments
 (0)