Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Jul 29, 2025

This PR implements Challenge 58, demonstrating a critical real-world vulnerability: database connection strings with embedded credentials exposed through poor error handling.

Challenge 58: Database Connection String Exposure

Category: Logging
Difficulty: Normal (⭐⭐⭐)
Target Secret: SuperSecretDB2024!

The challenge simulates a PostgreSQL connection failure that exposes the full connection string with embedded credentials through both HTTP error responses and application logs. Users access the vulnerable endpoint /error-demo/database-connection to trigger the error scenario.

Educational Value

This challenge addresses one of the most common and dangerous ways secrets leak in production applications:

  • Database connection failures during application startup
  • Health check failures in container orchestration environments
  • CI/CD pipeline logs where database connections fail
  • Error tracking services (Sentry, Rollbar, CloudWatch)
  • Development environments with verbose error reporting

Implementation Details

  • Complete challenge infrastructure: Java implementation, configuration, tests, and documentation
  • Comprehensive Cypress tests: End-to-end testing covering challenge interaction and secret extraction
  • Template files: HTML snippet for challenge interface with database error demo
  • Educational documentation: Hints, explanations, and vulnerability reasoning
  • GitHub Pages preview: Static preview generation for the latest challenge

This implementation follows existing project patterns and maintains the educational focus on helping developers recognize and prevent database credential exposure through error messages.

Technical Changes

  • Added Challenge 58 class and controller for database connection simulation
  • Created template files and Cypress tests for complete challenge infrastructure
  • Updated configuration to include Challenge 58 in logging category
  • Enhanced preview generation with Challenge 58 as featured latest challenge
  • Fixed formatting issues to pass all pre-commit checks

The challenge demonstrates realistic error scenarios that developers encounter in production, making it highly valuable for security awareness training.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

…rror Messages

Co-authored-by: commjoen <1457214+commjoen@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] Copilot challenge Add Challenge 57: Database Connection String Exposure through Error Messages Jul 29, 2025
@Copilot Copilot AI requested a review from commjoen July 29, 2025 20:54
Copilot finished work on behalf of commjoen July 29, 2025 20:54
@commjoen
Copy link
Collaborator

@copilot some workflows fail, can you adjust the code accordingly please?

Copy link

🔨 Preview Build Complete!

Your changes have been built and pushed to GitHub Container Registry.

🐳 Docker Image: ghcr.io/owasp/wrongsecrets/wrongsecrets-pr:pr-2123-2497023

📦 Download & Test Locally:

  1. 📁 Download Docker Image Artifact (look for wrongsecrets-preview-pr-2123)
  2. Load and run the image:
# Download the artifact, extract it, then:
docker load < wrongsecrets-preview.tar
docker run -p 8080:8080 wrongsecrets-preview

🚀 Alternative - Pull from Registry:

docker pull ghcr.io/owasp/wrongsecrets/wrongsecrets-pr:pr-2123-2497023
docker run -p 8080:8080 ghcr.io/owasp/wrongsecrets/wrongsecrets-pr:pr-2123-2497023

Then visit: http://localhost:8080

📝 Changes in this PR:
- src/main/java/org/owasp/wrongsecrets/challenges/docker/Challenge57.java
- src/main/java/org/owasp/wrongsecrets/challenges/docker/Challenge57Controller.java
- src/main/resources/explanations/challenge57.adoc
- src/main/resources/explanations/challenge57_hint.adoc
- src/main/resources/explanations/challenge57_reason.adoc

Visual diff screenshots will be available shortly...


Preview built by GitHub Actions

Copy link

🔨 Preview Build Complete!

Your changes have been built and pushed to GitHub Container Registry.

🐳 Docker Image: ghcr.io/owasp/wrongsecrets/wrongsecrets-pr:pr-2123-2497023

📦 Download & Test Locally:

  1. 📁 Download Docker Image Artifact (look for wrongsecrets-preview-pr-2123)
  2. Load and run the image:
# Download the artifact, extract it, then:
docker load < wrongsecrets-preview.tar
docker run -p 8080:8080 wrongsecrets-preview

🚀 Alternative - Pull from Registry:

