Skip to content
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

App sends user's OpenAPI key to Anse? #55

Closed
1 task
LoopControl opened this issue Jun 2, 2023 · 7 comments
Closed
1 task

App sends user's OpenAPI key to Anse? #55

LoopControl opened this issue Jun 2, 2023 · 7 comments
Labels
bug Something isn't working use issue when using `anse.app`

Comments

@LoopControl
Copy link

What operating system are you using?

Doesn't matter

What browser are you using?

Doesn't matter

Describe the bug

When using https://anse.app/ and using my own OpenAPI key, I'm noticing that your app is making a request to https://anse.app/api/handle/provider-openai and it contains my API key in the body of the summarize request.

I can understand doing that when the "Use Backend" option is on but when it's off, you really should not be sending my API key anywhere.

What provider are you using?

OpenAI

What prompt did you enter?

No response

Console Logs

No response

Participation

  • I am willing to submit a pull request for this issue.
@LoopControl LoopControl added the use issue when using `anse.app` label Jun 2, 2023
@ddiu8081
Copy link
Member

ddiu8081 commented Jun 3, 2023

Hi, thanks for the find!

Our logic is that the default is to request OpenAI directly; when "Use Backend" option is checked, the requests are forwarded through our backend api (but they are safe, reference api/handle/[provider].ts and callProviderHandler)

export const callProviderHandler = async(providerId: string, payload: HandlerPayload, signal?: AbortSignal) => {
console.log('callProviderHandler', payload)
const provider = getProviderById(providerId)
if (!provider) return
let response: PromptResponse
if (payload.botId === 'temp')
response = await provider.handleRapidPrompt?.(payload.prompt!, payload.globalSettings)
else
response = await provider.handlePrompt?.(payload, signal)
return response
}

However, we have a bug where the option may be turned on but shown as unchecked (because of a bug in getting local setting items). You can try to re-check and un-check it to ensure directly request.

@ddiu8081 ddiu8081 added the bug Something isn't working label Jun 3, 2023
@LoopControl
Copy link
Author

LoopControl commented Jun 3, 2023

Here's a screenshot I took of the network when this is happening. As you can see, all the actual inference//completions requests are going to my localhost (http://127.0.0.1) -- so it's clearly not using the "Backend option".

However even then you can see that the requests to summarize (/provider-openai) are going to anse.app domain (and returning 500s too). These are the ones that are sending the OpenAI key as well as the full prompt to anse.app hostname.

Screenshot from 2023-06-02 19-52-44

@ddiu8081
Copy link
Member

ddiu8081 commented Jun 3, 2023

so it's clearly not using the "Backend option".

Can you help me to check the IndexedDB storage of the browser? The settings items are stored under settings-keyval database, then check the value of requestWithBackend option. I need to confirm if this is caused by the bug I mentioned above.

ScreenShot 2023-06-03 at 11 16 44@2x

@LoopControl
Copy link
Author

Sure, here's a screenshot I just took of the indexDB settings (requestWithBackend is false):

Screenshot from 2023-06-03 02-11-10

@ddiu8081
Copy link
Member

ddiu8081 commented Jun 3, 2023

I got it. The request used to summarize the conversation title seems to have incorrectly ignored this setting item. I'll fix it later.

@ddiu8081
Copy link
Member

ddiu8081 commented Jun 4, 2023

fixed in 924393b, you can try it again, thanks!

@LoopControl
Copy link
Author

Works great now!

Screenshot from 2023-06-04 19-00-05

Thanks for the quick fix @ddiu8081

hisune added a commit to hisune/anse that referenced this issue Jun 5, 2023
fix: rapid request don't read settings, link anse-app#55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working use issue when using `anse.app`
Projects
None yet
Development

No branches or pull requests

2 participants