Skip to content

fix: create the XXE levels' solution files on startup (#654) - #1000

Open
ismisepaul wants to merge 1 commit into
devfrom
dev#654-xxe-solution-files
Open

ismisepaul wants to merge 1 commit into
devfrom
dev#654-xxe-solution-files

Conversation

@ismisepaul

Copy link
Copy Markdown
Member

Fixes #654.

What

The XXE lesson and XXE challenge 1 ask players to read a file from the server (briefcase.pulp / json.xml, from fileSystemKeys.properties). Only two paths created those files: setup with "unsafe levels" ticked, and "Open all modules" with unsafe levels enabled. Opening the levels any other way left them unsolvable, because the file wasn't there. That includes Open and Close Modules, Open or Close by Category, and a container recreated after setup.

DatabaseLifecycleListener now creates both files when the application starts. This is done in its own try/catch, so a failure is logged and doesn't affect the database start-up. The existing call sites are unchanged. The levels themselves aren't touched.

Tests

DatabaseLifecycleListenerTest.testContextInitializedCreatesXxeSolutionFiles deletes both files, runs contextInitialized, and checks that each file exists with the solution from fileSystemKeys.properties. It fails on dev (briefcase.pulp was not created) and passes with the fix. An @AfterEach removes the files, because every test in the class that calls contextInitialized now writes them into the working directory.

Every step of test.yml passed locally (lint, build, PGP check, compose build, Tomcat config check, unit tests, integration tests).

🤖 Generated with Claude Code

The XXE lesson and challenge ask players to read a file from the server.
Only setup and "open all modules" with unsafe levels created those
files, so opening the levels from Open/Close Modules or by category left
them unsolvable, and so did a container that was recreated after setup.
Create both files when the application starts, as well as where they
were already created.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ismisepaul ismisepaul added this to the 4.0.0 milestone Oct 25, 2026
Copilot AI balanced review requested due to automatic review settings October 25, 2026 00:10
@ismisepaul ismisepaul moved this from Backlog to Next Release Backlog in Security Shepherd Oct 25, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The focused change reuses existing helpers, isolates startup error handling, and includes regression coverage with no unresolved findings.

No open issues 🎉

What changed in this PR

Fixes #654 by creating both XXE solution files at application startup, so the levels remain solvable regardless of how they are opened or whether the container is recreated.

Changes:

  • Reuses existing file-creation helpers in the lifecycle listener, with separate error handling from database initialization.
  • Adds regression coverage for both files’ existence and contents, plus cleanup after each test.
File Description
src/​test/​java/​listeners/​DatabaseLifecycleListenerTest.java Verifies both solution files are created correctly and cleans them up after tests.
src/​main/​java/​listeners/​DatabaseLifecycleListener.java Creates both XXE solution files during application startup.

Review effort: Balanced

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Next Release Backlog

Development

Successfully merging this pull request may close these issues.

[BUG] XXE levels don't create solution file when opened

2 participants