Skip to content

Commit 47d0a6d

Browse files
committed
Python: Restore rest of experimental files
1 parent 8663a8b commit 47d0a6d

33 files changed

+266
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
from django.urls import path
2+
from django.http import HttpResponse
3+
from jinja2 import Template as Jinja2_Template
4+
from jinja2 import Environment, DictLoader, escape
5+
6+
7+
def a(request):
8+
# Load the template
9+
template = request.GET['template']
10+
t = Jinja2_Template(template)
11+
name = request.GET['name']
12+
# Render the template with the context data
13+
html = t.render(name=escape(name))
14+
return HttpResponse(html)
15+
16+
17+
urlpatterns = [
18+
path('a', a),
19+
]
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
from django.urls import path
2+
from django.http import HttpResponse
3+
from jinja2 import Template as Jinja2_Template
4+
from jinja2 import Environment, DictLoader, escape
5+
6+
7+
def a(request):
8+
# Load the template
9+
template = request.GET['template']
10+
env = SandboxedEnvironment(undefined=StrictUndefined)
11+
t = env.from_string(template)
12+
name = request.GET['name']
13+
# Render the template with the context data
14+
html = t.render(name=escape(name))
15+
return HttpResponse(html)
16+
17+
18+
urlpatterns = [
19+
path('a', a),
20+
]
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from bottle import Bottle, route, request, redirect, response
2+
import airspeed
3+
4+
5+
app = Bottle()
6+
7+
8+
@route('/other')
9+
def a():
10+
return airspeed.Template("sink")
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
WARNING: Type SSTISink has been deprecated and may be removed in future (AirspeedSSTISinks.ql:4,6-14)
2+
| Airspeed.py:10:30:10:35 | argument to airspeed.Template() |
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import python
2+
import experimental.semmle.python.templates.Airspeed
3+
4+
from SSTISink s
5+
select s
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
from bottle import Bottle, route, request, redirect, response, SimpleTemplate
2+
from bottle import template as temp
3+
4+
5+
app = Bottle()
6+
7+
8+
@route('/other')
9+
def a():
10+
template = "test"
11+
tpl = SimpleTemplate(template)
12+
13+
14+
@route('/other2')
15+
def b():
16+
template = "test"
17+
return temp(template, name='World')
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
WARNING: Type SSTISink has been deprecated and may be removed in future (BottleSSTISinks.ql:4,6-14)
2+
| Bottle.py:11:26:11:33 | argument to bottle.SimpleTemplate() |
3+
| Bottle.py:17:17:17:24 | argument to bottle.template() |
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import python
2+
import experimental.semmle.python.templates.Bottle
3+
4+
from SSTISink s
5+
select s
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from chameleon import PageTemplate
2+
3+
4+
def chameleon():
5+
template = PageTemplate("sink")
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
WARNING: Type SSTISink has been deprecated and may be removed in future (ChameleonSSTISinks.ql:4,6-14)
2+
| Chameleon.py:5:29:5:34 | argument to Chameleon.PageTemplate() |

0 commit comments

Comments
 (0)