Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM bellsoft/liberica-openjre-debian:25-cds AS builder
WORKDIR /builder

ARG argBasedVersion="1.13.1-alpha11"
ARG argBasedVersion="1.13.1-alpha6"

COPY --chown=wrongsecrets target/wrongsecrets-${argBasedVersion}-SNAPSHOT.jar application.jar
RUN java -Djarmode=tools -jar application.jar extract --layers --destination extracted
Expand All @@ -13,12 +13,12 @@
ARG spring_profile=""
ARG challenge59_webhook_url="YUhSMGNITTZMeTlvYjI5cmN5NXpiR0ZqYXk1amIyMHZjMlZ5ZG1salpYTXZWREEwVkRRd1RraFlMMEl3T1VSQlRrb3lUamRMTDJNeWFqYzFSVEUzVjFrd2NFeE5SRXRvU0RsbGQzZzBhdz09"
ENV SPRING_PROFILES_ACTIVE=$spring_profile
ENV ARG_BASED_PASSWORD=$argBasedPassword

Check warning on line 16 in Dockerfile

View workflow job for this annotation

GitHub Actions / build-preview

Sensitive data should not be used in the ARG or ENV commands

SecretsUsedInArgOrEnv: Do not use ARG or ENV instructions for sensitive data (ENV "ARG_BASED_PASSWORD") More info: https://docs.docker.com/go/dockerfile/rule/secrets-used-in-arg-or-env/
ENV APP_VERSION=$argBasedVersion

Check warning on line 17 in Dockerfile

View workflow job for this annotation

GitHub Actions / build-preview

Variables should be defined before their use

UndefinedVar: Usage of undefined variable '$argBasedVersion' More info: https://docs.docker.com/go/dockerfile/rule/undefined-var/
ENV DOCKER_ENV_PASSWORD="This is it"

Check warning on line 18 in Dockerfile

View workflow job for this annotation

GitHub Actions / build-preview

Sensitive data should not be used in the ARG or ENV commands

SecretsUsedInArgOrEnv: Do not use ARG or ENV instructions for sensitive data (ENV "DOCKER_ENV_PASSWORD") More info: https://docs.docker.com/go/dockerfile/rule/secrets-used-in-arg-or-env/
ENV AZURE_KEY_VAULT_ENABLED=false

Check warning on line 19 in Dockerfile

View workflow job for this annotation

GitHub Actions / build-preview

Sensitive data should not be used in the ARG or ENV commands

SecretsUsedInArgOrEnv: Do not use ARG or ENV instructions for sensitive data (ENV "AZURE_KEY_VAULT_ENABLED") More info: https://docs.docker.com/go/dockerfile/rule/secrets-used-in-arg-or-env/
ENV CHALLENGE59_SLACK_WEBHOOK_URL=$challenge59_webhook_url
ENV WRONGSECRETS_MCP_SECRET=MCPStolenSecret42!

Check warning on line 21 in Dockerfile

View workflow job for this annotation

GitHub Actions / build-preview

Sensitive data should not be used in the ARG or ENV commands

SecretsUsedInArgOrEnv: Do not use ARG or ENV instructions for sensitive data (ENV "WRONGSECRETS_MCP_SECRET") More info: https://docs.docker.com/go/dockerfile/rule/secrets-used-in-arg-or-env/
ENV SPRINGDOC_UI=false
ENV SPRINGDOC_DOC=false
ENV BASTIONHOSTPATH="/home/wrongsecrets/.ssh"
Expand Down Expand Up @@ -71,4 +71,4 @@
RUN adduser -u 2000 -D wrongsecrets
USER wrongsecrets

CMD java -jar -XX:SharedArchiveFile=application.jsa -Dspring.profiles.active=$(echo ${SPRING_PROFILES_ACTIVE}) -Dspringdoc.swagger-ui.enabled=${SPRINGDOC_UI} -Dspringdoc.api-docs.enabled=${SPRINGDOC_DOC} -D application.jar

Check warning on line 74 in Dockerfile

View workflow job for this annotation

GitHub Actions / build-preview

JSON arguments recommended for ENTRYPOINT/CMD to prevent unintended behavior related to OS signals

JSONArgsRecommended: JSON arguments recommended for CMD to prevent unintended behavior related to OS signals More info: https://docs.docker.com/go/dockerfile/rule/json-args-recommended/
4 changes: 2 additions & 2 deletions Dockerfile.web
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM jeroenwillemsen/wrongsecrets:1.13.1-alpha11-no-vault
ARG argBasedVersion="1.13.1-alpha11-no-vault"
FROM jeroenwillemsen/wrongsecrets:1.13.1-alpha6-no-vault
ARG argBasedVersion="1.13.1-alpha6-no-vault"
ARG spring_profile="without-vault"
ARG CANARY_URLS="http://canarytokens.com/terms/about/s7cfbdakys13246ewd8ivuvku/post.jsp,http://canarytokens.com/terms/about/y0all60b627gzp19ahqh7rl6j/post.jsp"
ARG CTF_ENABLED=false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public ResponseEntity<String> handleWebhook(
}

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

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

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

private String sanitizeForLog(String value) {
if (value == null) {
return "null";
}
return value.replaceAll("[\r\n]", "_");
}

private String getBotToken() {
// Same double-encoded bot token as in Challenge61
String encodedToken =
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ spring.web.resources.cache.period=PT2H
server.compression.enabled=true
spring.config.import=classpath:/wrong-secrets-configuration.yaml

# Challenge61: Disable webhook by default (memory intensive on Heroku). Enable in profile if needed.
password=ThisEnvironmentIsAnotherPlaceToHide
challenge61.webhook.enabled=false
SPECIAL_K8S_SECRET=if_you_see_this_please_use_k8s
SPECIAL_SPECIAL_K8S_SECRET=if_you_see_this_please_use_k8s
Expand Down