Skip to content

Commit

Permalink
Merge pull request #36 from arpitjain099/alert-autofix-18
Browse files Browse the repository at this point in the history
Fix code scanning alert no. 18: Full server-side request forgery
  • Loading branch information
arpitjain099 authored Oct 20, 2024
2 parents 98b4f8e + ddc261a commit 1dac837
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@
import tiktoken

def make_prompt_request(prompt, max_tokens = 2048, timeout = 4):
#url = "https://api.openai.com/v1/embeddings"
# Whitelist of allowed URLs
allowed_urls = ["https://api.openai.com/v1/embeddings", "https://another-trusted-url.com"]
url = os.getenv("AOAI_ENDPOINT")
if url not in allowed_urls:
raise ValueError("The provided URL is not allowed.")
key = os.getenv("AOAI_KEY")

payload_dict = {"prompt": prompt,
Expand Down

0 comments on commit 1dac837

Please sign in to comment.