Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id D1F0FE00AAF; Tue, 16 Feb 2016 11:20:44 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on yocto-www.yoctoproject.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-HAM-Report: * -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low * trust * [209.85.220.43 listed in list.dnswl.org] * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] * 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily * valid * -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Received: from mail-pa0-f43.google.com (mail-pa0-f43.google.com [209.85.220.43]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id A8CFCE00B70 for ; Tue, 16 Feb 2016 11:20:21 -0800 (PST) Received: by mail-pa0-f43.google.com with SMTP id fy10so68643192pac.1 for ; Tue, 16 Feb 2016 11:20:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=xMVBTin6+GMlPX9PpHDOExPQ9QhcosGOCr6yO34p3Sc=; b=OCcu4VwWoFloJdsLxNo/NlTfPAlYOHLI6y9+KE6jyTuydFv6Apaqr7g6e81MkI602J n9++ocfDFEc/I6C2poN3eJJf9ASm0q2uErv73fJNIUQOXcDCTmbbLIpFdirTbAsZp7wH P6gnujTEcKhQKiShUlXe9bQIjdcHIc13EuwEbZWWlGd4BKOAM5d5z8se1+wtGn98CZwk mrG8kXP1iw77n7dCeVziiKtbTpXjQljNg2qirC6pYcrCB2JiO3GyycsL9lotztOE1Nem aDbvNFtM5qrEfWNiyw1H8jUgCQyh7fUuQsLsOCElsmcUyozBf9NvmUGrKJHZ0rGImkhR +2Eg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=xMVBTin6+GMlPX9PpHDOExPQ9QhcosGOCr6yO34p3Sc=; b=huTETl//1cI7wDPu7wIg4eaTUquU6LjtIl3/KlWmPh08K01e83/wS6yL4T1ZWvDBT/ 92+HHOD2f0wahOQgE87ccbeiIwW9G6Uf0U6Ne4p4H40JOU5kYieH++GXU8JOSvuYlIlI SwAskWPhMkMZRtW0qu0X4PYMxwGdjZ53MVUJGqneipgSHgHaqI3k7hCV80I+NT8KK/an U0g5fY/AAlIozTX0+/4qZB2R3hoUCCoB+8CfNfFaLg+Dlajgq6qksr5j329i/uARomEt qdaq2xAY5nobXnkLomYrpyivn08RjfLbwI8LrjB1sAa3yQxMmG4DoON8RhhYviNMGTDA dI8A== X-Gm-Message-State: AG10YOToUjtIJcQiM9ZbQ4dT+1bd7Bmv3QtFAU7ofSuAvvMWRMsJnuCduo1kpygxZCsqX6Z4 X-Received: by 10.66.167.145 with SMTP id zo17mr4760788pab.73.1455650421351; Tue, 16 Feb 2016 11:20:21 -0800 (PST) Received: from dorado.ger.corp.intel.com (fmdmzpr02-ext.fm.intel.com. [192.55.55.37]) by smtp.gmail.com with ESMTPSA id 85sm47551442pfl.18.2016.02.16.11.20.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 16 Feb 2016 11:20:20 -0800 (PST) From: Michael Wood To: toaster@yoctoproject.org Date: Tue, 16 Feb 2016 19:19:57 +0000 Message-Id: <1455650397-14195-6-git-send-email-michael.g.wood@intel.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1455650397-14195-1-git-send-email-michael.g.wood@intel.com> References: <1455650397-14195-1-git-send-email-michael.g.wood@intel.com> Subject: [PATCH 5/5] toaster: toastergui Fix invalid char test and implementation X-BeenThere: toaster@yoctoproject.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Web based interface for BitBake List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Feb 2016 19:20:44 -0000 This test was passing but because the assertion was the wrong way round and should have expected the first one to pass and second one to fail, in reality both were failing as the method for checking the invalid char was incorrect. Signed-off-by: Michael Wood --- bitbake/lib/toaster/toastergui/tests.py | 2 +- bitbake/lib/toaster/toastergui/views.py | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/bitbake/lib/toaster/toastergui/tests.py b/bitbake/lib/toaster/toastergui/tests.py index 1b6e78d..4e420ea 100644 --- a/bitbake/lib/toaster/toastergui/tests.py +++ b/bitbake/lib/toaster/toastergui/tests.py @@ -155,7 +155,7 @@ class ViewTests(TestCase): response = self.client.post(reverse('xhr_importlayer'), args) data = json.loads(response.content) self.assertEqual(response.status_code, 200) - self.assertNotEqual(data["error"], "ok") + self.assertEqual(data["error"], "ok") #Test to verify import of a layer successful args['name'] = "meta-oe" diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py index dfa256e..13489af 100755 --- a/bitbake/lib/toaster/toastergui/views.py +++ b/bitbake/lib/toaster/toastergui/views.py @@ -2185,8 +2185,11 @@ if True: layers_added = []; # Rudimentary check for any possible html tags - if "<" in request.POST: - return HttpResponse(jsonfilter({"error": "Invalid character <"}), content_type = "application/json") + for val in request.POST.values(): + if "<" in val: + return HttpResponse(jsonfilter( + {"error": "Invalid character <"}), + content_type="application/json") prj = Project.objects.get(pk=request.POST['project_id']) -- 2.5.0