Skip to content

Commit a947d15

Browse files
committed
Python: Django changes now backwards compatible deprecation
1 parent 4a7bfbe commit a947d15

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

python/ql/src/semmle/python/web/django/Redirect.qll

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ class DjangoShortcutsRedirectSink extends HttpRedirectTaintSink {
2121
}
2222
}
2323

24+
/** DEPRECATED: Use `DjangoShortcutsRedirectSink` instead. */
25+
deprecated class DjangoRedirect = DjangoShortcutsRedirectSink;
26+
2427
/**
2528
* The URL argument when instantiating a Django Redirect Response.
2629
*/

python/ql/src/semmle/python/web/django/Response.qll

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@ import semmle.python.security.strings.Basic
44
private import semmle.python.web.django.Shared
55
private import semmle.python.web.Http
66

7+
/**
8+
* DEPRECATED: This class is internal to the django library modeling, and should
9+
* never be used by anyone.
10+
*
11+
* A django.http.response.Response object
12+
* This isn't really a "taint", but we use the value tracking machinery to
13+
* track the flow of response objects.
14+
*/
15+
deprecated class DjangoResponse = DjangoResponseKind;
16+
717
/** INTERNAL class used for tracking a django response object. */
818
private class DjangoResponseKind extends TaintKind {
919
DjangoResponseKind() { this = "django.response.HttpResponse" }

python/ql/src/semmle/python/web/django/Shared.qll

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
import python
22

3+
/** DEPRECATED: Use `Value::named("django.shortcuts.redirect")` instead. */
4+
deprecated FunctionValue redirect() { result = Value::named("django.shortcuts.redirect") }
5+
6+
/** DEPRECATED: Use `DjangoRedirectResponseClass` instead. */
7+
deprecated ClassValue theDjangoHttpRedirectClass() {
8+
// version 1.x
9+
result = Value::named("django.http.response.HttpResponseRedirectBase")
10+
or
11+
// version 2.x
12+
result = Value::named("django.http.HttpResponseRedirectBase")
13+
}
14+
315
/** A class that is a Django Redirect Response (subclass of `django.http.HttpResponseRedirectBase`). */
416
class DjangoRedirectResponseClass extends ClassValue {
517
DjangoRedirectResponseClass() {

0 commit comments

Comments
 (0)