From 71a7497ea7c358c354992605344e6d68a828d9de Mon Sep 17 00:00:00 2001 From: Naor Peled Date: Sat, 24 Dec 2022 03:28:58 +0200 Subject: [PATCH 01/15] initial commit --- frontend/components/basic/InputField.tsx | 1 + frontend/components/basic/buttons/Button.tsx | 4 +- frontend/pages/login.tsx | 121 ++--- frontend/pages/signup.tsx | 491 ++++++++++--------- 4 files changed, 317 insertions(+), 300 deletions(-) diff --git a/frontend/components/basic/InputField.tsx b/frontend/components/basic/InputField.tsx index 46b42c15c..08afa975d 100644 --- a/frontend/components/basic/InputField.tsx +++ b/frontend/components/basic/InputField.tsx @@ -96,6 +96,7 @@ const InputField = ( /> {props.label?.includes('Password') && ( - - + {false && ( +
+ + We are experiencing minor technical difficulties. We are working on + solving it right now. Please come back in a few minutes. +
+ )} +
+

+ Need an Infisical account? +

+ + + +
+ ); } diff --git a/frontend/pages/signup.tsx b/frontend/pages/signup.tsx index 8991dc867..d1eacaff2 100644 --- a/frontend/pages/signup.tsx +++ b/frontend/pages/signup.tsx @@ -40,8 +40,8 @@ const props = { backgroundColor: '#0d1117', color: 'white', border: '1px solid gray', - textAlign: 'center' - } + textAlign: 'center', + }, } as const; const propsPhone = { inputStyle: { @@ -56,8 +56,8 @@ const propsPhone = { backgroundColor: '#0d1117', color: 'white', border: '1px solid gray', - textAlign: 'center' - } + textAlign: 'center', + }, } as const; export default function SignUp() { @@ -148,7 +148,8 @@ export default function SignUp() { } }; - // Verifies if the imformation that the users entered (name, workspace) is there, and if the password matched the criteria. + // Verifies if the imformation that the users entered (name, workspace) is there, and if the password matched the + // criteria. const signupErrorCheck = async () => { setIsLoading(true); let errorCheck = false; @@ -169,7 +170,7 @@ export default function SignUp() { setPasswordErrorLength, setPasswordErrorNumber, setPasswordErrorLowerCase, - currentErrorCheck: errorCheck + currentErrorCheck: errorCheck, }); if (!errorCheck) { @@ -186,8 +187,8 @@ export default function SignUp() { .slice(0, 32) .padStart( 32 + (password.slice(0, 32).length - new Blob([password]).size), - '0' - ) + '0', + ), }) as { ciphertext: string; iv: string; tag: string }; localStorage.setItem('PRIVATE_KEY', PRIVATE_KEY); @@ -195,7 +196,7 @@ export default function SignUp() { client.init( { username: email, - password: password + password: password, }, async () => { client.createVerifier( @@ -204,14 +205,14 @@ export default function SignUp() { email, firstName, lastName, - organizationName: firstName + "'s organization", + organizationName: firstName + '\'s organization', publicKey: PUBLIC_KEY, ciphertext, iv, tag, salt: result.salt, verifier: result.verifier, - token: verificationToken + token: verificationToken, }); // if everything works, go the main dashboard page. @@ -230,16 +231,16 @@ export default function SignUp() { setErrorLogin, router, true, - false + false, ); incrementStep(); } catch (error) { setIsLoading(false); } } - } + }, ); - } + }, ); } else { setIsLoading(false); @@ -250,7 +251,7 @@ export default function SignUp() { const step1 = (

- {"Let'"}s get started + {'Let\''}s get started

@@ -261,260 +262,267 @@ export default function SignUp() {
-
- -
- {/*
+
{e.preventDefault();}}> +
+ +
+ {/*

I do not want to receive emails about Infisical and its products.

*/} -
-

- By creating an account, you agree to our Terms and have read and - acknowledged the Privacy Policy. -

-
-
-
+
); // Step 2 of the signup process (enter the email verification code) const step2 = ( -
-

- {"We've"} sent a verification email to{' '} -

-

- {email}{' '} -

-
- -
-
- -
- {codeError && ( - - )} -
-
-
- {/* +
{e.preventDefault();}}> +
+

+ {'We\'ve'} sent a verification email to{' '} +

+

+ {email}{' '} +

+
+ +
+
+ +
+ {codeError && ( + + )} +
+
+
+ {/* */} -