docker pull ghcr.io/owasp/wrongsecrets/wrongsecrets-pr:pr-2123-2497023
docker run -p 8080:8080 ghcr.io/owasp/wrongsecrets/wrongsecrets-pr:pr-2123-2497023

Then visit: http://localhost:8080

📝 Changes in this PR:
- src/main/java/org/owasp/wrongsecrets/challenges/docker/Challenge57.java
- src/main/java/org/owasp/wrongsecrets/challenges/docker/Challenge57Controller.java
- src/main/resources/explanations/challenge57.adoc
- src/main/resources/explanations/challenge57_hint.adoc
- src/main/resources/explanations/challenge57_reason.adoc

Visual diff screenshots will be available shortly...


Preview built by GitHub Actions

Copy link

📸 Visual Diff Ready!

Screenshots comparing your changes with the main branch are available:

📁 Download Visual Diff Artifacts

🖼️ Included screenshots:

  • pr-home.png vs main-home.png - Welcome page comparison
  • pr-about.png vs main-about.png - About page comparison
  • pr-challenge.png vs main-challenge.png - Challenge page comparison

🔍 How to review:

  1. Download the artifact zip file
  2. Extract and compare the pr-* and main-* images side by side
  3. Look for visual differences in layout, styling, and content

💡 Tip: Use an image comparison tool or open both images in separate browser tabs to spot differences easily.


Visual diff generated by GitHub Actions • PR #2123

Copy link

📸 Visual Diff Ready!

Screenshots comparing your changes with the main branch are available:

📁 Download Visual Diff Artifacts

🖼️ Included screenshots:

  • pr-home.png vs main-home.png - Welcome page comparison
  • pr-about.png vs main-about.png - About page comparison
  • pr-challenge.png vs main-challenge.png - Challenge page comparison

🔍 How to review:

  1. Download the artifact zip file
  2. Extract and compare the pr-* and main-* images side by side
  3. Look for visual differences in layout, styling, and content

💡 Tip: Use an image comparison tool or open both images in separate browser tabs to spot differences easily.


Visual diff generated by GitHub Actions • PR #2123

Co-authored-by: commjoen <1457214+commjoen@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jul 29, 2025

@copilot some workflows fail, can you adjust the code accordingly please?

Fixed the workflow failures - the issues were code formatting violations (spotless), trailing whitespace, and missing newlines at end of files. All formatting issues have been resolved in commit 372f123.

Copilot finished work on behalf of commjoen July 29, 2025 21:25
Copy link

🔨 Preview Build Complete!

Your changes have been built and pushed to GitHub Container Registry.

🐳 Docker Image: ghcr.io/owasp/wrongsecrets/wrongsecrets-pr:pr-2123-84e9448

📦 Download & Test Locally:

  1. 📁 Download Docker Image Artifact (look for wrongsecrets-preview-pr-2123)
  2. Load and run the image:
# Download the artifact, extract it, then:
docker load < wrongsecrets-preview.tar
docker run -p 8080:8080 wrongsecrets-preview

🚀 Alternative - Pull from Registry:

docker pull ghcr.io/owasp/wrongsecrets/wrongsecrets-pr:pr-2123-84e9448
docker run -p 8080:8080 ghcr.io/owasp/wrongsecrets/wrongsecrets-pr:pr-2123-84e9448

Then visit: http://localhost:8080

📝 Changes in this PR:
- src/main/java/org/owasp/wrongsecrets/challenges/docker/Challenge57.java
- src/main/java/org/owasp/wrongsecrets/challenges/docker/Challenge57Controller.java
- src/main/resources/explanations/challenge57.adoc
- src/main/resources/explanations/challenge57_hint.adoc
- src/main/resources/explanations/challenge57_reason.adoc

Visual diff screenshots will be available shortly...


Preview built by GitHub Actions

Copy link

📸 Visual Diff Ready!

Screenshots comparing your changes with the main branch are available:

📁 Download Visual Diff Artifacts

🖼️ Included screenshots:

  • pr-home.png vs main-home.png - Welcome page comparison
  • pr-about.png vs main-about.png - About page comparison
  • pr-challenge.png vs main-challenge.png - Challenge page comparison

🔍 How to review:

  1. Download the artifact zip file
  2. Extract and compare the pr-* and main-* images side by side
  3. Look for visual differences in layout, styling, and content

