Repository navigation
fix: create the XXE levels' solution files on startup (#654) - #1000
Open
ismisepaul wants to merge 1 commit into
Open
ismisepaul wants to merge 1 commit into
ismisepaul wants to merge 1 commit into
Conversation
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>
Contributor
There was a problem hiding this comment.
🟢 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #654.
What
The XXE lesson and XXE challenge 1 ask players to read a file from the server (
briefcase.pulp/json.xml, fromfileSystemKeys.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.DatabaseLifecycleListenernow 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.testContextInitializedCreatesXxeSolutionFilesdeletes both files, runscontextInitialized, and checks that each file exists with the solution fromfileSystemKeys.properties. It fails ondev(briefcase.pulp was not created) and passes with the fix. An@AfterEachremoves the files, because every test in the class that callscontextInitializednow writes them into the working directory.Every step of
test.ymlpassed locally (lint, build, PGP check, compose build, Tomcat config check, unit tests, integration tests).🤖 Generated with Claude Code