Skip to content

Commit d5fb3d8

Browse files
Copilotcommjoen
andcommitted
Fix CI failures: restore password property, fix CRLF injection, fix Dockerfile versions
Co-authored-by: commjoen <1457214+commjoen@users.noreply.github.com>
1 parent 8328577 commit d5fb3d8

4 files changed

Lines changed: 13 additions & 6 deletions

File tree

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
FROM bellsoft/liberica-openjre-debian:25-cds AS builder
22
WORKDIR /builder
33

4-
ARG argBasedVersion="1.13.1-alpha11"
4+
ARG argBasedVersion="1.13.1-alpha6"
55

66
COPY --chown=wrongsecrets target/wrongsecrets-${argBasedVersion}-SNAPSHOT.jar application.jar
77
RUN java -Djarmode=tools -jar application.jar extract --layers --destination extracted

Dockerfile.web

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
FROM jeroenwillemsen/wrongsecrets:1.13.1-alpha11-no-vault
2-
ARG argBasedVersion="1.13.1-alpha11-no-vault"
1+
FROM jeroenwillemsen/wrongsecrets:1.13.1-alpha6-no-vault
2+
ARG argBasedVersion="1.13.1-alpha6-no-vault"
33
ARG spring_profile="without-vault"
44
ARG CANARY_URLS="http://canarytokens.com/terms/about/s7cfbdakys13246ewd8ivuvku/post.jsp,http://canarytokens.com/terms/about/y0all60b627gzp19ahqh7rl6j/post.jsp"
55
ARG CTF_ENABLED=false

src/main/java/org/owasp/wrongsecrets/challenges/docker/challenge61/TelegramWebhookController.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public ResponseEntity<String> handleWebhook(
5757
}
5858

5959
try {
60-
logger.info("Received webhook update: {}", update.get("update_id"));
60+
logger.info("Received webhook update: {}", sanitizeForLog(String.valueOf(update.get("update_id"))));
6161

6262
// Check if this is a message update
6363
if (update.containsKey("message")) {
@@ -104,7 +104,7 @@ private void sendSecretMessage(Object chatId) {
104104
Map<String, Object> response = restTemplate.getForObject(sendMessageUrl, Map.class);
105105

106106
if (response != null && Boolean.TRUE.equals(response.get("ok"))) {
107-
logger.info("Successfully sent secret message to chat_id: {}", chatId);
107+
logger.info("Successfully sent secret message to chat_id: {}", sanitizeForLog(String.valueOf(chatId)));
108108
} else {
109109
logger.warn("Failed to send message to Telegram");
110110
}
@@ -114,6 +114,13 @@ private void sendSecretMessage(Object chatId) {
114114
}
115115
}
116116

117+
private String sanitizeForLog(String value) {
118+
if (value == null) {
119+
return "null";
120+
}
121+
return value.replaceAll("[\r\n]", "_");
122+
}
123+
117124
private String getBotToken() {
118125
// Same double-encoded bot token as in Challenge61
119126
String encodedToken =

src/main/resources/application.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ spring.web.resources.cache.period=PT2H
55
server.compression.enabled=true
66
spring.config.import=classpath:/wrong-secrets-configuration.yaml
77

8-
# Challenge61: Disable webhook by default (memory intensive on Heroku). Enable in profile if needed.
8+
password=ThisEnvironmentIsAnotherPlaceToHide
99
challenge61.webhook.enabled=false
1010
SPECIAL_K8S_SECRET=if_you_see_this_please_use_k8s
1111
SPECIAL_SPECIAL_K8S_SECRET=if_you_see_this_please_use_k8s

0 commit comments

Comments
 (0)