File tree Expand file tree Collapse file tree
java/org/owasp/wrongsecrets/challenges/docker/challenge61 Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11FROM bellsoft/liberica-openjre-debian:25-cds AS builder
22WORKDIR /builder
33
4- ARG argBasedVersion="1.13.1-alpha11 "
4+ ARG argBasedVersion="1.13.1-alpha6 "
55
66COPY --chown=wrongsecrets target/wrongsecrets-${argBasedVersion}-SNAPSHOT.jar application.jar
77RUN java -Djarmode=tools -jar application.jar extract --layers --destination extracted
Original file line number Diff line number Diff line change 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"
33ARG spring_profile="without-vault"
44ARG CANARY_URLS="http://canarytokens.com/terms/about/s7cfbdakys13246ewd8ivuvku/post.jsp,http://canarytokens.com/terms/about/y0all60b627gzp19ahqh7rl6j/post.jsp"
55ARG CTF_ENABLED=false
Original file line number Diff line number Diff 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 =
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ spring.web.resources.cache.period=PT2H
55server.compression.enabled =true
66spring.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
99challenge61.webhook.enabled =false
1010SPECIAL_K8S_SECRET =if_you_see_this_please_use_k8s
1111SPECIAL_SPECIAL_K8S_SECRET =if_you_see_this_please_use_k8s
You can’t perform that action at this time.
0 commit comments