diff --git a/backend/src/models/identityAccessToken.ts b/backend/src/models/identityAccessToken.ts index 7acdb2dbe..82b2e6778 100644 --- a/backend/src/models/identityAccessToken.ts +++ b/backend/src/models/identityAccessToken.ts @@ -53,13 +53,13 @@ const identityAccessTokenSchema = new Schema( accessTokenTTL: { // seconds // incremental lifetime type: Number, - default: 7200, + default: 2592000, // 30 days required: true }, accessTokenMaxTTL: { // seconds // max lifetime type: Number, - default: 7200, + default: 2592000, // 30 days required: true }, accessTokenTrustedIps: { diff --git a/backend/src/validation/auth.ts b/backend/src/validation/auth.ts index 31f707875..b2bea1a4c 100644 --- a/backend/src/validation/auth.ts +++ b/backend/src/validation/auth.ts @@ -117,7 +117,9 @@ export const AddUniversalAuthToIdentityV1 = z.object({ .min(1) .default([{ ipAddress: "0.0.0.0/0" }]), accessTokenTTL: z.number().int().min(0).default(7200), - accessTokenMaxTTL: z.number().int().min(0).default(2592000), + accessTokenMaxTTL: z.number().int().refine(value => value !== 0, { + message: "accessTokenMaxTTL must have a non zero number", + }).default(2592000), // 30 days accessTokenNumUsesLimit: z.number().int().min(0).default(0) }) }); @@ -143,7 +145,9 @@ export const UpdateUniversalAuthToIdentityV1 = z.object({ .optional(), accessTokenTTL: z.number().int().min(0).optional(), accessTokenNumUsesLimit: z.number().int().min(0).optional(), - accessTokenMaxTTL: z.number().int().min(0).optional(), + accessTokenMaxTTL: z.number().int().refine(value => value !== 0, { + message: "accessTokenMaxTTL must have a non zero number", + }).optional(), }), }); diff --git a/cli/packages/cmd/run.go b/cli/packages/cmd/run.go index ef83bc10c..8aa5306d9 100644 --- a/cli/packages/cmd/run.go +++ b/cli/packages/cmd/run.go @@ -204,7 +204,8 @@ func init() { func executeSingleCommandWithEnvs(args []string, secretsCount int, env []string) error { command := args[0] argsForCommand := args[1:] - color.Green("Injecting %v Infisical secrets into your application process", secretsCount) + + log.Info().Msgf(color.GreenString("Injecting %v Infisical secrets into your application process", secretsCount)) cmd := exec.Command(command, argsForCommand...) cmd.Stdin = os.Stdin @@ -232,7 +233,7 @@ func executeMultipleCommandWithEnvs(fullCommand string, secretsCount int, env [] cmd.Stderr = os.Stderr cmd.Env = env - color.Green("Injecting %v Infisical secrets into your application process", secretsCount) + log.Info().Msgf(color.GreenString("Injecting %v Infisical secrets into your application process", secretsCount)) log.Debug().Msgf("executing command: %s %s %s \n", shell[0], shell[1], fullCommand) return execCmd(cmd) diff --git a/cli/packages/util/check-for-update.go b/cli/packages/util/check-for-update.go index 9921cef0d..f3aca2776 100644 --- a/cli/packages/util/check-for-update.go +++ b/cli/packages/util/check-for-update.go @@ -11,7 +11,6 @@ import ( "os/exec" "runtime" "strings" - "time" "github.com/fatih/color" "github.com/rs/zerolog/log" @@ -21,16 +20,16 @@ func CheckForUpdate() { if checkEnv := os.Getenv("INFISICAL_DISABLE_UPDATE_CHECK"); checkEnv != "" { return } - latestVersion, publishedDate, err := getLatestTag("Infisical", "infisical") + latestVersion, _, err := getLatestTag("Infisical", "infisical") if err != nil { log.Debug().Err(err) // do nothing and continue return } - daysSinceRelease, _ := daysSinceDate(publishedDate) + // daysSinceRelease, _ := daysSinceDate(publishedDate) - if latestVersion != CLI_VERSION && daysSinceRelease > 2 { + if latestVersion != CLI_VERSION { yellow := color.New(color.FgYellow).SprintFunc() blue := color.New(color.FgCyan).SprintFunc() black := color.New(color.FgBlack).SprintFunc() @@ -151,15 +150,15 @@ func IsRunningInDocker() bool { return strings.Contains(string(cgroup), "docker") } -func daysSinceDate(dateString string) (int, error) { - layout := "2006-01-02T15:04:05Z" - parsedDate, err := time.Parse(layout, dateString) - if err != nil { - return 0, err - } +// func daysSinceDate(dateString string) (int, error) { +// layout := "2006-01-02T15:04:05Z" +// parsedDate, err := time.Parse(layout, dateString) +// if err != nil { +// return 0, err +// } - currentTime := time.Now() - difference := currentTime.Sub(parsedDate) - days := int(difference.Hours() / 24) - return days, nil -} +// currentTime := time.Now() +// difference := currentTime.Sub(parsedDate) +// days := int(difference.Hours() / 24) +// return days, nil +// } diff --git a/frontend/src/views/Org/MembersPage/components/OrgIdentityTab/components/IdentitySection/IdentityUniversalAuthForm.tsx b/frontend/src/views/Org/MembersPage/components/OrgIdentityTab/components/IdentitySection/IdentityUniversalAuthForm.tsx index 8090212f7..bfc88bf7e 100644 --- a/frontend/src/views/Org/MembersPage/components/OrgIdentityTab/components/IdentitySection/IdentityUniversalAuthForm.tsx +++ b/frontend/src/views/Org/MembersPage/components/OrgIdentityTab/components/IdentitySection/IdentityUniversalAuthForm.tsx @@ -89,7 +89,7 @@ export const IdentityUniversalAuthForm = ({ resolver: yupResolver(schema), defaultValues: { accessTokenTTL: "7200", - accessTokenMaxTTL: "0", + accessTokenMaxTTL: "2592000", accessTokenNumUsesLimit: "0", clientSecretTrustedIps: [{ ipAddress: "0.0.0.0/0" @@ -112,7 +112,7 @@ export const IdentityUniversalAuthForm = ({ } = useFieldArray({ control, name: "accessTokenTrustedIps" }); useEffect(() => { - if (data) { // TODO: fix data type + if (data) { reset({ accessTokenTTL: String(data.accessTokenTTL), accessTokenMaxTTL: String(data.accessTokenMaxTTL), @@ -137,7 +137,7 @@ export const IdentityUniversalAuthForm = ({ } else { reset({ accessTokenTTL: "7200", - accessTokenMaxTTL: "7200", + accessTokenMaxTTL: "2592000", accessTokenNumUsesLimit: "0", clientSecretTrustedIps: [{ ipAddress: "0.0.0.0/0" @@ -231,7 +231,7 @@ export const IdentityUniversalAuthForm = ({ /> (