Commit bd2330a8 by Sef Kloninger

press releases: more explicitly match on slug (safety)

parent bcdc6db4
......@@ -51,3 +51,11 @@ class SimpleTest(TestCase):
response = self.client.get("/press/this-shouldnt-work")
self.assertEqual(response.status_code, 404)
# can someone do something fishy? no.
response = self.client.get("/press/../homework.html")
self.assertEqual(response.status_code, 404)
# "." in is ascii 2E
response = self.client.get("/press/%2E%2E/homework.html")
self.assertEqual(response.status_code, 404)
......@@ -117,7 +117,7 @@ urlpatterns = ('',
{'template': 'honor.html'}, name="honor"),
#Press releases
url(r'^press/([^/]+)$', 'static_template_view.views.render_press_release', name='press_release'),
url(r'^press/([_a-zA-Z0-9-]+)$', 'static_template_view.views.render_press_release', name='press_release'),
# Favicon
(r'^favicon\.ico$', 'django.views.generic.simple.redirect_to', {'url': '/static/images/favicon.ico'}),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment