fix: secure training page mutations - #145
Open
smithynb wants to merge 1 commit into
Open
Conversation
Require authoritative roles for training-page creation, updates, and deletion while keeping intended public reads available. Split create and update into validated transactional flows, enforce internal-page visibility, and make the client handle rejected writes safely.
Contributor
Author
|
Closed CodeQL warnings about rate limiting since we are not to handle it at the app level. |
smithynb
marked this pull request as ready for review
July 30, 2026 18:53
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.
Summary
PATCH /api/training/:pageIdRoot cause
The training router was mounted without authentication or authorization on its write endpoints. In addition,
POST /api/trainingdoubled as an overwrite operation: it deleted an existing page by name before validating and inserting the replacement. An anonymous malformed request could therefore delete a training page even when the request ultimately returned an error.This change makes POST create-only, moves updates to an authorized PATCH route, and wraps page/item persistence in transactions so failed writes do not leave destructive partial state.
Validation
git diff --check dev...HEADResolves #144