on master help sign in
[fix] proper escaping of the search query in templates
28f12efAdam Tauber
searx/templates/courgette/results.html+5−5
@@ -1,6 +1,6 @@
1{% extends "courgette/base.html" %}
1{% extends "courgette/base.html" %}
2−{% block title %}{{ q }} - {% endblock %}
2+{% block title %}{{ q|e }} - {% endblock %}
3−{% block meta %}<link rel="alternate" type="application/rss+xml" title="Searx search: {{ q }}" href="{{ url_for('index') }}?q={{ q|urlencode }}&amp;format=rss&amp;{% for category in selected_categories %}category_{{ category }}=1&amp;{% endfor %}pageno={{ pageno }}">{% endblock %}
3+{% block meta %}<link rel="alternate" type="application/rss+xml" title="Searx search: {{ q|e }}" href="{{ url_for('index') }}?q={{ q|urlencode }}&amp;format=rss&amp;{% for category in selected_categories %}category_{{ category }}=1&amp;{% endfor %}pageno={{ pageno }}">{% endblock %}
4{% block content %}
4{% block content %}
5<div class="right"><a href="{{ url_for('preferences') }}" id="preferences"><span>{{ _('preferences') }}</span></a></div>
5<div class="right"><a href="{{ url_for('preferences') }}" id="preferences"><span>{{ _('preferences') }}</span></a></div>
6<div class="small search center">
6<div class="small search center">
@@ -17,7 +17,7 @@
17 {% for output_type in ('csv', 'json', 'rss') %}
17 {% for output_type in ('csv', 'json', 'rss') %}
18 <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}">
18 <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}">
19 <div class="left">
19 <div class="left">
20− <input type="hidden" name="q" value="{{ q }}" />
20+ <input type="hidden" name="q" value="{{ q|e }}" />
21 <input type="hidden" name="format" value="{{ output_type }}" />
21 <input type="hidden" name="format" value="{{ output_type }}" />
22 {% for category in selected_categories %}
22 {% for category in selected_categories %}
23 <input type="hidden" name="category_{{ category }}" value="1"/>
23 <input type="hidden" name="category_{{ category }}" value="1"/>
@@ -62,7 +62,7 @@
62 {% if pageno > 1 %}
62 {% if pageno > 1 %}
63 <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}">
63 <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}">
64 <div class="left">
64 <div class="left">
65− <input type="hidden" name="q" value="{{ q }}" />
65+ <input type="hidden" name="q" value="{{ q|e }}" />
66 {% for category in selected_categories %}
66 {% for category in selected_categories %}
67 <input type="hidden" name="category_{{ category }}" value="1"/>
67 <input type="hidden" name="category_{{ category }}" value="1"/>
68 {% endfor %}
68 {% endfor %}
@@ -76,7 +76,7 @@
76 {% for category in selected_categories %}
76 {% for category in selected_categories %}
77 <input type="hidden" name="category_{{ category }}" value="1"/>
77 <input type="hidden" name="category_{{ category }}" value="1"/>
78 {% endfor %}
78 {% endfor %}
79− <input type="hidden" name="q" value="{{ q }}" />
79+ <input type="hidden" name="q" value="{{ q|e }}" />
80 <input type="hidden" name="pageno" value="{{ pageno+1 }}" />
80 <input type="hidden" name="pageno" value="{{ pageno+1 }}" />
81 <input type="submit" value="{{ _('next page') }} >>" />
81 <input type="submit" value="{{ _('next page') }} >>" />
82 </div>
82 </div>
searx/templates/legacy/results.html+5−5
@@ -1,6 +1,6 @@
1{% extends "legacy/base.html" %}
1{% extends "legacy/base.html" %}
2−{% block title %}{{ q }} - {% endblock %}
2+{% block title %}{{ q|e }} - {% endblock %}
3−{% block meta %}<link rel="alternate" type="application/rss+xml" title="Searx search: {{ q }}" href="{{ url_for('index') }}?q={{ q|urlencode }}&amp;format=rss&amp;{% for category in selected_categories %}category_{{ category }}=1&amp;{% endfor %}pageno={{ pageno }}">{% endblock %}
3+{% block meta %}<link rel="alternate" type="application/rss+xml" title="Searx search: {{ q|e }}" href="{{ url_for('index') }}?q={{ q|urlencode }}&amp;format=rss&amp;{% for category in selected_categories %}category_{{ category }}=1&amp;{% endfor %}pageno={{ pageno }}">{% endblock %}
4{% block content %}
4{% block content %}
5<div class="preferences_container right"><a href="{{ url_for('preferences') }}" id="preferences"><span>preferences</span></a></div>
5<div class="preferences_container right"><a href="{{ url_for('preferences') }}" id="preferences"><span>preferences</span></a></div>
6<div class="small search center">
6<div class="small search center">
@@ -18,7 +18,7 @@
18 {% for output_type in ('csv', 'json', 'rss') %}
18 {% for output_type in ('csv', 'json', 'rss') %}
19 <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}">
19 <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}">
20 <div class="left">
20 <div class="left">
21− <input type="hidden" name="q" value="{{ q }}" />
21+ <input type="hidden" name="q" value="{{ q|e }}" />
22 <input type="hidden" name="format" value="{{ output_type }}" />
22 <input type="hidden" name="format" value="{{ output_type }}" />
23 {% for category in selected_categories %}
23 {% for category in selected_categories %}
24 <input type="hidden" name="category_{{ category }}" value="1"/>
24 <input type="hidden" name="category_{{ category }}" value="1"/>
@@ -73,7 +73,7 @@
73 {% if pageno > 1 %}
73 {% if pageno > 1 %}
74 <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}">
74 <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}">
75 <div class="{% if rtl %}right{% else %}left{% endif %}">
75 <div class="{% if rtl %}right{% else %}left{% endif %}">
76− <input type="hidden" name="q" value="{{ q }}" />
76+ <input type="hidden" name="q" value="{{ q|e }}" />
77 {% for category in selected_categories %}
77 {% for category in selected_categories %}
78 <input type="hidden" name="category_{{ category }}" value="1"/>
78 <input type="hidden" name="category_{{ category }}" value="1"/>
79 {% endfor %}
79 {% endfor %}
@@ -87,7 +87,7 @@
87 {% for category in selected_categories %}
87 {% for category in selected_categories %}
88 <input type="hidden" name="category_{{ category }}" value="1"/>
88 <input type="hidden" name="category_{{ category }}" value="1"/>
89 {% endfor %}
89 {% endfor %}
90− <input type="hidden" name="q" value="{{ q }}" />
90+ <input type="hidden" name="q" value="{{ q|e }}" />
91 <input type="hidden" name="pageno" value="{{ pageno+1 }}" />
91 <input type="hidden" name="pageno" value="{{ pageno+1 }}" />
92 <input type="submit" value="{{ _('next page') }} >>" />
92 <input type="submit" value="{{ _('next page') }} >>" />
93 </div>
93 </div>
searx/templates/oscar/results.html+7−7
@@ -1,6 +1,6 @@
1{% extends "oscar/base.html" %}
1{% extends "oscar/base.html" %}
2−{% block title %}{{ q }} - {% endblock %}
2+{% block title %}{{ q|e }} - {% endblock %}
3−{% block meta %}<link rel="alternate" type="application/rss+xml" title="Searx search: {{ q }}" href="{{ url_for('index') }}?q={{ q|urlencode }}&amp;format=rss&amp;{% for category in selected_categories %}category_{{ category }}=1&amp;{% endfor %}pageno={{ pageno }}&amp;time_range={{ time_range }}">{% endblock %}
3+{% block meta %}<link rel="alternate" type="application/rss+xml" title="Searx search: {{ q|e }}" href="{{ url_for('index') }}?q={{ q|urlencode }}&amp;format=rss&amp;{% for category in selected_categories %}category_{{ category }}=1&amp;{% endfor %}pageno={{ pageno }}&amp;time_range={{ time_range }}">{% endblock %}
4{% block content %}
4{% block content %}
5 <div class="row">
5 <div class="row">
6 <div class="col-sm-8" id="main_results">
6 <div class="col-sm-8" id="main_results">
@@ -37,9 +37,9 @@
37 <div id="pagination">
37 <div id="pagination">
38 <div class="pull-left">
38 <div class="pull-left">
39 <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" class="pull-left">
39 <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" class="pull-left">
40− <input type="hidden" name="q" value="{{ q }}" />
40+ <input type="hidden" name="q" value="{{ q|e }}" />
41 {% for category in selected_categories %}<input type="hidden" name="category_{{ category }}" value="1"/>{% endfor %}
41 {% for category in selected_categories %}<input type="hidden" name="category_{{ category }}" value="1"/>{% endfor %}
42− <input type="hidden" name="q" value="{{ q }}" />
42+ <input type="hidden" name="q" value="{{ q|e }}" />
43 <input type="hidden" name="pageno" value="{{ pageno+1 }}" />
43 <input type="hidden" name="pageno" value="{{ pageno+1 }}" />
44 <input type="hidden" name="time_range" value="{{ time_range }}" />
44 <input type="hidden" name="time_range" value="{{ time_range }}" />
45 <button type="submit" class="btn btn-default"><span class="glyphicon glyphicon-backward"></span> {{ _('next page') }}</button>
45 <button type="submit" class="btn btn-default"><span class="glyphicon glyphicon-backward"></span> {{ _('next page') }}</button>
@@ -59,7 +59,7 @@
59 <div id="pagination">
59 <div id="pagination">
60 <div class="pull-left">
60 <div class="pull-left">
61 <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" class="pull-left">
61 <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" class="pull-left">
62− <input type="hidden" name="q" value="{{ q }}" />
62+ <input type="hidden" name="q" value="{{ q|e }}" />
63 {% for category in selected_categories %}<input type="hidden" name="category_{{ category }}" value="1"/>{% endfor %}
63 {% for category in selected_categories %}<input type="hidden" name="category_{{ category }}" value="1"/>{% endfor %}
64 <input type="hidden" name="pageno" value="{{ pageno-1 }}" />
64 <input type="hidden" name="pageno" value="{{ pageno-1 }}" />
65 <input type="hidden" name="time_range" value="{{ time_range }}" />
65 <input type="hidden" name="time_range" value="{{ time_range }}" />
@@ -69,7 +69,7 @@
69 <div class="pull-right">
69 <div class="pull-right">
70 <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" class="pull-left">
70 <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" class="pull-left">
71 {% for category in selected_categories %}<input type="hidden" name="category_{{ category }}" value="1"/>{% endfor %}
71 {% for category in selected_categories %}<input type="hidden" name="category_{{ category }}" value="1"/>{% endfor %}
72− <input type="hidden" name="q" value="{{ q }}" />
72+ <input type="hidden" name="q" value="{{ q|e }}" />
73 <input type="hidden" name="pageno" value="{{ pageno+1 }}" />
73 <input type="hidden" name="pageno" value="{{ pageno+1 }}" />
74 <input type="hidden" name="time_range" value="{{ time_range }}" />
74 <input type="hidden" name="time_range" value="{{ time_range }}" />
75 <button type="submit" class="btn btn-default"><span class="glyphicon glyphicon-forward"></span> {{ _('next page') }}</button>
75 <button type="submit" class="btn btn-default"><span class="glyphicon glyphicon-forward"></span> {{ _('next page') }}</button>
@@ -130,7 +130,7 @@
130 <div class="clearfix"></div>
130 <div class="clearfix"></div>
131 {% for output_type in ('csv', 'json', 'rss') %}
131 {% for output_type in ('csv', 'json', 'rss') %}
132 <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" class="form-inline pull-{% if rtl %}right{% else %}left{% endif %} result_download">
132 <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" class="form-inline pull-{% if rtl %}right{% else %}left{% endif %} result_download">
133− <input type="hidden" name="q" value="{{ q }}">
133+ <input type="hidden" name="q" value="{{ q|e }}">
134 <input type="hidden" name="format" value="{{ output_type }}">
134 <input type="hidden" name="format" value="{{ output_type }}">
135 {% for category in selected_categories %}<input type="hidden" name="category_{{ category }}" value="1">{% endfor %}
135 {% for category in selected_categories %}<input type="hidden" name="category_{{ category }}" value="1">{% endfor %}
136 <input type="hidden" name="pageno" value="{{ pageno }}">
136 <input type="hidden" name="pageno" value="{{ pageno }}">
searx/templates/pix-art/results.html+3−3
@@ -5,7 +5,7 @@
5 {% endfor %}
5 {% endfor %}
6{% else %}
6{% else %}
7{% extends "pix-art/base.html" %}
7{% extends "pix-art/base.html" %}
8−{% block title %}{{ q }} - {% endblock %}
8+{% block title %}{{ q|e }} - {% endblock %}
9{% block meta %}{% endblock %}
9{% block meta %}{% endblock %}
10{% block content %}
10{% block content %}
11<div id="logo"><a href="./"><img src="{{ url_for('static', filename='img/searx-pixel-small.png') }}" alt="searx Logo"/></a></div>
11<div id="logo"><a href="./"><img src="{{ url_for('static', filename='img/searx-pixel-small.png') }}" alt="searx Logo"/></a></div>
@@ -25,8 +25,8 @@
25 </span>
25 </span>
26 <div id="pagination">
26 <div id="pagination">
27 <br />
27 <br />
28− <input type="button" onclick="load_more('{{ q }}', {{ pageno+1 }})" id="load_more" value="{{ _('Load more...') }}" />
28+ <input type="button" onclick="load_more('{{ q|e }}', {{ pageno+1 }})" id="load_more" value="{{ _('Load more...') }}" />
29 </div>
29 </div>
30</div>
30</div>
31{% endblock %}
31{% endblock %}
32−{% endif %}
32+{% endif %}