- Make sure to check your spam inbox. -

+

+ Make sure to check your spam inbox. +

+
-
+ ); // Step 3 of the signup process (enter the rest of the impformation) const step3 = ( -
-

- Almost there! -

-
- -
-
- -
-
- { - setPassword(password); - passwordCheck({ - password, - setPasswordErrorLength, - setPasswordErrorNumber, - setPasswordErrorLowerCase, - currentErrorCheck: false - }); - }} - type="password" - value={password} - isRequired - error={ - passwordErrorLength && passwordErrorNumber && passwordErrorLowerCase - } - autoComplete="new-password" - id="new-password" - /> - {passwordErrorLength || - passwordErrorLowerCase || - passwordErrorNumber ? ( -
-
- Password should contain at least: -
-
- {passwordErrorLength ? ( - - ) : ( - - )} -
- 14 characters +
{e.preventDefault();}}> +
+

+ Almost there! +

+
+ +
+
+ +
+
+ { + setPassword(password); + passwordCheck({ + password, + setPasswordErrorLength, + setPasswordErrorNumber, + setPasswordErrorLowerCase, + currentErrorCheck: false, + }); + }} + type="password" + value={password} + isRequired + error={ + passwordErrorLength && passwordErrorNumber && passwordErrorLowerCase + } + autoComplete="new-password" + id="new-password" + /> + {passwordErrorLength || + passwordErrorLowerCase || + passwordErrorNumber ? ( +
+
+ Password should contain at least: +
+
+ {passwordErrorLength ? ( + + ) : ( + + )} +
+ 14 characters +
+
+
+ {passwordErrorLowerCase ? ( + + ) : ( + + )} +
+ 1 lowercase character +
+
+
+ {passwordErrorNumber ? ( + + ) : ( + + )} +
+ 1 number +
-
- {passwordErrorLowerCase ? ( - - ) : ( - - )} -
- 1 lowercase character -
-
-
- {passwordErrorNumber ? ( - - ) : ( - - )} -
- 1 number -
-
-
- ) : ( -
- )} + ) : ( +
+ )} +
+
+
-
-
-
+ ); // Step 4 of the sign up process (download the emergency kit pdf) const step4 = ( -
-

- Save your Emergency Kit -

-
-
- If you get locked out of your account, your Emergency Kit is the only - way to sign in. +
{e.preventDefault();}}> +
+

+ Save your Emergency Kit +

+
+
+ If you get locked out of your account, your Emergency Kit is the only + way to sign in. +
+
+ We recommend you download it and keep it somewhere safe. +
-
- We recommend you download it and keep it somewhere safe. +
+ + It contains your Secret Key which we cannot access or recover for you if + you lose it.
-
-
- - It contains your Secret Key which we cannot access or recover for you if - you lose it. -
-
-
-
+ ); return ( From d25f4ccc89695ca331c3ab64dc0179d32791f861 Mon Sep 17 00:00:00 2001 From: Naor Peled Date: Sat, 24 Dec 2022 03:33:43 +0200 Subject: [PATCH 02/15] wip --- frontend/pages/login.tsx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/frontend/pages/login.tsx b/frontend/pages/login.tsx index ef9b7a7d6..25fc85a9f 100644 --- a/frontend/pages/login.tsx +++ b/frontend/pages/login.tsx @@ -38,6 +38,10 @@ export default function Login() { * This function check if the user entered the correct credentials and should be allowed to log in. */ const loginCheck = async () => { + if (!email || !password) { + return; + } + setIsLoading(true); await attemptLogin( email, @@ -75,9 +79,11 @@ export default function Login() { />
-
{ - e.preventDefault() - }}> + setErrorLogin(false)} onSubmit={(e) => { + e.preventDefault(); + }} + >

Log in to your account From 13e78833731b284dd343a65875f544f541dc408d Mon Sep 17 00:00:00 2001 From: Naor Peled Date: Sat, 24 Dec 2022 03:34:27 +0200 Subject: [PATCH 03/15] wip --- frontend/pages/login.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/pages/login.tsx b/frontend/pages/login.tsx index 25fc85a9f..5346b77fa 100644 --- a/frontend/pages/login.tsx +++ b/frontend/pages/login.tsx @@ -114,7 +114,7 @@ export default function Login() { Forgot password?

- {errorLogin && } + {!isLoading && errorLogin && }
- {e.preventDefault();}}>
-
); // Step 2 of the signup process (enter the email verification code) const step2 = ( -
{e.preventDefault();}}>

{'We\'ve'} sent a verification email to{' '} @@ -344,12 +341,10 @@ export default function SignUp() {

- ); // Step 3 of the signup process (enter the rest of the impformation) const step3 = ( -
{e.preventDefault();}}>

