From 97ffca6dc124b23c42adce861e882e03e1bd8c6e Mon Sep 17 00:00:00 2001 From: Jeroen Willemsen Date: Wed, 9 Oct 2024 22:40:35 +0200 Subject: [PATCH 1/2] fix for disabled challenges --- .../wrongsecrets/challenges/ChallengesCtfController.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/owasp/wrongsecrets/challenges/ChallengesCtfController.java b/src/main/java/org/owasp/wrongsecrets/challenges/ChallengesCtfController.java index 5ac32c9bd..3eb9c1d97 100644 --- a/src/main/java/org/owasp/wrongsecrets/challenges/ChallengesCtfController.java +++ b/src/main/java/org/owasp/wrongsecrets/challenges/ChallengesCtfController.java @@ -25,6 +25,7 @@ public class ChallengesCtfController { private final Challenges challenges; private final ChallengeDefinitionsConfiguration wrongSecretsConfiguration; private final RuntimeEnvironment runtimeEnvironment; + private final String disabledChallenge = "This challenge is disbled"; public ChallengesCtfController( ScoreCard scoreCard, @@ -58,10 +59,13 @@ public String getChallenges() { definition .source(runtimeEnvironment) .map(s -> s.explanation().contents().get()) - .orElse(null)); + .orElse(disabledChallenge)); jsonChallenge.put( "hint", - definition.source(runtimeEnvironment).map(s -> s.hint().contents().get()).orElse(null)); + definition + .source(runtimeEnvironment) + .map(s -> s.hint().contents().get()) + .orElse(disabledChallenge)); jsonChallenge.put("solved", scoreCard.getChallengeCompleted(definition)); jsonChallenge.put("disabledEnv", getDisabledEnv(definition)); jsonChallenge.put("difficulty", definition.difficulty().difficulty()); From b45079a1fa0cc47597c1307ac096ec667f741322 Mon Sep 17 00:00:00 2001 From: Jeroen Willemsen Date: Wed, 9 Oct 2024 22:45:39 +0200 Subject: [PATCH 2/2] fix finding --- .../owasp/wrongsecrets/challenges/ChallengesCtfController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/owasp/wrongsecrets/challenges/ChallengesCtfController.java b/src/main/java/org/owasp/wrongsecrets/challenges/ChallengesCtfController.java index 3eb9c1d97..a44d3bed2 100644 --- a/src/main/java/org/owasp/wrongsecrets/challenges/ChallengesCtfController.java +++ b/src/main/java/org/owasp/wrongsecrets/challenges/ChallengesCtfController.java @@ -25,7 +25,6 @@ public class ChallengesCtfController { private final Challenges challenges; private final ChallengeDefinitionsConfiguration wrongSecretsConfiguration; private final RuntimeEnvironment runtimeEnvironment; - private final String disabledChallenge = "This challenge is disbled"; public ChallengesCtfController( ScoreCard scoreCard, @@ -54,6 +53,7 @@ public String getChallenges() { jsonChallenge.put("name", definition.name().name()); jsonChallenge.put("key", definition.name().shortName()); jsonChallenge.put("category", getCategory() + " - " + definition.category().category()); + String disabledChallenge = "This challenge is disbled"; jsonChallenge.put( "description", definition