From 48b75c8d2d10d1944f4ffaf4772efc571ad90f16 Mon Sep 17 00:00:00 2001 From: Xusheng Date: Sat, 26 Sep 2026 10:17:27 -0400 Subject: [PATCH] Make auto-validation and source uploads independent --- app/controllers/crackme.py | 11 ++++------- app/models/crackme.py | 4 ++-- templates/crackme/create.html | 24 +++++++++++++++--------- templates/faq/faq.html | 7 ++----- templates/rules/crackmerules.html | 9 ++++----- tests/test_solves.py | 24 +++++++++++++++++++----- 6 files changed, 46 insertions(+), 33 deletions(-) diff --git a/app/controllers/crackme.py b/app/controllers/crackme.py index ff7e7f2..07465b3 100644 --- a/app/controllers/crackme.py +++ b/app/controllers/crackme.py @@ -51,7 +51,7 @@ # Upload folder for crackmes UPLOAD_FOLDER = 'tmp/crackme' -# Source archives for auto-validated crackmes. Never served: this directory sits +# Optional source archives. Never served: this directory sits # outside static/ so the only way to read one is the reviewer download route. SOURCE_UPLOAD_FOLDER = 'private/crackme_source' MAX_FILE_SIZE = 10 * 1024 * 1024 # 10MB @@ -318,8 +318,7 @@ def upload_crackme_post(): if is_single_file_archive(file_data): return _upload_rejected('Archives containing only one file are not allowed. Please upload the file directly without wrapping it in an archive.') - # Auto-validation opt-in: the flag users will submit, plus the private source - # archive a reviewer needs to confirm that flag is actually the right one. + # Auto-validation and the private reviewer archive are independent choices. flag = None source_data = None source_filename = None @@ -338,10 +337,8 @@ def upload_crackme_post(): return _upload_rejected('Points must be a whole number from 100 to 600.') official_difficulty = points / 100 - source = request.files.get('source') - if source is None or source.filename == '': - return _upload_rejected('Auto-validation needs a source archive so reviewers can verify the flag.') - + source = request.files.get('source') + if source is not None and source.filename: source_data = source.read() if len(source_data) > MAX_FILE_SIZE: return _upload_rejected('The source archive is too large!') diff --git a/app/models/crackme.py b/app/models/crackme.py index 3a84e13..e1b6a5e 100644 --- a/app/models/crackme.py +++ b/app/models/crackme.py @@ -316,8 +316,8 @@ def crackme_create_prepare(name, info, username, lang, arch, platform, size, ori Its presence is what marks a crackme as auto-validated -- there is no separate flag to keep in sync. Stored in cleartext for reviewers; never rendered on the public site. - source_original_filename: Filename of the private source archive that - accompanies an auto-validated submission (reviewers only). + source_original_filename: Filename of an optional private archive + available to reviewers, independent of auto-validation. """ if not check_connection(): raise ErrUnavailable("Database is unavailable") diff --git a/templates/crackme/create.html b/templates/crackme/create.html index b7b6e1a..73815a0 100644 --- a/templates/crackme/create.html +++ b/templates/crackme/create.html @@ -100,6 +100,7 @@

Quick Rules

+

For a keygenme, name the required username here (for example, CrackMes1) so the accepted key is unique.

@@ -108,8 +109,8 @@

Quick Rules

+
+
+ +
+
+

+ You may upload a ZIP with source code or build notes for reviewers. This is private and independent of auto-validation. +

+ +
+
@@ -156,8 +163,7 @@

Quick Rules