From 4ef51955f2c0c2da17bb922d52fd39eae0bf4464 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Thu, 1 Jun 2017 19:58:32 +0300 Subject: Add challenge size check in task response manifest parser --- libbbot/manifest.cxx | 4 ++-- tests/manifest/task-response.test | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/libbbot/manifest.cxx b/libbbot/manifest.cxx index 02a5b05..56c5f1d 100644 --- a/libbbot/manifest.cxx +++ b/libbbot/manifest.cxx @@ -656,8 +656,8 @@ namespace bbot if (challenge) bad_name ("task response challenge redefinition"); - if (v.empty ()) - bad_value ("empty task response challenge"); + if (v.size () != 64) + bad_value ("invalid task response challenge"); challenge = move (v); } diff --git a/tests/manifest/task-response.test b/tests/manifest/task-response.test index 25a76f1..ff5ae88 100644 --- a/tests/manifest/task-response.test +++ b/tests/manifest/task-response.test @@ -17,7 +17,7 @@ test.options += -ts $* <>EOF : 1 session: abcd - challenge: xyz + challenge: cc6585375ef81898cc60791b11852e3d2ed9ebb82ebb0874010fe0e6f9ebdb73 result-url: https://cppget.org/?build-result : name: libfoo @@ -63,8 +63,8 @@ test.options += -ts : $* <'stdin:3:1: error: task response challenge redefinition' == 1 : 1 - challenge: xyz - challenge: xyz + challenge: cc6585375ef81898cc60791b11852e3d2ed9ebb82ebb0874010fe0e6f9ebdb73 + challenge: cc6585375ef81898cc60791b11852e3d2ed9ebb82ebb0874010fe0e6f9ebdb73 EOI : result-url @@ -82,11 +82,11 @@ test.options += -ts : challenge : { - : empty + : size : - $* <'stdin:2:11: error: empty task response challenge' == 1 + $* <'stdin:2:12: error: invalid task response challenge' == 1 : 1 - challenge: + challenge: abc EOI : redundant @@ -94,7 +94,7 @@ test.options += -ts $* <'stdin:4:1: error: unexpected task response challenge' == 1 : 1 session: - challenge: abc + challenge: cc6585375ef81898cc60791b11852e3d2ed9ebb82ebb0874010fe0e6f9ebdb73 EOI } @@ -147,7 +147,7 @@ EOI $* <'stdin:4:1: error: no task response result url specified' == 1 : 1 session: abc - challenge: xyz + challenge: cc6585375ef81898cc60791b11852e3d2ed9ebb82ebb0874010fe0e6f9ebdb73 EOI : task @@ -155,7 +155,7 @@ EOI $* <'stdin:5:1: error: task manifest expected' == 1 : 1 session: abcd - challenge: xyz + challenge: cc6585375ef81898cc60791b11852e3d2ed9ebb82ebb0874010fe0e6f9ebdb73 result-url: https://cppget.org/?build-result EOI } -- cgit v1.1