Almost there! @@ -481,12 +476,10 @@ export default function SignUp() { />

- ); // Step 4 of the sign up process (download the emergency kit pdf) const step4 = ( -
{e.preventDefault();}}>

Save your Emergency Kit @@ -536,7 +529,6 @@ export default function SignUp() {

*/}
- ); return ( @@ -565,7 +557,9 @@ export default function SignUp() { /> - {step == 1 ? step1 : step == 2 ? step2 : step == 3 ? step3 : step4} +
{e.preventDefault();}}> + {step == 1 ? step1 : step == 2 ? step2 : step == 3 ? step3 : step4} +
); From 417eddaeff8b3efbb5875ee48447dd54c3797b83 Mon Sep 17 00:00:00 2001 From: Naor Peled Date: Sat, 24 Dec 2022 03:43:03 +0200 Subject: [PATCH 05/15] cleanup --- frontend/pages/login.tsx | 4 +--- frontend/pages/signup.tsx | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/frontend/pages/login.tsx b/frontend/pages/login.tsx index 5346b77fa..036902de0 100644 --- a/frontend/pages/login.tsx +++ b/frontend/pages/login.tsx @@ -80,9 +80,7 @@ export default function Login() {
setErrorLogin(false)} onSubmit={(e) => { - e.preventDefault(); - }} + onChange={() => setErrorLogin(false)} onSubmit={(e) => e.preventDefault()} >

