forked from microsoft/sample-app-aoai-chatGPT
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add QL Queries and update workflow
- Loading branch information
1 parent
ec0ea08
commit 3768349
Showing
4 changed files
with
65 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/** | ||
* @name AI Prompt Usage | ||
* @description AI Prompt Usage | ||
* @kind problem | ||
* @problem.severity error | ||
* @security-severity 2.0 | ||
* @sub-severity medium | ||
* @precision medium | ||
* @id githubsecuritylab/prompt-usage | ||
* @tags security | ||
*/ | ||
|
||
import python | ||
private import semmle.python.ApiGraphs | ||
private import semmle.python.Concepts | ||
private import semmle.python.dataflow.new.DataFlow | ||
|
||
class AzureOpenAIClient extends DataFlow::Node { | ||
AzureOpenAIClient() { | ||
this = | ||
API::moduleImport("openai") | ||
.getMember(["BaseAzureClient", "AzureOpenAI", "AsyncAzureOpenAI"]) | ||
.getASubclass*() | ||
.getReturn() | ||
.getMember("chat") | ||
.getMember("completions") | ||
.getMember("with_raw_response") | ||
.getMember("create") | ||
.getACall() | ||
} | ||
} | ||
|
||
from AzureOpenAIClient sinks | ||
select sinks, "AI prompt used" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--- | ||
lockVersion: 1.0.0 | ||
dependencies: | ||
codeql/dataflow: | ||
version: 1.0.2 | ||
codeql/mad: | ||
version: 1.0.2 | ||
codeql/python-all: | ||
version: 1.0.2 | ||
codeql/regex: | ||
version: 1.0.2 | ||
codeql/ssa: | ||
version: 1.0.2 | ||
codeql/tutorial: | ||
version: 1.0.2 | ||
codeql/typetracking: | ||
version: 1.0.2 | ||
codeql/util: | ||
version: 1.0.2 | ||
codeql/xml: | ||
version: 1.0.2 | ||
codeql/yaml: | ||
version: 1.0.2 | ||
compiled: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
library: false | ||
name: octodemo/sample | ||
version: 0.0.1 | ||
dependencies: | ||
codeql/python-all: '*' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters