TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Unsafe OpenAI example code includes eval() of untrusted text generated by GPT-4o

2 pointsby upwardbound12 months ago

1 comment

upwardbound12 months ago
Never eval() AI-generated text without a sandbox. This should one of the most obvious principles of AGI safety, especially to a company working towards building superintelligence.<p>Yet, inexplicably, the OpenAI tutorial linked above includes this un-sandboxed command, with no explanation for this egregious lack of any safety precautions: `tool_query_string = eval(tool_calls[0].function.arguments)[&#x27;query&#x27;]`<p>Though the content of function.arguments is usually reasonable in typical scenarios, it is unvalidated, arbitrary text. There are multiple documented instances of it containing text that causes parsing errors:<p><a href="https:&#x2F;&#x2F;community.openai.com&#x2F;t&#x2F;malformed-function-calling-arguments&#x2F;272803" rel="nofollow">https:&#x2F;&#x2F;community.openai.com&#x2F;t&#x2F;malformed-function-calling-ar...</a><p><a href="https:&#x2F;&#x2F;community.openai.com&#x2F;t&#x2F;malformed-json-in-gpt4-1106-function-arguments&#x2F;685884" rel="nofollow">https:&#x2F;&#x2F;community.openai.com&#x2F;t&#x2F;malformed-json-in-gpt4-1106-f...</a><p><a href="https:&#x2F;&#x2F;community.openai.com&#x2F;t&#x2F;ai-assistant-malformed-function-arguments-if-parameters-property-in-function-schema&#x2F;772865" rel="nofollow">https:&#x2F;&#x2F;community.openai.com&#x2F;t&#x2F;ai-assistant-malformed-functi...</a><p>Anyone running the code in the OpenAI cookbook, containing eval(), could have their machine compromised by a model that gets hijacked via prompt injection or whose behavior goes astray for other reasons.<p>The fact that OpenAI recommends this code to developers speaks to a serious lack of care about AGI safety.