diff --git a/frontend/pages/signup.tsx b/frontend/pages/signup.tsx index 8ca92aea7..a6743f457 100644 --- a/frontend/pages/signup.tsx +++ b/frontend/pages/signup.tsx @@ -557,7 +557,7 @@ export default function SignUp() { />

- {e.preventDefault();}}> + e.preventDefault()}> {step == 1 ? step1 : step == 2 ? step2 : step == 3 ? step3 : step4}
From 33805ad385958f291fb79be1f8a3c25b500dfb1c Mon Sep 17 00:00:00 2001 From: Maidul Islam Date: Sun, 25 Dec 2022 13:04:59 -0500 Subject: [PATCH 06/15] split builds for cross compile --- .github/workflows/release_build.yml | 11 ++++++++++- .goreleaser.yaml | 21 +++++++++++++++------ 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/.github/workflows/release_build.yml b/.github/workflows/release_build.yml index 695b0ea24..c5fd9034f 100644 --- a/.github/workflows/release_build.yml +++ b/.github/workflows/release_build.yml @@ -13,7 +13,7 @@ permissions: jobs: goreleaser: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v3 with: @@ -24,6 +24,15 @@ jobs: go-version: '>=1.19.3' cache: true cache-dependency-path: cli/go.sum + - name: libssl1.1 => libssl1.0-dev for OSXCross + run: | + echo 'deb http://security.ubuntu.com/ubuntu bionic-security main' | sudo tee -a /etc/apt/sources.list + sudo apt update && apt-cache policy libssl1.0-dev + sudo apt-get install libssl1.0-dev + - name: OSXCross for CGO Support + run: | + mkdir ../../osxcross + git clone https://github.com/plentico/osxcross-target.git ../../osxcross/target - uses: goreleaser/goreleaser-action@v2 with: distribution: goreleaser diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 9ac38524b..5e94e0de6 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -7,12 +7,23 @@ # # you may remove this if you don't need go generate # - cd cli && go generate ./... builds: - - env: - - CGO_ENABLED=0 + - id: darwin-build binary: infisical - id: infisical + env: + - CGO_ENABLED=1 + - CC=/home/runner/work/osxcross/target/bin/o64-clang + - CXX=/home/runner/work/osxcross/target/bin/o64-clang++ goos: - darwin + ignore: + - goos: darwin + goarch: "386" + dir: ./cli + - id: all-other-builds + env: + - CGO_ENABLED=0 + binary: infisical + goos: - freebsd - linux - netbsd @@ -27,8 +38,6 @@ builds: - 6 - 7 ignore: - - goos: darwin - goarch: "386" - goos: windows goarch: "386" - goos: freebsd @@ -71,7 +80,7 @@ nfpms: - id: infisical package_name: infisical builds: - - infisical + - all-other-builds vendor: Infisical, Inc homepage: https://infisical.com/ maintainer: Infisical, Inc From 9d0c293600bda8359513b27da9288dcd66d9a655 Mon Sep 17 00:00:00 2001 From: Maidul Islam Date: Sun, 25 Dec 2022 14:08:34 -0500 Subject: [PATCH 07/15] Update vault docs and add cli FAQ --- docs/cli/commands/vault.mdx | 4 ++-- docs/cli/faq.mdx | 15 +++++++++++++++ docs/mint.json | 3 ++- 3 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 docs/cli/faq.mdx diff --git a/docs/cli/commands/vault.mdx b/docs/cli/commands/vault.mdx index 7ffec4e91..a111b1500 100644 --- a/docs/cli/commands/vault.mdx +++ b/docs/cli/commands/vault.mdx @@ -34,8 +34,8 @@ To ensure secure storage of your login credentials when using the CLI, Infisical If a password manager is not available, your credentials are stored in an encrypted text file. - - By default, the most appropriate password manager is chosen to store your login credentials. + + By default, the most appropriate vault is chosen to store your login credentials. For example, if you are on macOS, KeyChain will be automatically selected. - [macOS Keychain](https://support.apple.com/en-au/guide/keychain-access/welcome/mac) diff --git a/docs/cli/faq.mdx b/docs/cli/faq.mdx new file mode 100644 index 000000000..600386e81 --- /dev/null +++ b/docs/cli/faq.mdx @@ -0,0 +1,15 @@ +--- +title: "FAQ" +--- + +Frequently asked questions about the CLI can be found on this page. +If you can't find the answer you're looking for, please create an issue on our GitHub repository or join our Slack channel for additional support. + + +By default, the CLI will choose the most suitable store available on your system. +If you experience issues with the default store, you can switch to a different one. +If none of the available stores work for you, you can try using the `file` store type by running `infisical vault set file`, which should work in most cases. +If you are still experiencing trouble, please seek support. + +[Learn more about vault command](./commands/vault) + \ No newline at end of file diff --git a/docs/mint.json b/docs/mint.json index 57beea626..cbac56d5a 100644 --- a/docs/mint.json +++ b/docs/mint.json @@ -97,7 +97,8 @@ "cli/commands/export", "cli/commands/vault" ] - } + }, + "cli/faq" ] }, { From 859f4226aed79f661d188d66a4b214aeb76493b2 Mon Sep 17 00:00:00 2001 From: Maidul Islam Date: Sun, 25 Dec 2022 14:16:45 -0500 Subject: [PATCH 08/15] update vault command Description --- docs/cli/commands/vault.mdx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/docs/cli/commands/vault.mdx b/docs/cli/commands/vault.mdx index a111b1500..f973cb727 100644 --- a/docs/cli/commands/vault.mdx +++ b/docs/cli/commands/vault.mdx @@ -30,9 +30,7 @@ title: "infisical vault" ## Description -To ensure secure storage of your login credentials when using the CLI, Infisical saves them to a password manager if one is detected. -If a password manager is not available, your credentials are stored in an encrypted text file. - +To ensure secure storage of your login credentials when using the CLI, Infisical stores login credentials securely in a system vault or encrypted text file with a passphrase known only by the user. By default, the most appropriate vault is chosen to store your login credentials. From 3b6b9d41d1a33377346edc26cd88b6d6f7cae585 Mon Sep 17 00:00:00 2001 From: Maidul Islam Date: Sun, 25 Dec 2022 14:47:46 -0500 Subject: [PATCH 09/15] Remove creating instance on PersistentPreRun --- cli/packages/cmd/root.go | 6 ++---- cli/packages/util/credentials.go | 24 ++++++++++++++++++------ cli/packages/util/vault.go | 17 +++++++---------- 3 files changed, 27 insertions(+), 20 deletions(-) diff --git a/cli/packages/cmd/root.go b/cli/packages/cmd/root.go index 17f78b5d5..7cd9806fc 100644 --- a/cli/packages/cmd/root.go +++ b/cli/packages/cmd/root.go @@ -31,8 +31,6 @@ func init() { rootCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") rootCmd.PersistentFlags().BoolVarP(&debugLogging, "debug", "d", false, "Enable verbose logging") rootCmd.PersistentFlags().StringVar(&util.INFISICAL_URL, "domain", "https://app.infisical.com/api", "Point the CLI to your own backend") - - rootCmd.PersistentPreRun = func(cmd *cobra.Command, args []string) { - util.InitKeyRingInstance() - } + // rootCmd.PersistentPreRun = func(cmd *cobra.Command, args []string) { + // } } diff --git a/cli/packages/util/credentials.go b/cli/packages/util/credentials.go index b83227b71..80c98fa9a 100644 --- a/cli/packages/util/credentials.go +++ b/cli/packages/util/credentials.go @@ -19,7 +19,13 @@ func StoreUserCredsInKeyRing(userCred *models.UserCredentials) error { return fmt.Errorf("StoreUserCredsInKeyRing: something went wrong when marshalling user creds [err=%s]", err) } - err = keyringInstance.Set(keyring.Item{ + // Get keyring + configuredKeyring, err := GetKeyRing() + if err != nil { + return fmt.Errorf("StoreUserCredsInKeyRing: unable to get keyring instance with [err=%s]", err) + } + + err = configuredKeyring.Set(keyring.Item{ Key: userCred.Email, Data: []byte(string(userCredMarshalled)), }) @@ -32,20 +38,26 @@ func StoreUserCredsInKeyRing(userCred *models.UserCredentials) error { } func GetUserCredsFromKeyRing(userEmail string) (credentials models.UserCredentials, err error) { - credentialsValue, err := keyringInstance.Get(userEmail) + // Get keyring + configuredKeyring, err := GetKeyRing() if err != nil { - return models.UserCredentials{}, fmt.Errorf("Unable to get key from Keyring. could not find login credentials in your Keyring. This is common if you have switched vault backend recently. If so, please login in again and retry:", err) + return models.UserCredentials{}, fmt.Errorf("GetUserCredsFromKeyRing: unable to get keyring instance with [err=%s]", err) + } + + credentialsValue, err := configuredKeyring.Get(userEmail) + if err != nil { + return models.UserCredentials{}, fmt.Errorf("GetUserCredsFromKeyRing: unable to get key from Keyring. could not find login credentials in your Keyring. This is common if you have switched vault backend recently. If so, please login in again and retry [err=%s]", err) } var userCredentials models.UserCredentials err = json.Unmarshal([]byte(credentialsValue.Data), &userCredentials) if err != nil { - return models.UserCredentials{}, fmt.Errorf("Something went wrong when unmarshalling user creds:", err) + return models.UserCredentials{}, fmt.Errorf("getUserCredsFromKeyRing: Something went wrong when unmarshalling user creds [err=%s]", err) } if err != nil { - return models.UserCredentials{}, fmt.Errorf("Unable to store user credentials", err) + return models.UserCredentials{}, fmt.Errorf("GetUserCredsFromKeyRing: Unable to store user credentials [err=%s]", err) } return userCredentials, err @@ -82,7 +94,7 @@ func IsUserLoggedIn() (hasUserLoggedIn bool, theUsersEmail string, err error) { if response.StatusCode() > 299 { log.Infoln("Login expired, please login again.") - return false, "", fmt.Errorf("Login expired, please login again.") + return false, "", fmt.Errorf("GetUserCredsFromKeyRing: Login expired, please login again.") } return true, configFile.LoggedInUserEmail, nil diff --git a/cli/packages/util/vault.go b/cli/packages/util/vault.go index 95dba04d8..939bd4c62 100644 --- a/cli/packages/util/vault.go +++ b/cli/packages/util/vault.go @@ -5,14 +5,9 @@ import ( "os" "github.com/99designs/keyring" - log "github.com/sirupsen/logrus" "golang.org/x/term" ) -// Keyring instance -var keyringInstance keyring.Keyring -var keyringInstanceConfig keyring.Config - func GetCurrentVaultBackend() (keyring.BackendType, error) { configFile, err := GetConfigFile() if err != nil { @@ -28,13 +23,13 @@ func GetCurrentVaultBackend() (keyring.BackendType, error) { return configFile.VaultBackendType, nil } -func InitKeyRingInstance() { +func GetKeyRing() (keyring.Keyring, error) { currentVaultBackend, err := GetCurrentVaultBackend() if err != nil { - log.Infof("InitKeyRingInstance: unable to get the current vault backend, [err=%s]", err) + return nil, fmt.Errorf("GetKeyRing: unable to get the current vault backend, [err=%s]", err) } - keyringInstanceConfig = keyring.Config{ + keyringInstanceConfig := keyring.Config{ FilePasswordFunc: fileKeyringPassphrasePrompt, ServiceName: SERVICE_NAME, LibSecretCollectionName: SERVICE_NAME, @@ -51,10 +46,12 @@ func InitKeyRingInstance() { keyringInstanceConfig.AllowedBackends = []keyring.BackendType{keyring.BackendType(currentVaultBackend)} } - keyringInstance, err = keyring.Open(keyringInstanceConfig) + keyringInstance, err := keyring.Open(keyringInstanceConfig) if err != nil { - log.Errorf("InitKeyRingInstance: Unable to create instance of Keyring because of [err=%s]", err) + return nil, fmt.Errorf("GetKeyRing: Unable to create instance of Keyring because of [err=%s]", err) } + + return keyringInstance, nil } func fileKeyringPassphrasePrompt(prompt string) (string, error) { From dd7b2dc1ed03e18a014a670f05c3db1ebca9ccf0 Mon Sep 17 00:00:00 2001 From: Maidul Islam Date: Sun, 25 Dec 2022 14:47:46 -0500 Subject: [PATCH 10/15] Remove creating instance on PersistentPreRun --- cli/packages/cmd/login.go | 2 +- cli/packages/util/vault.go | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/cli/packages/cmd/login.go b/cli/packages/cmd/login.go index 29e2c4935..de9e60bf8 100644 --- a/cli/packages/cmd/login.go +++ b/cli/packages/cmd/login.go @@ -91,7 +91,7 @@ var loginCmd = &cobra.Command{ err = util.StoreUserCredsInKeyRing(userCredentialsToBeStored) if err != nil { - log.Errorln("Unable to store your credentials in system key ring") + log.Errorln("Unable to store your credentials in system key ring. Run with flag -d to see full logs") log.Debugln(err) return } diff --git a/cli/packages/util/vault.go b/cli/packages/util/vault.go index 939bd4c62..03d03b360 100644 --- a/cli/packages/util/vault.go +++ b/cli/packages/util/vault.go @@ -15,8 +15,6 @@ func GetCurrentVaultBackend() (keyring.BackendType, error) { } if configFile.VaultBackendType == "" { - if keyring.AvailableBackends()[0] == keyring.FileBackend { - } return keyring.AvailableBackends()[0], nil } From 8c10ae78f5745084c7f9a1c1ff7f52bd4a8ea6aa Mon Sep 17 00:00:00 2001 From: Maidul Islam Date: Sun, 25 Dec 2022 14:59:59 -0500 Subject: [PATCH 11/15] update cli version --- cli/packages/cmd/root.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/packages/cmd/root.go b/cli/packages/cmd/root.go index 7cd9806fc..0e905e34e 100644 --- a/cli/packages/cmd/root.go +++ b/cli/packages/cmd/root.go @@ -15,7 +15,7 @@ var rootCmd = &cobra.Command{ Short: "Infisical CLI is used to inject environment variables into any process", Long: `Infisical is a simple, end-to-end encrypted service that enables teams to sync and manage their environment variables across their development life cycle.`, CompletionOptions: cobra.CompletionOptions{DisableDefaultCmd: true}, - Version: "0.1.12", + Version: "0.1.13", } // Execute adds all child commands to the root command and sets flags appropriately. From 78d4fb2300bbc06717af0635f0120432f24c1d81 Mon Sep 17 00:00:00 2001 From: Maidul Islam Date: Sun, 25 Dec 2022 16:02:14 -0500 Subject: [PATCH 12/15] create config dir if it doesn't exist --- cli/packages/cmd/vault.go | 2 +- cli/packages/util/common.go | 1 + cli/packages/util/config.go | 16 ++++++++++++++-- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/cli/packages/cmd/vault.go b/cli/packages/cmd/vault.go index 8bb677682..a2b03dbec 100644 --- a/cli/packages/cmd/vault.go +++ b/cli/packages/cmd/vault.go @@ -42,7 +42,7 @@ var vaultSetCmd = &cobra.Command{ err = util.WriteConfigFile(&configFile) if err != nil { - log.Errorf("Unable to set vault to [%s] because an error occurred when saving the config file [err=%s]") + log.Errorf("Unable to set vault to [%s] because an error occurred when saving the config file [err=%s]", wantedVaultTypeName, err) return } diff --git a/cli/packages/util/common.go b/cli/packages/util/common.go index 37c881994..f3ee274b3 100644 --- a/cli/packages/util/common.go +++ b/cli/packages/util/common.go @@ -19,6 +19,7 @@ func GetHomeDir() (string, error) { return directory, err } +// write file to given path. If path does not exist throw error func WriteToFile(fileName string, dataToWrite []byte, filePerm os.FileMode) error { err := os.WriteFile(fileName, dataToWrite, filePerm) if err != nil { diff --git a/cli/packages/util/config.go b/cli/packages/util/config.go index 02e37c0a1..48bb57241 100644 --- a/cli/packages/util/config.go +++ b/cli/packages/util/config.go @@ -187,7 +187,7 @@ func GetConfigFile() (models.ConfigFile, error) { // Write a ConfigFile to disk. Raise error if unable to save the model to ask func WriteConfigFile(configFile *models.ConfigFile) error { - fullConfigFilePath, _, err := GetFullConfigFilePath() + fullConfigFilePath, fullConfigFileDirPath, err := GetFullConfigFilePath() if err != nil { return fmt.Errorf("writeConfigFile: unable to write config file because an error occurred when getting config file path [err=%s]", err) } @@ -197,8 +197,20 @@ func WriteConfigFile(configFile *models.ConfigFile) error { return fmt.Errorf("writeConfigFile: unable to write config file because an error occurred when marshalling the config file [err=%s]", err) } + // check if config folder exists and if not create it + if _, err := os.Stat(fullConfigFileDirPath); errors.Is(err, os.ErrNotExist) { + err := os.Mkdir(fullConfigFileDirPath, os.ModePerm) + if err != nil { + return err + } + } + // Create file in directory - err = WriteToFile(fullConfigFilePath, configFileMarshalled, os.ModePerm) + err = os.WriteFile(fullConfigFilePath, configFileMarshalled, os.ModePerm) + if err != nil { + return fmt.Errorf("writeConfigFile: Unable to write to file [err=%s]", err) + } + if err != nil { return fmt.Errorf("writeConfigFile: unable to write config file because an error occurred when write the config to file [err=%s]", err) From ee0a95c1db43af21d30051b8f9365898a110b0f4 Mon Sep 17 00:00:00 2001 From: Maidul Islam Date: Sun, 25 Dec 2022 16:10:33 -0500 Subject: [PATCH 13/15] add faq link when key ring error --- cli/packages/cmd/login.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cli/packages/cmd/login.go b/cli/packages/cmd/login.go index de9e60bf8..9c0c22930 100644 --- a/cli/packages/cmd/login.go +++ b/cli/packages/cmd/login.go @@ -91,7 +91,9 @@ var loginCmd = &cobra.Command{ err = util.StoreUserCredsInKeyRing(userCredentialsToBeStored) if err != nil { - log.Errorln("Unable to store your credentials in system key ring. Run with flag -d to see full logs") + currentVault, _ := util.GetCurrentVaultBackend() + log.Errorf("Unable to store your credentials in system vault [%s]. Rerun with flag -d to see full logs", currentVault) + log.Errorln("To trouble shoot further, read https://infisical.com/docs/cli/faq") log.Debugln(err) return } From 28335ceabdba22b0e680a1fdd19fcf2e80a6703e Mon Sep 17 00:00:00 2001 From: Maidul Islam Date: Sun, 25 Dec 2022 16:11:10 -0500 Subject: [PATCH 14/15] update version --- cli/packages/cmd/root.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/packages/cmd/root.go b/cli/packages/cmd/root.go index 0e905e34e..6a0bdb80c 100644 --- a/cli/packages/cmd/root.go +++ b/cli/packages/cmd/root.go @@ -15,7 +15,7 @@ var rootCmd = &cobra.Command{ Short: "Infisical CLI is used to inject environment variables into any process", Long: `Infisical is a simple, end-to-end encrypted service that enables teams to sync and manage their environment variables across their development life cycle.`, CompletionOptions: cobra.CompletionOptions{DisableDefaultCmd: true}, - Version: "0.1.13", + Version: "0.1.14", } // Execute adds all child commands to the root command and sets flags appropriately. From f020b553b38464456545b4eefb60173ffa810201 Mon Sep 17 00:00:00 2001 From: Vladyslav Matsiiako Date: Sun, 25 Dec 2022 17:28:55 -0500 Subject: [PATCH 15/15] Solving merge conflicts --- frontend/pages/signup.tsx | 313 +++++++++++++++++++------------------- 1 file changed, 157 insertions(+), 156 deletions(-) diff --git a/frontend/pages/signup.tsx b/frontend/pages/signup.tsx index 94314c151..51e2e1c05 100644 --- a/frontend/pages/signup.tsx +++ b/frontend/pages/signup.tsx @@ -354,176 +354,177 @@ export default function SignUp() { Make sure to check your spam inbox.

