0.0.6 • Published 7 months ago

create-secure-chatgpt-app v0.0.6

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

secure-chatgpt

The goal of this boilerplate is to show how developers can use Pangea's various services to secure their own ChatGPT implementation.

We are using the following Pangea services:

  • Auth Service: To add authentication to a NextJS App and prevent unauthenticated users from using ChatGPT
  • Redact Service: To redact sensitive information from the user's prompt before the entry reaches to OpenAI API
  • Audit Service: To audit the user prompts
  • Reputation/Threat Intel services: To detect and neutralize the malicious URLs and domain names in the OPENAI API's responses.

For more in depth information please go to our blog about protecting PII from ChatGPT models

If you would like to see a demo of this application, go to this youtube video

Setup

Pre Reqs Check

In order to run this application you are going to need:

  • Node
  • OpenAI
  • Pangea Account

OpenAI API Key

  1. Create an account to sign in to OpenAI
  2. Once signed in, this link will begin the flow to create an API Token.
  3. Name your token.
  4. Copy the API Key and save it somewhere. We will not be able to access it again.

Enable Pangea Services

  1. Create and sign into your Pangea account

  2. Once you land on the Pangea User Console, You can see AuthN, Secure Audit Log, Redact, IP Intel, and Domain Intel on the left. Note that the Domain is shown on the right and will be needed when we run the application.

  3. Select AuthN to enable and begin the token creation process. While creating the token, you can enable it for all the services we are going to require for this application: AuthN, Redact, IP Intel, URL Intel, Secure Audit Log, and Domain Intel.

  1. Landing on the AuthN Service Overview page you'll see all the token information you will need from Pangea to run the application. Copy these values into a note pad or keep this page open.
  1. Go to the Redirects tab and add http://localhost:3000 to the redirect list.

NOTE: By going to Customize > View project branding, you'll be able to customize your login page

  1. Go to back to the Main Menu and then navigate to Redact > Rulesets. This is where you will be able to configure what gets redacted and how. For the demo, it's recommended that we enable redaction for:
    • PII: email address and phone number
    • US Identification Numbers: US Social Security Number

Setup App & Run

During the generator script, you will need the following information ready:

  • OpenAI API Key: If you haven't done so, please head over to the OpenAI site and register a user and get an API Key for using OpenAI services https://platform.openai.com/account/api-keys
  • Pangea Service Token: Go to Pangea Console and create a service token that has access to AuthN, Redact, URL Intel, File Intel, and Audit services https://console.pangea.cloud/
  • Pangea Domain: This is visible in the project settings on the Pangea Console
  • Pangea AuthN Client Token and URL: Located in the AuthN settings of your project on the Pangea Console, and copy the Authn Client Token, Hosted Login URL.

Now that you have the necessary information to go through the setup

  1. Run the following command, and enter the required information when you are prompted.
    npx create-secure-chatgpt-app@latest
  1. Input the appropriate token values

  2. Now you can cd into the newly generated app directory and run

    npm run dev
  1. If everything went well, you should be able to open a browser and navigate to
http://localhost:3000
0.0.5

8 months ago

0.0.4

8 months ago

0.0.6

7 months ago

0.0.3

11 months ago

0.0.2

11 months ago

0.0.1

11 months ago