File tree Expand file tree Collapse file tree 4 files changed +24
-8
lines changed
semmle/python/security/dataflow Expand file tree Collapse file tree 4 files changed +24
-8
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ category : minorAnalysis
3+ ---
4+ * Added propmpt injection query
5+ * Added taint flow model and type model for ` agents ` and ` openai ` modules.
Original file line number Diff line number Diff line change 1+ /**
2+ * Provides default sources, sinks and sanitizers for detecting
3+ * "prompt injection"
4+ * vulnerabilities, as well as extension points for adding your own.
5+ */
6+
17import python
28private import semmle.python.dataflow.new.DataFlow
39private import semmle.python.Concepts
410private import semmle.python.dataflow.new.RemoteFlowSources
511private import semmle.python.dataflow.new.BarrierGuards
612private import semmle.python.frameworks.OpenAI
713
8- /**
9- * Provides default sources, sinks and sanitizers for detecting
10- * "prompt injection"
11- * vulnerabilities, as well as extension points for adding your own.
12- */
1314module PromptInjection {
1415 /**
1516 * A data flow source for "prompt injection" vulnerabilities.
@@ -31,6 +32,9 @@ module PromptInjection {
3132 */
3233 private class ActiveThreatModelSourceAsSource extends Source , ActiveThreatModelSource { }
3334
35+ /**
36+ * Agent prompt sinks, considered as a flow sink.
37+ */
3438 class SystemPromptSink extends Sink {
3539 SystemPromptSink ( ) { this = Agent:: sink ( ) .asSink ( ) or this = OpenAI:: sink ( ) .asSink ( ) }
3640 }
Original file line number Diff line number Diff line change 1+ /**
2+ * Provides taint-tracking configurations for detecting "prompt injection" vulnerabilities.
3+ *
4+ * Note, for performance reasons: only import this file if
5+ * `PromptInjection::Configuration` is needed, otherwise
6+ * `PromptInjectionCustomizations` should be imported instead.
7+ */
8+
19private import python
210import semmle.python.dataflow.new.DataFlow
311import semmle.python.dataflow.new.TaintTracking
Original file line number Diff line number Diff line change 55
66<overview >
77<p >Prompts can be constructed to bypass the original purposes of an agent and lead to sensitive data leak or
8- operations that were not intended.
9- </p >
8+ operations that were not intended.</p >
109</overview >
1110
1211<recommendation >
13- Sanitize user input and also avoid using user input in developer or system level prompts.
12+ < p > Sanitize user input and also avoid using user input in developer or system level prompts.</ p >
1413</recommendation >
1514
1615<example >
You can’t perform that action at this time.
0 commit comments