💡 Tip: Use an image comparison tool or open both images in separate browser tabs to spot differences easily.


Visual diff generated by GitHub Actions • PR #2123

@commjoen commjoen marked this pull request as ready for review July 30, 2025 07:32
@commjoen commjoen requested a review from bendehaan as a code owner July 30, 2025 07:32
Copy link

🌐 GitHub Pages Preview Ready!

Your static preview is now available at:
🔗 Preview PR #2123

📄 What's included:

  • ✅ All CSS, JavaScript, and static assets
  • ✅ Current styling and layout preview
  • ✅ Images, icons, and UI components
  • ⚠️ Limited dynamic functionality (static preview only)

For full functionality testing: Use the Docker preview instead.

🔄 Auto-updates: This preview will be updated automatically when you push new commits to this PR.


Static preview generated by GitHub Actions

Copy link

🔨 Preview Build Complete!

Your changes have been built and pushed to GitHub Container Registry.

🐳 Docker Image: ghcr.io/owasp/wrongsecrets/wrongsecrets-pr:pr-2123-ec4e504

📦 Download & Test Locally:

  1. 📁 Download Docker Image Artifact (look for wrongsecrets-preview-pr-2123)
  2. Load and run the image:
# Download the artifact, extract it, then:
docker load < wrongsecrets-preview.tar
docker run -p 8080:8080 wrongsecrets-preview

🚀 Alternative - Pull from Registry:

docker pull ghcr.io/owasp/wrongsecrets/wrongsecrets-pr:pr-2123-ec4e504
docker run -p 8080:8080 ghcr.io/owasp/wrongsecrets/wrongsecrets-pr:pr-2123-ec4e504

Then visit: http://localhost:8080

📝 Changes in this PR:
- src/main/java/org/owasp/wrongsecrets/challenges/docker/Challenge57.java
- src/main/java/org/owasp/wrongsecrets/challenges/docker/Challenge57Controller.java
- src/main/resources/explanations/challenge57.adoc
- src/main/resources/explanations/challenge57_hint.adoc
- src/main/resources/explanations/challenge57_reason.adoc

Visual diff screenshots will be available shortly...


Preview built by GitHub Actions

Copy link

📸 Visual Diff Ready!

Screenshots comparing your changes with the main branch are available:

📁 Download Visual Diff Artifacts

🖼️ Included screenshots:

  • pr-home.png vs main-home.png - Welcome page comparison
  • pr-about.png vs main-about.png - About page comparison
  • pr-challenge.png vs main-challenge.png - Challenge page comparison

🔍 How to review:

  1. Download the artifact zip file
  2. Extract and compare the pr-* and main-* images side by side
  3. Look for visual differences in layout, styling, and content

💡 Tip: Use an image comparison tool or open both images in separate browser tabs to spot differences easily.


Visual diff generated by GitHub Actions • PR #2123

Copy link

🔨 Preview Build Complete!

Your changes have been built and pushed to GitHub Container Registry.

🐳 Docker Image: ghcr.io/owasp/wrongsecrets/wrongsecrets-pr:pr-2123-3c1e226

📦 Download & Test Locally:

  1. 📁 Download Docker Image Artifact (look for wrongsecrets-preview-pr-2123)
  2. Load and run the image:
# Download the artifact, extract it, then:
docker load < wrongsecrets-preview.tar
docker run -p 8080:8080 wrongsecrets-preview

🚀 Alternative - Pull from Registry:

docker pull ghcr.io/owasp/wrongsecrets/wrongsecrets-pr:pr-2123-3c1e226
docker run -p 8080:8080 ghcr.io/owasp/wrongsecrets/wrongsecrets-pr:pr-2123-3c1e226

Then visit: http://localhost:8080

📝 Changes in this PR:
- src/main/java/org/owasp/wrongsecrets/challenges/docker/Challenge58.java
- src/main/java/org/owasp/wrongsecrets/challenges/docker/Challenge58Controller.java
- src/main/resources/explanations/challenge58.adoc
- src/main/resources/explanations/challenge58_hint.adoc
- src/main/resources/explanations/challenge58_reason.adoc

Visual diff screenshots will be available shortly...


