~maas-committers/maas/1.2

« back to all changes in this revision

Viewing changes to src/maasserver/api.py

  • Committer: Julian Edwards
  • Date: 2014-02-14 00:40:47 UTC
  • mfrom: (1386.1.2 1.2-xss-bug-1251336)
  • Revision ID: julian.edwards@canonical.com-20140214004047-6dx8zqp4y9s2ktod
Fix XSS in the API for invalid operations

Show diffs side-by-side

added added

removed removed

Lines of Context:
109
109
from django.http import (
110
110
    Http404,
111
111
    HttpResponse,
112
 
    HttpResponseBadRequest,
113
112
    QueryDict,
114
113
    )
115
114
from django.shortcuts import (
307
306
        signature = request.method.upper(), request.REQUEST.get("op")
308
307
        function = self.exports.get(signature)
309
308
        if function is None:
310
 
            return HttpResponseBadRequest(
 
309
            raise MAASAPIBadRequest(
311
310
                "Unrecognised signature: %s %s" % signature)
312
311
        else:
313
312
            return function(self, request, *args, **kwargs)