Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
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 .github/scripts/.bash_history
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ rm -rf jdk-18_linux-x64_bin.deb
git rebase -i main
git rebase -i master
git stash
export tempPassword="WJpj4Nv3UwapnVTOOZAaFO1XF5MFYkgGES2hc5SZCuc="
export tempPassword="eODAOPN4MwtQu6cpYZNs9Wqmj0yCp6AC1CsNYCmTaAA="
mvn run tempPassword
k6
npx k6
Expand Down
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:26-cds AS builder
WORKDIR /builder

ARG argBasedVersion="1.14.2"
ARG argBasedVersion="1.15.0RC1"

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

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 "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 20 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 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 "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 22 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 24 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/
ARG GOOGLE_SERVICE_ACCOUNT_KEY="if_you_see_this_configure_the_google_service_account_properly"

Check warning on line 25 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 (ARG "GOOGLE_SERVICE_ACCOUNT_KEY") More info: https://docs.docker.com/go/dockerfile/rule/secrets-used-in-arg-or-env/
ARG GOOGLE_DRIVE_DOCUMENT_ID="1PlZkwEd7GouyY4cdOxBuczm6XumQeuZN31LR2BXRgPs"
ENV GOOGLE_SERVICE_ACCOUNT_KEY=$GOOGLE_SERVICE_ACCOUNT_KEY

Check warning on line 27 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 "GOOGLE_SERVICE_ACCOUNT_KEY") More info: https://docs.docker.com/go/dockerfile/rule/secrets-used-in-arg-or-env/
ENV GOOGLE_DRIVE_DOCUMENT_ID=$GOOGLE_DRIVE_DOCUMENT_ID
ENV SPRINGDOC_UI=false
ENV SPRINGDOC_DOC=false
Expand Down Expand Up @@ -82,4 +82,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 85 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.14.2-no-vault
ARG argBasedVersion="1.14.2-no-vault"
FROM jeroenwillemsen/wrongsecrets:1.15.0RC1-no-vault
ARG argBasedVersion="1.15.0RC1-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
2 changes: 1 addition & 1 deletion aws/k8s/secret-challenge-vault-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ spec:
volumeAttributes:
secretProviderClass: "wrongsecrets-aws-secretsmanager"
containers:
- image: jeroenwillemsen/wrongsecrets:1.14.2-k8s-vault
- image: jeroenwillemsen/wrongsecrets:1.15.0RC1-k8s-vault
imagePullPolicy: IfNotPresent
name: secret-challenge
command: ["/bin/sh"]
Expand Down
2 changes: 1 addition & 1 deletion azure/k8s/secret-challenge-vault-deployment.yml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ spec:
volumeAttributes:
secretProviderClass: "azure-wrongsecrets-vault"
containers:
- image: jeroenwillemsen/wrongsecrets:1.14.2-k8s-vault
- image: jeroenwillemsen/wrongsecrets:1.15.0RC1-k8s-vault
imagePullPolicy: IfNotPresent
name: secret-challenge
command: ["/bin/sh"]
Expand Down
10 changes: 5 additions & 5 deletions docs/VERSION_MANAGEMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ The project maintains version consistency between:
## Version Schema

```
pom.xml version: 1.14.2-SNAPSHOT
Dockerfile version: 1.14.2
Dockerfile.web version: 1.14.2-no-vault
pom.xml version: 1.15.0RC1-SNAPSHOT
Dockerfile version: 1.15.0RC1
Dockerfile.web version: 1.15.0RC1-no-vault
```

## Automated Solutions
Expand Down Expand Up @@ -70,7 +70,7 @@ The `version-sync-check.yml` workflow:

1. **Update pom.xml version**:
```xml
<version>1.14.2-SNAPSHOT</version>
<version>1.15.0RC1-SNAPSHOT</version>
```

2. **Run sync script**:
Expand All @@ -86,7 +86,7 @@ The `version-sync-check.yml` workflow:
4. **Commit all changes**:
```bash
git add pom.xml Dockerfile Dockerfile.web
git commit -m "Bump version to 1.14.2"
git commit -m "Bump version to 1.15.0RC1"
```

## Workflow Integration
Expand Down
2 changes: 1 addition & 1 deletion fly.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ app = "wrongsecrets"
primary_region = "ams"

[build]
image = "docker.io/jeroenwillemsen/wrongsecrets:1.14.2-no-vault"
image = "docker.io/jeroenwillemsen/wrongsecrets:1.15.0RC1-no-vault"

[env]
K8S_ENV = "Fly(Docker)"
Expand Down
2 changes: 1 addition & 1 deletion gcp/k8s/secret-challenge-vault-deployment.yml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ spec:
volumeAttributes:
secretProviderClass: "wrongsecrets-gcp-secretsmanager"
containers:
- image: jeroenwillemsen/wrongsecrets:1.14.2-k8s-vault
- image: jeroenwillemsen/wrongsecrets:1.15.0RC1-k8s-vault
imagePullPolicy: IfNotPresent
name: secret-challenge
command: ["/bin/sh"]
Expand Down
2 changes: 1 addition & 1 deletion js/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