Preview built by GitHub Actions

Copy link

🔨 Preview Build Complete!

Your changes have been built and pushed to GitHub Container Registry.

🐳 Docker Image: ghcr.io/owasp/wrongsecrets/wrongsecrets-pr:pr-2123-939bc5f

📦 Download & Test Locally:

  1. 📁 Download Docker Image Artifact (look for wrongsecrets-preview-pr-2123)
  2. Load and run the image:
# Download the artifact, extract it, then:
docker load < wrongsecrets-preview.tar
docker run -p 8080:8080 wrongsecrets-preview

🚀 Alternative - Pull from Registry:

docker pull ghcr.io/owasp/wrongsecrets/wrongsecrets-pr:pr-2123-939bc5f
docker run -p 8080:8080 ghcr.io/owasp/wrongsecrets/wrongsecrets-pr:pr-2123-939bc5f

Then visit: http://localhost:8080

📝 Changes in this PR:
- src/main/java/org/owasp/wrongsecrets/challenges/docker/Challenge58.java
- src/main/java/org/owasp/wrongsecrets/challenges/docker/Challenge58Controller.java
- src/main/resources/explanations/challenge58.adoc
- src/main/resources/explanations/challenge58_hint.adoc
- src/main/resources/explanations/challenge58_reason.adoc

Visual diff screenshots will be available shortly...


Preview built by GitHub Actions

Copy link

📸 Visual Diff Ready!

Screenshots comparing your changes with the main branch are available:

📁 Download Visual Diff Artifacts

🖼️ Included screenshots:

  • pr-home.png vs main-home.png - Welcome page comparison
  • pr-about.png vs main-about.png - About page comparison
  • pr-challenge.png vs main-challenge.png - Challenge page comparison

🔍 How to review:

  1. Download the artifact zip file
  2. Extract and compare the pr-* and main-* images side by side
  3. Look for visual differences in layout, styling, and content

💡 Tip: Use an image comparison tool or open both images in separate browser tabs to spot differences easily.


Visual diff generated by GitHub Actions • PR #2123

Copy link

📸 Visual Diff Ready!

Screenshots comparing your changes with the main branch are available:

📁 Download Visual Diff Artifacts

🖼️ Included screenshots:

  • pr-home.png vs main-home.png - Welcome page comparison
  • pr-about.png vs main-about.png - About page comparison
  • pr-challenge.png vs main-challenge.png - Challenge page comparison

🔍 How to review:

  1. Download the artifact zip file
  2. Extract and compare the pr-* and main-* images side by side
  3. Look for visual differences in layout, styling, and content

💡 Tip: Use an image comparison tool or open both images in separate browser tabs to spot differences easily.


Visual diff generated by GitHub Actions • PR #2123

Copy link

🌐 GitHub Pages Preview Ready!

Your static preview is now available at:
🔗 Preview PR #2123

📄 What's included:

For full functionality testing: Use the Docker preview instead.

🔄 Auto-updates: This preview will be updated automatically when you push new commits to this PR.


Static preview with Thymeleaf generation by GitHub Actions

Copy link

🔨 Preview Build Complete!

Your changes have been built and pushed to GitHub Container Registry.

🐳 Docker Image: ghcr.io/owasp/wrongsecrets/wrongsecrets-pr:pr-2123-8e96e74

📦 Download & Test Locally:

  1. 📁 Download Docker Image Artifact (look for wrongsecrets-preview-pr-2123)
  2. Load and run the image:
# Download the artifact, extract it, then:
docker load < wrongsecrets-preview.tar
docker run -p 8080:8080 wrongsecrets-preview

🚀 Alternative - Pull from Registry:

docker pull ghcr.io/owasp/wrongsecrets/wrongsecrets-pr:pr-2123-8e96e74
docker run -p 8080:8080 ghcr.io/owasp/wrongsecrets/wrongsecrets-pr:pr-2123-8e96e74

Then visit: http://localhost:8080

📝 Changes in this PR:
- src/main/java/org/owasp/wrongsecrets/challenges/docker/Challenge58.java
- src/main/java/org/owasp/wrongsecrets/challenges/docker/Challenge58Controller.java
- src/main/resources/explanations/challenge58.adoc
- src/main/resources/explanations/challenge58_hint.adoc
- src/main/resources/explanations/challenge58_reason.adoc

