diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2017-06-01 19:58:32 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2017-06-01 19:58:32 +0300 |
commit | 4ef51955f2c0c2da17bb922d52fd39eae0bf4464 (patch) | |
tree | 51f4e1cf5ae5e4c741cf1175821daa6363e32731 | |
parent | fa00e853d17b40d9112cb856ca1f08dfe8500f20 (diff) |
Add challenge size check in task response manifest parser
-rw-r--r-- | libbbot/manifest.cxx | 4 | ||||
-rw-r--r-- | 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 >>EOF : 1 session: abcd - challenge: xyz + challenge: cc6585375ef81898cc60791b11852e3d2ed9ebb82ebb0874010fe0e6f9ebdb73 result-url: https://cppget.org/?build-result : name: libfoo @@ -63,8 +63,8 @@ test.options += -ts : $* <<EOI 2>'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 : - $* <<EOI 2>'stdin:2:11: error: empty task response challenge' == 1 + $* <<EOI 2>'stdin:2:12: error: invalid task response challenge' == 1 : 1 - challenge: + challenge: abc EOI : redundant @@ -94,7 +94,7 @@ test.options += -ts $* <<EOI 2>'stdin:4:1: error: unexpected task response challenge' == 1 : 1 session: - challenge: abc + challenge: cc6585375ef81898cc60791b11852e3d2ed9ebb82ebb0874010fe0e6f9ebdb73 EOI } @@ -147,7 +147,7 @@ EOI $* <<EOI 2>'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 $* <<EOI 2>'stdin:5:1: error: task manifest expected' == 1 : 1 session: abcd - challenge: xyz + challenge: cc6585375ef81898cc60791b11852e3d2ed9ebb82ebb0874010fe0e6f9ebdb73 result-url: https://cppget.org/?build-result EOI } |