Skip to content

Commit 691aeb0

Browse files
committed
Remove the chat completion create logic.
1 parent a05e191 commit 691aeb0

2 files changed

Lines changed: 0 additions & 33 deletions

File tree

python/ql/src/experimental/semmle/python/frameworks/OpenAI.qll

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
private import python
99
private import semmle.python.ApiGraphs
10-
private import semmle.python.dataflow.new.DataFlow
1110

1211
/**
1312
* Provides models for agents SDK (instances of the `agents.Runner` class etc).
@@ -87,32 +86,3 @@ module OpenAI {
8786
)
8887
}
8988
}
90-
91-
/**
92-
* Provides attribute-name-based sink detection for `chat.completions.create` calls.
93-
* This does not rely on API graph type resolution and thus works even when
94-
* the receiver cannot be traced back to a known constructor (e.g. due to `or` expressions).
95-
*/
96-
module ChatCompletionsCreate {
97-
/**
98-
* Gets a `DataFlow::Node` that is the `content` value inside a message dict
99-
* passed to a `*.chat.completions.create(messages=[{..., "content": <HERE>}])` call,
100-
* matched purely by attribute names in the call chain.
101-
*/
102-
DataFlow::Node getAMessageContentSink() {
103-
exists(
104-
DataFlow::MethodCallNode createCall, DataFlow::AttrRead completionsAttr,
105-
DataFlow::AttrRead chatAttr
106-
|
107-
// Match *.chat.completions.create(...)
108-
createCall.getMethodName() = "create" and
109-
completionsAttr = createCall.getObject().getALocalSource() and
110-
completionsAttr.getAttributeName() = "completions" and
111-
chatAttr = completionsAttr.getObject().getALocalSource() and
112-
chatAttr.getAttributeName() = "chat"
113-
|
114-
// The messages keyword argument value (the list itself, or individual dict content values)
115-
result = createCall.getArgByName("messages")
116-
)
117-
}
118-
}

python/ql/src/experimental/semmle/python/security/dataflow/PromptInjectionCustomizations.qll

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import python
88
private import semmle.python.dataflow.new.DataFlow
99
private import semmle.python.Concepts
1010
private import experimental.semmle.python.Concepts
11-
private import semmle.python.Frameworks
1211
private import semmle.python.dataflow.new.RemoteFlowSources
1312
private import semmle.python.dataflow.new.BarrierGuards
1413
private import semmle.python.frameworks.data.ModelsAsData
@@ -56,8 +55,6 @@ module PromptInjection {
5655
this = OpenAI::getContentNode().asSink()
5756
or
5857
this = AgentSDK::getContentNode().asSink()
59-
or
60-
this = ChatCompletionsCreate::getAMessageContentSink()
6158
}
6259
}
6360

0 commit comments

Comments
 (0)