Visual diff screenshots will be available shortly...


Preview built by GitHub Actions

Copy link

📸 Visual Diff Ready!

Screenshots comparing your changes with the main branch are available:

📁 Download Visual Diff Artifacts

🖼️ Included screenshots:

  • pr-home.png vs main-home.png - Welcome page comparison
  • pr-about.png vs main-about.png - About page comparison
  • pr-challenge.png vs main-challenge.png - Challenge page comparison

🔍 How to review:

  1. Download the artifact zip file
  2. Extract and compare the pr-* and main-* images side by side
  3. Look for visual differences in layout, styling, and content

💡 Tip: Use an image comparison tool or open both images in separate browser tabs to spot differences easily.


Visual diff generated by GitHub Actions • PR #2123

@commjoen commjoen marked this pull request as ready for review August 23, 2025 21:29
Copy link

🌐 GitHub Pages Preview Ready!

Your static preview is now available at:
🔗 Preview PR #2123

📄 What's included:

For full functionality testing: Use the Docker preview instead.

🔄 Auto-updates: This preview will be updated automatically when you push new commits to this PR.


Static preview with Thymeleaf generation by GitHub Actions

Copy link

🔨 Preview Build Complete!

Your changes have been built and pushed to GitHub Container Registry.

🐳 Docker Image: ghcr.io/owasp/wrongsecrets/wrongsecrets-pr:pr-2123-e7c9f8c

📦 Download & Test Locally:

  1. 📁 Download Docker Image Artifact (look for wrongsecrets-preview-pr-2123)
  2. Load and run the image:
# Download the artifact, extract it, then:
docker load < wrongsecrets-preview.tar
docker run -p 8080:8080 wrongsecrets-preview

🚀 Alternative - Pull from Registry:

docker pull ghcr.io/owasp/wrongsecrets/wrongsecrets-pr:pr-2123-e7c9f8c
docker run -p 8080:8080 ghcr.io/owasp/wrongsecrets/wrongsecrets-pr:pr-2123-e7c9f8c

Then visit: http://localhost:8080

📝 Changes in this PR:
- src/main/java/org/owasp/wrongsecrets/challenges/docker/Challenge58.java
- src/main/java/org/owasp/wrongsecrets/challenges/docker/Challenge58Controller.java
- src/main/resources/explanations/challenge58.adoc
- src/main/resources/explanations/challenge58_hint.adoc
- src/main/resources/explanations/challenge58_reason.adoc

Visual diff screenshots will be available shortly...


Preview built by GitHub Actions

Copy link

📸 Visual Diff Ready!

Screenshots comparing your changes with the main branch are available:

📁 Download Visual Diff Artifacts

🖼️ Included screenshots:

  • pr-home.png vs main-home.png - Welcome page comparison
  • pr-about.png vs main-about.png - About page comparison
  • pr-challenge.png vs main-challenge.png - Challenge page comparison

🔍 How to review:

  1. Download the artifact zip file
  2. Extract and compare the pr-* and main-* images side by side
  3. Look for visual differences in layout, styling, and content

💡 Tip: Use an image comparison tool or open both images in separate browser tabs to spot differences easily.


Visual diff generated by GitHub Actions • PR #2123

Copy link

🌐 GitHub Pages Preview Ready!

Your static preview is now available at:
🔗 Preview PR #2123

📄 What's included:

For full functionality testing: Use the Docker preview instead.

🔄 Auto-updates: This preview will be updated automatically when you push new commits to this PR.


Static preview with Thymeleaf generation by GitHub Actions

Copy link

🔨 Preview Build Complete!

Your changes have been built and pushed to GitHub Container Registry.

🐳 Docker Image: ghcr.io/owasp/wrongsecrets/wrongsecrets-pr:pr-2123-8b2168e

📦 Download & Test Locally:

  1. 📁 Download Docker Image Artifact (look for wrongsecrets-preview-pr-2123)
  2. Load and run the image:
# Download the artifact, extract it, then:
docker load < wrongsecrets-preview.tar
docker run -p 8080:8080 wrongsecrets-preview

