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

[BUG] Failure in createConnector should not log API keys. #2915

Closed
austintlee opened this issue Sep 7, 2024 · 4 comments
Closed

[BUG] Failure in createConnector should not log API keys. #2915

austintlee opened this issue Sep 7, 2024 · 4 comments
Assignees
Labels
bug Something isn't working Severity-Critical

Comments

@austintlee
Copy link
Collaborator

austintlee commented Sep 7, 2024

What is the bug?
It looks like the error message in the CreateConnector failure response contains the API key in the template.

How can one reproduce the bug?
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

What is the expected behavior?
A clear and concise description of what you expected to happen.

What is your host/environment?

  • OS: [e.g. iOS]
  • Version [e.g. 22]
  • Plugins

Do you have any screenshots?
If applicable, add screenshots to help explain your problem.

Do you have any additional context?
Add any other context about the problem.

@austintlee austintlee added bug Something isn't working untriaged labels Sep 7, 2024
@austintlee
Copy link
Collaborator Author

RestMLRemoteInferenceIT > testDeleteConnector FAILED org.opensearch.client.ResponseException: method [POST], host [http://127.0.0.1:55810], URI [/_plugins/_ml/connectors/_create], status line [HTTP/1.1 503 Service Unavailable] {"error":{"root_cause":[{"type":"unavailable_shards_exception","reason":"[.plugins-ml-connector][0] primary shard is not active Timeout: [1m], request: [BulkShardRequest [[.plugins-ml-connector][0]] containing [index {[.plugins-ml-connector][bnO6yZEB1QdOTLrBQkCP], source[{\"name\":\"OpenAI Connector\",\"version\":\"1\",\"description\":\"The connector to public OpenAI model service for GPT 3.5\",\"protocol\":\"http\",\"parameters\":{\"endpoint\":\"api.openai.com\",\"content_type\":\"application/json\",\"auth\":\"API_Key\",\"max_tokens\":\"7\",\"temperature\":\"0\",\"model\":\"gpt-3.5-turbo-instruct\"},\"credential\":{\"openAI_key\":\"<api key>\"},\"actions\":[{\"action_type\":\"PREDICT\",\"method\":\"POST\",\"url\":\"https://${parameters.endpoint}/v1/completions\",\"headers\":{\"Authorization\":\"Bearer ${credential.openAI_key}\"},\"request_body\":\"{ \\\"model\\\": \\\"${parameters.model}\\\", \\\"prompt\\\": \\\"${parameters.prompt}\\\", \\\"max_tokens\\\": ${parameters.max_tokens}, \\\"temperature\\\": ${parameters.temperature} }\"}],\"client_config\":{\"max_connection\":20,\"connection_timeout\":50000,\"read_timeout\":50000,\"retry_backoff_millis\":200,\"retry_timeout_seconds\":30,\"max_retry_times\":0,\"retry_backoff_policy\":\"constant\"}}]}] and a refresh]"}],"type":"unavailable_shards_exception","reason":"[.plugins-ml-connector][0] primary shard is not active Timeout: [1m], request: [BulkShardRequest [[.plugins-ml-connector][0]] containing [index {[.plugins-ml-connector][bnO6yZEB1QdOTLrBQkCP], source[{\"name\":\"OpenAI Connector\",\"version\":\"1\",\"description\":\"The connector to public OpenAI model service for GPT 3.5\",\"protocol\":\"http\",\"parameters\":{\"endpoint\":\"api.openai.com\",\"content_type\":\"application/json\",\"auth\":\"API_Key\",\"max_tokens\":\"7\",\"temperature\":\"0\",\"model\":\"gpt-3.5-turbo-instruct\"},\"credential\":{\"openAI_key\":\"<api key>\"},\"actions\":[{\"action_type\":\"PREDICT\",\"method\":\"POST\",\"url\":\"https://${parameters.endpoint}/v1/completions\",\"headers\":{\"Authorization\":\"Bearer ${credential.openAI_key}\"},\"request_body\":\"{ \\\"model\\\": \\\"${parameters.model}\\\", \\\"prompt\\\": \\\"${parameters.prompt}\\\", \\\"max_tokens\\\": ${parameters.max_tokens}, \\\"temperature\\\": ${parameters.temperature} }\"}],\"client_config\":{\"max_connection\":20,\"connection_timeout\":50000,\"read_timeout\":50000,\"retry_backoff_millis\":200,\"retry_timeout_seconds\":30,\"max_retry_times\":0,\"retry_backoff_policy\":\"constant\"}}]}] and a refresh]"},"status":503} at __randomizedtesting.SeedInfo.seed([5A4DB80AB4595406:9ADC268A24B8243E]:0) at app//org.opensearch.client.RestClient.convertResponse(RestClient.java:501) at app//org.opensearch.client.RestClient.performRequest(RestClient.java:384) at app//org.opensearch.client.RestClient.performRequest(RestClient.java:374) at app//org.opensearch.client.RestClient.performRequest(RestClient.java:359) at app//org.opensearch.ml.utils.TestHelper.makeRequest(TestHelper.java:182) at app//org.opensearch.ml.utils.TestHelper.makeRequest(TestHelper.java:155) at app//org.opensearch.ml.rest.RestMLRemoteInferenceIT.createConnector(RestMLRemoteInferenceIT.java:841) at app//org.opensearch.ml.rest.RestMLRemoteInferenceIT.testDeleteConnector(RestMLRemoteInferenceIT.java:98)

@dblock
Copy link
Member

dblock commented Sep 30, 2024

[Catch All Triage - 1, 2, 3, 4]

cc: @ylwu-amzn @varun-lodaya this looks like a problem we should fix soon

@ylwu-amzn
Copy link
Collaborator

@dhrubo-os Is working on this.

@dhrubo-os
Copy link
Collaborator

Closing the issue as the PR is merged now.

@github-project-automation github-project-automation bot moved this from In Progress to Done in ml-commons projects Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Severity-Critical
Projects
Development

No branches or pull requests

5 participants