Skip to content

Commit ea3c4a8

Browse files
SonarCloud - WrongSecrets - Initial Scan 5.0
1 parent 2b47e07 commit ea3c4a8

File tree

3 files changed

+33
-33
lines changed

3 files changed

+33
-33
lines changed

src/main/java/org/owasp/wrongsecrets/Challenges.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,9 @@ public boolean isFirstChallenge(ChallengeDefinition challengeDefinition) {
9999
return challengeDefinition.equals(definitions.challenges().get(0));
100100
}
101101

102-
public boolean isLastChallenge(ChallengeDefinition challengeDefinition) {
103-
return challengeDefinition.equals(definitions.challenges().getLast());
104-
}
102+
// public boolean isLastChallenge(ChallengeDefinition challengeDefinition) {
103+
// return challengeDefinition.equals(definitions.challenges().getLast());
104+
// }
105105

106106
public List<ChallengeDefinition> getChallengeDefinitions() {
107107
return definitions.challenges();

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,14 @@ public String previous() {
104104
return navigation.previous().map(this::getLink).orElse(null);
105105
}
106106

107-
private String documentation(Function<ChallengeSource, String> extractor) {
108-
if (runtimeEnvironment.canRun(challengeDefinition)) {
109-
return challengeDefinition.source(runtimeEnvironment).map(extractor).orElse("");
110-
} else {
111-
// We cannot run the challenge but showing documentation should still be possible
112-
return extractor.apply(challengeDefinition.sources().getFirst());
113-
}
114-
}
107+
// private String documentation(Function<ChallengeSource, String> extractor) {
108+
// if (runtimeEnvironment.canRun(challengeDefinition)) {
109+
// return challengeDefinition.source(runtimeEnvironment).map(extractor).orElse("");
110+
// } else {
111+
// // We cannot run the challenge but showing documentation should still be possible
112+
// return extractor.apply(challengeDefinition.sources().getFirst());
113+
// }
114+
// }
115115

116116
/**
117117
* Returns filename of the explanation of the challenge.

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

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -84,28 +84,28 @@ public ChallengesController(
8484
* @param model exchanged with the FE
8585
* @return either a notification or a spoil
8686
*/
87-
@GetMapping("/spoil/{short-name}")
88-
@Hidden
89-
public String spoiler(@PathVariable("short-name") String shortName, Model model) {
90-
if (ctfModeEnabled) {
91-
model.addAttribute("spoiler", new Spoiler("Spoils are disabled in CTF mode"));
92-
} else if (!spoilingEnabled) {
93-
model.addAttribute("spoiler", new Spoiler("Spoils are disabled in the configuration"));
94-
} else {
95-
Optional<Spoiler> spoilerFromRuntimeEnvironment =
96-
challenges.findChallenge(shortName, runtimeEnvironment).map(Challenge::spoiler);
97-
Supplier<Spoiler> spoilerFromRandomChallenge =
98-
() -> {
99-
var challengeDefinition = findByShortName(shortName);
100-
return challenges.getChallenge(challengeDefinition).getFirst().spoiler();
101-
};
102-
103-
// We always want to show the spoiler even if we run in a non-supported environment
104-
model.addAttribute(
105-
"spoiler", spoilerFromRuntimeEnvironment.orElseGet(spoilerFromRandomChallenge));
106-
}
107-
return "spoil";
108-
}
87+
// @GetMapping("/spoil/{short-name}")
88+
// @Hidden
89+
// public String spoiler(@PathVariable("short-name") String shortName, Model model) {
90+
// if (ctfModeEnabled) {
91+
// model.addAttribute("spoiler", new Spoiler("Spoils are disabled in CTF mode"));
92+
// } else if (!spoilingEnabled) {
93+
// model.addAttribute("spoiler", new Spoiler("Spoils are disabled in the configuration"));
94+
// } else {
95+
// Optional<Spoiler> spoilerFromRuntimeEnvironment =
96+
// challenges.findChallenge(shortName, runtimeEnvironment).map(Challenge::spoiler);
97+
// Supplier<Spoiler> spoilerFromRandomChallenge =
98+
// () -> {
99+
// var challengeDefinition = findByShortName(shortName);
100+
// return challenges.getChallenge(challengeDefinition).getFirst().spoiler();
101+
// };
102+
103+
// // We always want to show the spoiler even if we run in a non-supported environment
104+
// model.addAttribute(
105+
// "spoiler", spoilerFromRuntimeEnvironment.orElseGet(spoilerFromRandomChallenge));
106+
// }
107+
// return "spoil";
108+
// }
109109

110110
private void addChallengeUI(Model model, ChallengeDefinition challengeDefinition) {
111111
model.addAttribute(

0 commit comments

Comments
 (0)