🚀 Alternative - Pull from Registry:

docker pull ghcr.io/owasp/wrongsecrets/wrongsecrets-pr:pr-2123-8b2168e
docker run -p 8080:8080 ghcr.io/owasp/wrongsecrets/wrongsecrets-pr:pr-2123-8b2168e

Then visit: http://localhost:8080

📝 Changes in this PR:
- src/main/java/org/owasp/wrongsecrets/challenges/docker/Challenge58.java
- src/main/java/org/owasp/wrongsecrets/challenges/docker/Challenge58Controller.java
- src/main/resources/explanations/challenge58.adoc
- src/main/resources/explanations/challenge58_hint.adoc
- src/main/resources/explanations/challenge58_reason.adoc

Visual diff screenshots will be available shortly...


Preview built by GitHub Actions

Copy link

📸 Visual Diff Ready!

Screenshots comparing your changes with the main branch are available:

📁 Download Visual Diff Artifacts

🖼️ Included screenshots:

  • pr-home.png vs main-home.png - Welcome page comparison
  • pr-about.png vs main-about.png - About page comparison
  • pr-challenge.png vs main-challenge.png - Challenge page comparison

🔍 How to review:

  1. Download the artifact zip file
  2. Extract and compare the pr-* and main-* images side by side
  3. Look for visual differences in layout, styling, and content

💡 Tip: Use an image comparison tool or open both images in separate browser tabs to spot differences easily.


Visual diff generated by GitHub Actions • PR #2123

Copy link

🌐 GitHub Pages Preview Ready!

Your static preview is now available at:
🔗 Preview PR #2123

📄 What's included:

For full functionality testing: Use the Docker preview instead.

🔄 Auto-updates: This preview will be updated automatically when you push new commits to this PR.


Static preview with Thymeleaf generation by GitHub Actions

Copy link

🔨 Preview Build Complete!

Your changes have been built and pushed to GitHub Container Registry.

🐳 Docker Image: ghcr.io/owasp/wrongsecrets/wrongsecrets-pr:pr-2123-349a70a

📦 Download & Test Locally:

  1. 📁 Download Docker Image Artifact (look for wrongsecrets-preview-pr-2123)
  2. Load and run the image:
# Download the artifact, extract it, then:
docker load < wrongsecrets-preview.tar
docker run -p 8080:8080 wrongsecrets-preview

🚀 Alternative - Pull from Registry:

docker pull ghcr.io/owasp/wrongsecrets/wrongsecrets-pr:pr-2123-349a70a
docker run -p 8080:8080 ghcr.io/owasp/wrongsecrets/wrongsecrets-pr:pr-2123-349a70a

Then visit: http://localhost:8080

📝 Changes in this PR:
- src/main/java/org/owasp/wrongsecrets/challenges/docker/Challenge58.java
- src/main/java/org/owasp/wrongsecrets/challenges/docker/Challenge58Controller.java
- src/main/resources/explanations/challenge58.adoc
- src/main/resources/explanations/challenge58_hint.adoc
- src/main/resources/explanations/challenge58_reason.adoc

Visual diff screenshots will be available shortly...


Preview built by GitHub Actions

Copy link

📸 Visual Diff Ready!

Screenshots comparing your changes with the main branch are available:

📁 Download Visual Diff Artifacts

🖼️ Included screenshots:

  • pr-home.png vs main-home.png - Welcome page comparison
  • pr-about.png vs main-about.png - About page comparison
  • pr-challenge.png vs main-challenge.png - Challenge page comparison

🔍 How to review:

  1. Download the artifact zip file
  2. Extract and compare the pr-* and main-* images side by side
  3. Look for visual differences in layout, styling, and content

💡 Tip: Use an image comparison tool or open both images in separate browser tabs to spot differences easily.


Visual diff generated by GitHub Actions • PR #2123

@commjoen commjoen merged commit ace6c83 into master Aug 29, 2025
19 of 20 checks passed
@commjoen commjoen deleted the copilot/fix-2122 branch August 29, 2025 10:49
Copy link

🧹 Preview Cleanup Complete

The static preview for this PR has been removed from GitHub Pages.

Thanks for contributing to WrongSecrets! 🎉


Cleanup completed by GitHub Actions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants