Skip to content

Commit a7acbe6

Browse files
authored
Merge pull request #1662 from OWASP/ctfd-generation-fix
fix for disabled challenges for ctfd data generation
2 parents 05fea69 + b45079a commit a7acbe6

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/main/java/org/owasp/wrongsecrets/challenges/ChallengesCtfController.java

+6-2
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,19 @@ public String getChallenges() {
5353
jsonChallenge.put("name", definition.name().name());
5454
jsonChallenge.put("key", definition.name().shortName());
5555
jsonChallenge.put("category", getCategory() + " - " + definition.category().category());
56+
String disabledChallenge = "This challenge is disbled";
5657
jsonChallenge.put(
5758
"description",
5859
definition
5960
.source(runtimeEnvironment)
6061
.map(s -> s.explanation().contents().get())
61-
.orElse(null));
62+
.orElse(disabledChallenge));
6263
jsonChallenge.put(
6364
"hint",
64-
definition.source(runtimeEnvironment).map(s -> s.hint().contents().get()).orElse(null));
65+
definition
66+
.source(runtimeEnvironment)
67+
.map(s -> s.hint().contents().get())
68+
.orElse(disabledChallenge));
6569
jsonChallenge.put("solved", scoreCard.getChallengeCompleted(definition));
6670
jsonChallenge.put("disabledEnv", getDisabledEnv(definition));
6771
jsonChallenge.put("difficulty", definition.difficulty().difficulty());

0 commit comments

Comments
 (0)