Skip to content

Commit

Permalink
Merge pull request #788 from OWASP/bugfixes
Browse files Browse the repository at this point in the history
Fix for string checks for challenge 7, 13, and 14
  • Loading branch information
commjoen authored Apr 26, 2023
2 parents 3881676 + 63d4d25 commit 9941249
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.owasp.wrongsecrets.challenges.docker;

import com.google.common.base.Strings;
import lombok.extern.slf4j.Slf4j;
import org.apache.logging.log4j.util.Strings;
import org.owasp.wrongsecrets.RuntimeEnvironment;
import org.owasp.wrongsecrets.ScoreCard;
import org.owasp.wrongsecrets.challenges.Challenge;
Expand Down Expand Up @@ -58,10 +58,11 @@ protected boolean answerCorrect(String answer) {
return isKeyCorrect(answer);
}

@Override

/**
* {@inheritDoc}
*/
@Override
public List<RuntimeEnvironment.Environment> supportedRuntimeEnvironments() {
return List.of(RuntimeEnvironment.Environment.DOCKER);
}
Expand Down Expand Up @@ -90,7 +91,7 @@ public boolean isLimittedWhenOnlineHosted() {
}

private boolean isKeyCorrect(String base64EncodedKey) {
if (Strings.isEmpty(base64EncodedKey) || Strings.isEmpty(plainText) || Strings.isEmpty(cipherText)) {
if (Strings.isNullOrEmpty(base64EncodedKey) || Strings.isNullOrEmpty(plainText) || Strings.isNullOrEmpty(cipherText)) {
//log.debug("Checking secret with values {}, {}, {}", base64EncodedKey, plainText, cipherText);
return false;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package org.owasp.wrongsecrets.challenges.docker;

import com.google.common.base.Strings;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import lombok.extern.slf4j.Slf4j;
import org.apache.logging.log4j.util.Strings;
import org.linguafranca.pwdb.Database;
import org.linguafranca.pwdb.kdbx.KdbxCreds;
import org.linguafranca.pwdb.kdbx.simple.SimpleDatabase;
Expand Down Expand Up @@ -66,10 +66,11 @@ protected boolean answerCorrect(String answer) {
return isanswerCorrectInKeeyPassx(answer);
}

@Override

/**
* {@inheritDoc}
*/
@Override
public List<RuntimeEnvironment.Environment> supportedRuntimeEnvironments() {
return List.of(RuntimeEnvironment.Environment.DOCKER);
}
Expand Down Expand Up @@ -99,7 +100,7 @@ public boolean isLimittedWhenOnlineHosted() {

@SuppressFBWarnings("PATH_TRAVERSAL_IN")
private String findAnswer() {
if (Strings.isEmpty(keepassxPassword)) {
if (Strings.isNullOrEmpty(keepassxPassword)) {
//log.debug("Checking secret with values {}", keepassxPassword);
return defaultKeepassValue;
}
Expand All @@ -117,7 +118,7 @@ private String findAnswer() {
}

private boolean isanswerCorrectInKeeyPassx(String answer) {
if (Strings.isEmpty(keepassxPassword) || Strings.isEmpty(answer)) {
if (Strings.isNullOrEmpty(keepassxPassword) || Strings.isNullOrEmpty(answer)) {
//log.debug("Checking secret with values {}, {}", keepassxPassword, answer);
return false;
}
Expand Down

0 comments on commit 9941249

Please sign in to comment.