Skip to content

Commit

Permalink
Fix wrong masking of one-char-secrets
Browse files Browse the repository at this point in the history
Fixes JENKINS-72412.
  • Loading branch information
gallardo committed Dec 1, 2023
1 parent 224f989 commit 89bbe4e
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,13 @@ public Collection<String> getBase64Forms(@NonNull String secret) {
String shiftedSecret = shift + secret;
String encoded = encoder.encodeToString(shiftedSecret.getBytes(StandardCharsets.UTF_8));
String processedEncoded = shift.length() > 0 ? encoded.substring(2 * shift.length()) : encoded;
result.add(processedEncoded);
result.add(removeTrailingEquals(processedEncoded));
if (!processedEncoded.isEmpty()) {
result.add(processedEncoded);
}
String processedWithoutTrailingEquals = removeTrailingEquals(processedEncoded);
if (!processedWithoutTrailingEquals.isEmpty()) {
result.add(removeTrailingEquals(processedEncoded));
}
}
}
return result;
Expand Down

0 comments on commit 89bbe4e

Please sign in to comment.