Skip to content

Commit 94f9656

Browse files
committed
Python: Solve deprecation warnings for old experimental queries
1 parent 2e788ea commit 94f9656

25 files changed

+53
-33
lines changed

python/ql/src/experimental/Security/CWE-074/TemplateInjection.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ import semmle.python.security.strings.Untrusted
2121
class TemplateInjectionConfiguration extends TaintTracking::Configuration {
2222
TemplateInjectionConfiguration() { this = "Template injection configuration" }
2323

24-
override predicate isSource(TaintTracking::Source source) {
24+
deprecated override predicate isSource(TaintTracking::Source source) {
2525
source instanceof HttpRequestTaintSource
2626
}
2727

28-
override predicate isSink(TaintTracking::Sink sink) { sink instanceof SSTISink }
28+
deprecated override predicate isSink(TaintTracking::Sink sink) { sink instanceof SSTISink }
2929
}
3030

3131
from TemplateInjectionConfiguration config, TaintedPathSource src, TaintedPathSink sink

python/ql/src/experimental/Security/CWE-091/Xslt.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ import experimental.semmle.python.security.injection.XSLT
2020
class XSLTInjectionConfiguration extends TaintTracking::Configuration {
2121
XSLTInjectionConfiguration() { this = "XSLT injection configuration" }
2222

23-
override predicate isSource(TaintTracking::Source source) {
23+
deprecated override predicate isSource(TaintTracking::Source source) {
2424
source instanceof HttpRequestTaintSource
2525
}
2626

27-
override predicate isSink(TaintTracking::Sink sink) {
27+
deprecated override predicate isSink(TaintTracking::Sink sink) {
2828
sink instanceof XSLTInjection::XSLTInjectionSink
2929
}
3030
}

python/ql/src/experimental/semmle/python/security/injection/XSLT.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ module XSLTInjection {
2121
/**
2222
* A kind of "taint", representing an untrusted XML string
2323
*/
24-
private class ExternalXmlStringKind extends ExternalStringKind {
24+
deprecated private class ExternalXmlStringKind extends ExternalStringKind {
2525
ExternalXmlStringKind() { this = "etree.XML string" }
2626

2727
override TaintKind getTaintForFlowStep(ControlFlowNode fromnode, ControlFlowNode tonode) {

python/ql/src/experimental/semmle/python/templates/Airspeed.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ import semmle.python.web.HttpRequest
55
import experimental.semmle.python.templates.SSTISink
66

77
/** returns the ClassValue representing `airspeed.Template` */
8-
ClassValue theAirspeedTemplateClass() { result = Value::named("airspeed.Template") }
8+
deprecated ClassValue theAirspeedTemplateClass() { result = Value::named("airspeed.Template") }
99

1010
/**
1111
* Sink representing the `airspeed.Template` class instantiation argument.
1212
*
1313
* import airspeed
1414
* temp = airspeed.Template(`"sink"`)
1515
*/
16-
class AirspeedTemplateSink extends SSTISink {
16+
deprecated class AirspeedTemplateSink extends SSTISink {
1717
override string toString() { result = "argument to airspeed.Template()" }
1818

1919
AirspeedTemplateSink() {

python/ql/src/experimental/semmle/python/templates/Bottle.qll

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,17 @@ import semmle.python.web.HttpRequest
55
import experimental.semmle.python.templates.SSTISink
66

77
/** returns the ClassValue representing `bottle.SimpleTemplate` */
8-
ClassValue theBottleSimpleTemplateClass() { result = Value::named("bottle.SimpleTemplate") }
8+
deprecated ClassValue theBottleSimpleTemplateClass() {
9+
result = Value::named("bottle.SimpleTemplate")
10+
}
911

1012
/**
1113
* Sink representing the `bottle.SimpleTemplate` class instantiation argument.
1214
*
1315
* from bottle import SimpleTemplate
1416
* template = SimpleTemplate(`sink`)
1517
*/
16-
class BottleSimpleTemplateSink extends SSTISink {
18+
deprecated class BottleSimpleTemplateSink extends SSTISink {
1719
override string toString() { result = "argument to bottle.SimpleTemplate()" }
1820

1921
BottleSimpleTemplateSink() {
@@ -32,7 +34,7 @@ class BottleSimpleTemplateSink extends SSTISink {
3234
* from bottle import template
3335
* tmp = template(`sink`)
3436
*/
35-
class BottleTemplateSink extends SSTISink {
37+
deprecated class BottleTemplateSink extends SSTISink {
3638
override string toString() { result = "argument to bottle.template()" }
3739

3840
BottleTemplateSink() {

python/ql/src/experimental/semmle/python/templates/Chameleon.qll

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,17 @@ import semmle.python.web.HttpRequest
55
import experimental.semmle.python.templates.SSTISink
66

77
/** returns the ClassValue representing `chameleon.PageTemplate` */
8-
ClassValue theChameleonPageTemplateClass() { result = Value::named("chameleon.PageTemplate") }
8+
deprecated ClassValue theChameleonPageTemplateClass() {
9+
result = Value::named("chameleon.PageTemplate")
10+
}
911

1012
/**
1113
* Sink representing the `chameleon.PageTemplate` class instantiation argument.
1214
*
1315
* from chameleon import PageTemplate
1416
* template = PageTemplate(`sink`)
1517
*/
16-
class ChameleonTemplateSink extends SSTISink {
18+
deprecated class ChameleonTemplateSink extends SSTISink {
1719
override string toString() { result = "argument to Chameleon.PageTemplate()" }
1820

1921
ChameleonTemplateSink() {

python/ql/src/experimental/semmle/python/templates/Cheetah.qll

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ import semmle.python.web.HttpRequest
55
import experimental.semmle.python.templates.SSTISink
66

77
/** returns the ClassValue representing `Cheetah.Template.Template` */
8-
ClassValue theCheetahTemplateClass() { result = Value::named("Cheetah.Template.Template") }
8+
deprecated ClassValue theCheetahTemplateClass() {
9+
result = Value::named("Cheetah.Template.Template")
10+
}
911

1012
/**
1113
* Sink representing the instantiation argument of any class which derives from
@@ -22,7 +24,7 @@ ClassValue theCheetahTemplateClass() { result = Value::named("Cheetah.Template.T
2224
* from Cheetah.Template import Template
2325
* t3 = Template("sink")
2426
*/
25-
class CheetahTemplateInstantiationSink extends SSTISink {
27+
deprecated class CheetahTemplateInstantiationSink extends SSTISink {
2628
override string toString() { result = "argument to Cheetah.Template.Template()" }
2729

2830
CheetahTemplateInstantiationSink() {

python/ql/src/experimental/semmle/python/templates/Chevron.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ import semmle.python.web.HttpRequest
55
import experimental.semmle.python.templates.SSTISink
66

77
/** returns the Value representing `chevron.render` function */
8-
Value theChevronRenderFunc() { result = Value::named("chevron.render") }
8+
deprecated Value theChevronRenderFunc() { result = Value::named("chevron.render") }
99

1010
/**
1111
* Sink representing the `chevron.render` function call argument.
1212
*
1313
* import chevron
1414
* tmp = chevron.render(`sink`,{ 'key' : 'value' })
1515
*/
16-
class ChevronRenderSink extends SSTISink {
16+
deprecated class ChevronRenderSink extends SSTISink {
1717
override string toString() { result = "argument to chevron.render()" }
1818

1919
ChevronRenderSink() {

python/ql/src/experimental/semmle/python/templates/DjangoTemplate.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ import python
44
import semmle.python.web.HttpRequest
55
import experimental.semmle.python.templates.SSTISink
66

7-
ClassValue theDjangoTemplateClass() { result = Value::named("django.template.Template") }
7+
deprecated ClassValue theDjangoTemplateClass() { result = Value::named("django.template.Template") }
88

99
/**
1010
* Sink representng `django.template.Template` class instantiation argument.
1111
*
1212
* from django.template import Template
1313
* template = Template(`sink`)
1414
*/
15-
class DjangoTemplateTemplateSink extends SSTISink {
15+
deprecated class DjangoTemplateTemplateSink extends SSTISink {
1616
override string toString() { result = "argument to Django.template()" }
1717

1818
DjangoTemplateTemplateSink() {

python/ql/src/experimental/semmle/python/templates/FlaskTemplate.qll

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,17 @@ import python
44
import semmle.python.web.HttpRequest
55
import experimental.semmle.python.templates.SSTISink
66

7-
Value theFlaskRenderTemplateClass() { result = Value::named("flask.render_template_string") }
7+
deprecated Value theFlaskRenderTemplateClass() {
8+
result = Value::named("flask.render_template_string")
9+
}
810

911
/**
1012
* Sink representng `flask.render_template_string` function call argument.
1113
*
1214
* from flask import render_template_string
1315
* render_template_string(`sink`)
1416
*/
15-
class FlaskTemplateSink extends SSTISink {
17+
deprecated class FlaskTemplateSink extends SSTISink {
1618
override string toString() { result = "argument to flask.render_template_string()" }
1719

1820
FlaskTemplateSink() {

0 commit comments

Comments
 (0)