+ ); // Step 3 of the signup process (enter the rest of the impformation) const step3 = ( -
-

- Almost there! -

-
- -
-
- -
-
- { - setPassword(password); - passwordCheck({ - password, - setPasswordErrorLength, - setPasswordErrorNumber, - setPasswordErrorLowerCase, - currentErrorCheck: false, - }); - }} - type="password" - value={password} - isRequired - error={ - passwordErrorLength && passwordErrorNumber && passwordErrorLowerCase - } - autoComplete="new-password" - id="new-password" - /> - {passwordErrorLength || - passwordErrorLowerCase || - passwordErrorNumber ? ( -
-
- Password should contain at least: -
-
- {passwordErrorLength ? ( - - ) : ( - - )} -
- 14 characters -
-
-
- {passwordErrorLowerCase ? ( - - ) : ( - - )} -
- 1 lowercase character -
-
-
- {passwordErrorNumber ? ( - - ) : ( - - )} -
- 1 number -
+
+

+ Almost there! +

+
+ +
+
+ +
+
+ { + setPassword(password); + passwordCheck({ + password, + setPasswordErrorLength, + setPasswordErrorNumber, + setPasswordErrorLowerCase, + currentErrorCheck: false, + }); + }} + type="password" + value={password} + isRequired + error={ + passwordErrorLength && passwordErrorNumber && passwordErrorLowerCase + } + autoComplete="new-password" + id="new-password" + /> + {passwordErrorLength || + passwordErrorLowerCase || + passwordErrorNumber ? ( +
+
+ Password should contain at least: +
+
+ {passwordErrorLength ? ( + + ) : ( + + )} +
+ 14 characters
- ) : ( -
- )} -
-
-
+
+ {passwordErrorLowerCase ? ( + + ) : ( + + )} +
+ 1 lowercase character +
+
+
+ {passwordErrorNumber ? ( + + ) : ( + + )} +
+ 1 number +
+
+
+ ) : ( +
+ )}
+
+
+
); // Step 4 of the sign up process (download the emergency kit pdf) const step4 = ( -
-

- Save your Emergency Kit -

-
-
- If you get locked out of your account, your Emergency Kit is the only - way to sign in. -
-
- We recommend you download it and keep it somewhere safe. -
+
+

+ Save your Emergency Kit +

+
+
+ If you get locked out of your account, your Emergency Kit is the only + way to sign in.
-
- - It contains your Secret Key which we cannot access or recover for you if - you lose it. -
- className="text-l mt-4 text-lg text-gray-400 hover:text-gray-300 duration-200 bg-white/5 px-8 hover:bg-white/10 py-3 rounded-md cursor-pointer" - onClick={() => { - if (localStorage.getItem("projectData.id")) { - router.push("/dashboard/" + localStorage.getItem("projectData.id")); - } else { - router.push("/noprojects") - } - }} - > - Later -
*/} +
+ We recommend you download it and keep it somewhere safe.
+
+ + It contains your Secret Key which we cannot access or recover for you if + you lose it. +
+
{ + if (localStorage.getItem("projectData.id")) { + router.push("/dashboard/" + localStorage.getItem("projectData.id")); + } else { + router.push("/noprojects") + } + }} + > + Later +
+
); return (