function secret() {
var password = "WE/BiIs=" + 9 + "fw0+" + 6 + "pTk=" + 2 + "ZHhR" + 7;
var password = "j0FN/QQ=" + 9 + "MfuX" + 6 + "uQU=" + 2 + "dwoN" + 7;
return password;
}
4 changes: 2 additions & 2 deletions k8s/challenge53/secret-challenge53-sidecar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ spec:
runAsGroup: 2000
fsGroup: 2000
containers:
- image: jeroenwillemsen/wrongsecrets-challenge53:1.14.2
- image: jeroenwillemsen/wrongsecrets-challenge53:1.15.0RC1
name: secret-challenge-53
imagePullPolicy: IfNotPresent
resources:
Expand All @@ -45,7 +45,7 @@ spec:
command: ["/bin/sh", "-c"]
args:
- cp /home/wrongsecrets/* /shared-data/ && exec /home/wrongsecrets/start-on-arch.sh
- image: jeroenwillemsen/wrongsecrets-challenge53-debug:1.14.2
- image: jeroenwillemsen/wrongsecrets-challenge53-debug:1.15.0RC1
name: sidecar
imagePullPolicy: IfNotPresent
command: ["/bin/sh", "-c", "while true; do ls /shared-data; sleep 10; done"]
Expand Down
2 changes: 1 addition & 1 deletion k8s/challenge53/secret-challenge53.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ spec:
runAsGroup: 2000
fsGroup: 2000
containers:
- image: jeroenwillemsen/wrongsecrets-challenge53:1.14.2
- image: jeroenwillemsen/wrongsecrets-challenge53:1.15.0RC1
name: secret-challenge-53
imagePullPolicy: IfNotPresent
resources:
Expand Down
2 changes: 1 addition & 1 deletion k8s/secret-challenge-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ spec:
runAsGroup: 2000
fsGroup: 2000
containers:
- image: jeroenwillemsen/wrongsecrets:1.14.2-no-vault
- image: jeroenwillemsen/wrongsecrets:1.15.0RC1-no-vault
imagePullPolicy: IfNotPresent
name: secret-challenge
ports:
Expand Down
2 changes: 1 addition & 1 deletion k8s/secret-challenge-vault-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ spec:
type: RuntimeDefault
serviceAccountName: vault
containers:
- image: jeroenwillemsen/wrongsecrets:1.14.2-k8s-vault
- image: jeroenwillemsen/wrongsecrets:1.15.0RC1-k8s-vault
imagePullPolicy: IfNotPresent
name: secret-challenge
command: ["/bin/sh"]
Expand Down
2 changes: 1 addition & 1 deletion okteto/k8s/secret-challenge-ctf-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ spec:
runAsGroup: 2000
fsGroup: 2000
containers:
- image: jeroenwillemsen/wrongsecrets:1.14.2-no-vault
- image: jeroenwillemsen/wrongsecrets:1.15.0RC1-no-vault
name: secret-challenge-ctf
imagePullPolicy: IfNotPresent
securityContext:
Expand Down
2 changes: 1 addition & 1 deletion okteto/k8s/secret-challenge-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ spec:
runAsGroup: 2000
fsGroup: 2000
containers:
- image: jeroenwillemsen/wrongsecrets:1.14.2-no-vault
- image: jeroenwillemsen/wrongsecrets:1.15.0RC1-no-vault
name: secret-challenge
imagePullPolicy: IfNotPresent
securityContext:
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<groupId>org.owasp</groupId>
<artifactId>wrongsecrets</artifactId>
<version>1.14.2-SNAPSHOT</version>
<version>1.15.0RC1-SNAPSHOT</version>

<name>OWASP WrongSecrets</name>
<description>Examples with how to not use secrets</description>
Expand Down
19 changes: 10 additions & 9 deletions src/main/java/org/owasp/wrongsecrets/MvcConfiguration.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.owasp.wrongsecrets;

import jakarta.annotation.PostConstruct;
import java.util.List;
import java.util.Locale;
import java.util.Set;
Expand Down Expand Up @@ -32,6 +33,12 @@
@Slf4j
public class MvcConfiguration implements WebMvcConfigurer {

@PostConstruct
public void init() {
// Force English as the default locale to prevent system locale from interfering
Locale.setDefault(Locale.ENGLISH);
}

/** Supported locales for the language toggle. */
public static final List<Locale> SUPPORTED_LOCALES =
List.of(
Expand All @@ -52,17 +59,11 @@ public LocaleResolver localeResolver() {
return sessionLocaleResolver;
}

/** Interceptor that reads the {@code lang} request parameter and updates the session locale. */
@Bean
public LocaleChangeInterceptor localeChangeInterceptor() {
LocaleChangeInterceptor localeChangeInterceptor = new LocaleChangeInterceptor();
localeChangeInterceptor.setParamName("lang");
return localeChangeInterceptor;
}

@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(localeChangeInterceptor());
LocaleChangeInterceptor localeChangeInterceptor = new LocaleChangeInterceptor();
localeChangeInterceptor.setParamName("lang");
registry.addInterceptor(localeChangeInterceptor);
}

@Bean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public void doFilter(ServletRequest request, ServletResponse response, FilterCha
httpServletResponse.setHeader(
"Content-Security-Policy",
"default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self'"
+ " 'unsafe-inline'; img-src 'self' data:; connect-src https://api.github.com;"
+ " 'unsafe-inline'; img-src 'self' data:; connect-src 'self' https://api.github.com;"
+ " frame-ancestors 'self'; object-src 'none'; base-uri 'self'");
}
chain.doFilter(request, response);
Expand Down
Loading
Loading