Skip to content

Commit 42ade62

Browse files
committed
Turn on CSRF protection - all forms must from now on have a {% csrf_token %}
- Legacy-Id: 6963
1 parent 52a0825 commit 42ade62

155 files changed

Lines changed: 220 additions & 181 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

ietf/dbtemplate/templates/dbtemplate/template_edit.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ <h2>Meta information</h2>
3030
</dl>
3131

3232
<h2>Edit template content</h2>
33-
<form action="" method="post">
33+
<form action="" method="post">{% csrf_token %}
3434
{{ form.as_p }}
3535
<input type="submit" value="Submit changes" />
3636
</form>

ietf/meeting/views.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
from django.middleware.gzip import GZipMiddleware
2323
from django.db.models import Max
2424
from django.forms.models import modelform_factory
25+
from django.views.decorators.csrf import ensure_csrf_cookie
2526

2627
from ietf.utils.pipe import pipe
2728
from ietf.ietfauth.utils import role_required, has_role
@@ -160,6 +161,7 @@ def agenda_create(request, num=None, schedule_name=None):
160161

161162

162163
@decorator_from_middleware(GZipMiddleware)
164+
@ensure_csrf_cookie
163165
def edit_timeslots(request, num=None):
164166

165167
meeting = get_meeting(num)
@@ -197,6 +199,7 @@ def edit_timeslots(request, num=None):
197199
#@role_required('Area Director','Secretariat')
198200
# disable the above security for now, check it below.
199201
@decorator_from_middleware(GZipMiddleware)
202+
@ensure_csrf_cookie
200203
def edit_agenda(request, num=None, schedule_name=None):
201204

202205
if request.method == 'POST':
@@ -286,6 +289,7 @@ def edit_agenda(request, num=None, schedule_name=None):
286289

287290
@role_required('Area Director','Secretariat')
288291
@decorator_from_middleware(GZipMiddleware)
292+
@ensure_csrf_cookie
289293
def edit_agenda_properties(request, num=None, schedule_name=None):
290294

291295
meeting = get_meeting(num)
@@ -304,6 +308,7 @@ def edit_agenda_properties(request, num=None, schedule_name=None):
304308

305309
@role_required('Area Director','Secretariat')
306310
@decorator_from_middleware(GZipMiddleware)
311+
@ensure_csrf_cookie
307312
def edit_agendas(request, num=None, order=None):
308313

309314
#if request.method == 'POST':
@@ -325,6 +330,7 @@ def edit_agendas(request, num=None, order=None):
325330
RequestContext(request)),
326331
content_type="text/html")
327332

333+
@ensure_csrf_cookie
328334
def agenda(request, num=None, name=None, base=None, ext=None):
329335
base = base if base else 'agenda'
330336
ext = ext if ext else '.html'

ietf/secr/templates/announcement/confirm.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<div class="module">
1616
<h2>Announcement</h2>
1717

18-
<form action="" method="POST">
18+
<form action="" method="post">{% csrf_token %}
1919

2020
<pre id="announce-confirm">
2121
To: {{ to }}

ietf/secr/templates/announcement/main.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<div class="module">
1212
<h2>Announcement</h2>
1313

14-
<form action="" method="POST">
14+
<form action="" method="post">{% csrf_token %}
1515
<table class="new-style full-width amstable" id="announce-table">
1616
{% if form.non_field_errors %}{{ form.non_field_errors }}{% endif %}
1717
{% for field in form.visible_fields %}

ietf/secr/templates/areas/add.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
<div class="module">
1717
<h2>Area - Add</h2>
18-
<form enctype="multipart/form-data" action="" method="post">
18+
<form enctype="multipart/form-data" action="" method="post">{% csrf_token %}
1919
<table id="area-add-table" class="full-width amstable">
2020
<col width="150">
2121
{{ area_form.as_table }}

ietf/secr/templates/areas/edit.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
{% block content %}
1616

1717
<div class="module">
18-
<form action="." method="post">
18+
<form action="." method="post">{% csrf_token %}
1919
<h2>Area - Edit</h2>
2020
<table class="full-width amstable">
2121
<col width="150">

ietf/secr/templates/areas/people.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<h2>Area Directors ({{ area.acronym }})</h2>
2222
<table class="center">
2323
{% for director in directors %}
24-
<form action="modify/" method="post">
24+
<form action="modify/" method="post">{% csrf_token %}
2525
<input type="hidden" name="tag" value="{{ director.person.id }}" />
2626
<tr>
2727
<td id="id-ad-name"><a href="">{{ director.person.name }}</a></td>
@@ -39,7 +39,7 @@ <h2>Area Directors ({{ area.acronym }})</h2>
3939
<div class="inline-related">
4040
<h3><b>Add new Director</b></h3>
4141
<p>
42-
<form action="." method="post">
42+
<form action="." method="post">{% csrf_token %}
4343
<table class="center">
4444
{{ form.as_table }}
4545
<tr>

ietf/secr/templates/drafts/add.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
<div class="module draft-container">
1818
<h2>Draft - Add</h2>
19-
<form id="drafts-add-form" enctype="multipart/form-data" action="" method="post">
19+
<form id="drafts-add-form" enctype="multipart/form-data" action="" method="post">{% csrf_token %}
2020
<table class="full-width amstable">
2121
<col width="150">
2222
{{ form.as_table }}

ietf/secr/templates/drafts/approvals.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
<div class="module draft-container">
1616
<h2>Draft - Approvals</h2>
17-
<form id="drafts-approvals-form" enctype="multipart/form-data" action="" method="post">
17+
<form id="drafts-approvals-form" enctype="multipart/form-data" action="" method="post">{% csrf_token %}
1818
<table class="full-width">
1919
{{ form.as_table }}
2020
</table>

ietf/secr/templates/drafts/authors.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ <h2>Authors</h2>
4343
<div class="inline-related">
4444
<!-- <hr><br> -->
4545
<h3>Add Author</h3>
46-
<form id="groups-people" action="" method="post">
46+
<form id="groups-people" action="" method="post">{% csrf_token %}
4747
{{ form.non_field_errors }}
4848
<table class="full-width">
4949
<tr>

0 commit comments

Comments
 (0)