Skip to content

Added warning when public key is used #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open

Conversation

Mahrukhizhar
Copy link

No description provided.

src/index.js Outdated
@@ -320,6 +320,13 @@ export function initialize(clientSdkKey, flagKeys, user, specifiedOptions, platf
console.warn("[UL] Disabling local storage in production is not recommended. Please enable it. For more information see: https://docs.unlaunch.io/docs/sdks/javascript-library#client-configuration")
}

const isPublicSdkKey = clientSdkKey.split('-')[1] == 'public' ? true : false
if(!isPublicSdkKey){
console.warn("To obtain the API key, please sign in to the Unlaunch Console at https://app.unlaunch.io"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're using NOT using public key to connect to Unlaunch. If your application is client-side, not using public key can compromise security. To obtain the public API key, please sign in ...

@@ -320,6 +320,12 @@ export function initialize(clientSdkKey, flagKeys, user, specifiedOptions, platf
console.warn("[UL] Disabling local storage in production is not recommended. Please enable it. For more information see: https://docs.unlaunch.io/docs/sdks/javascript-library#client-configuration")
}

if(clientSdkKey.split('-')[1] !== 'public'){
console.warn("You're using NOT using public key to connect to Unlaunch. If your application is client-side, not using public key can compromise security. To obtain the public SDK key, please sign in the Unlaunch Console at https://app.unlaunch.io"
Copy link
Contributor

@umermansoor umermansoor Nov 2, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We detected that you're not using the public SDK key to connect to Unlaunch from a browser SDK. For security reasons, we highly recommend using the public SDK key to access Unlaunch from JavaScript or other public SDKs. To obtain the public SDK key, please sign in the Unlaunch Console at https://app.unlaunch.io"
+". Then on the right sidebar, click on 'Settings'. Then from the 'Projects' tab. Copy the 'Browser / Public Key' for the "
+"environment you want to connect to, and provide it to this SDK. For more information, visit: https://docs.unlaunch.io/docs/sdks/sdk-keys"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants