|
16 | 16 | global_round_id = 0 |
17 | 17 | FLAG_REGEX = r"ENO[A-Za-z0-9+\/=]{48}" |
18 | 18 | REQUEST_TIMEOUT = 10 |
| 19 | +CHAIN_ID_PREFIX = secrets.token_hex(20) |
19 | 20 |
|
20 | 21 |
|
21 | 22 | @pytest.fixture |
@@ -111,7 +112,9 @@ def _create_request_message( |
111 | 112 | prefix = "noise" |
112 | 113 | elif method == "exploit": |
113 | 114 | prefix = "exploit" |
114 | | - task_chain_id = f"{prefix}_s0_r{round_id}_t0_i{unique_variant_index}" |
| 115 | + task_chain_id = ( |
| 116 | + f"{CHAIN_ID_PREFIX}_{prefix}_s0_r{round_id}_t0_i{unique_variant_index}" |
| 117 | + ) |
115 | 118 |
|
116 | 119 | return CheckerTaskMessage( |
117 | 120 | task_id=round_id, |
@@ -375,6 +378,32 @@ def test_getflag(round_id, flag_id, service_address, checker_url): |
375 | 378 | _test_getflag(flag, round_id, flag_id, service_address, checker_url) |
376 | 379 |
|
377 | 380 |
|
| 381 | +def test_getflag_wrong_flag(round_id, flag_id, service_address, checker_url): |
| 382 | + flag = generate_dummyflag() |
| 383 | + _test_putflag(flag, round_id, flag_id, service_address, checker_url) |
| 384 | + wrong_flag = generate_dummyflag() |
| 385 | + _test_getflag( |
| 386 | + wrong_flag, |
| 387 | + round_id, |
| 388 | + flag_id, |
| 389 | + service_address, |
| 390 | + checker_url, |
| 391 | + expected_result=CheckerTaskResult.MUMBLE, |
| 392 | + ) |
| 393 | + |
| 394 | + |
| 395 | +def test_getflag_without_putflag(round_id, flag_id, service_address, checker_url): |
| 396 | + flag = generate_dummyflag() |
| 397 | + _test_getflag( |
| 398 | + flag, |
| 399 | + round_id, |
| 400 | + flag_id, |
| 401 | + service_address, |
| 402 | + checker_url, |
| 403 | + expected_result=CheckerTaskResult.MUMBLE, |
| 404 | + ) |
| 405 | + |
| 406 | + |
378 | 407 | def test_getflag_multiplied( |
379 | 408 | round_id, flag_id_multiplied, flag_variants, service_address, checker_url |
380 | 409 | ): |
@@ -442,6 +471,16 @@ def test_getnoise(round_id, noise_id, service_address, checker_url): |
442 | 471 | _test_getnoise(round_id, noise_id, service_address, checker_url) |
443 | 472 |
|
444 | 473 |
|
| 474 | +def test_getnoise_without_putnoise(round_id, noise_id, service_address, checker_url): |
| 475 | + _test_getnoise( |
| 476 | + round_id, |
| 477 | + noise_id, |
| 478 | + service_address, |
| 479 | + checker_url, |
| 480 | + expected_result=CheckerTaskResult.MUMBLE, |
| 481 | + ) |
| 482 | + |
| 483 | + |
445 | 484 | def test_getnoise_multiplied( |
446 | 485 | round_id, noise_id_multiplied, noise_variants, service_address, checker_url |
447 | 486 | ): |
|
0 commit comments