Harden admin mutations and calendar color rendering#274
Open
AnnoyingTechnology wants to merge 2 commits into
Open
Harden admin mutations and calendar color rendering#274AnnoyingTechnology wants to merge 2 commits into
AnnoyingTechnology wants to merge 2 commits into
Conversation
Calendar colors written through DAV bypass Symfony validation, and SQLite does not enforce the declared VARCHAR length. Rendering those stored values directly in an inline style therefore permits CSS declaration injection in the admin interface. Allow only exact #RRGGBB and #RRGGBBAA values at the rendering boundary and omit the style attribute otherwise. This also protects existing records and all current write paths. A follow-up should validate calendar colors on each write path so malformed values are rejected instead of being stored inertly.
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.
Why
Several browser-admin actions currently mutate state through unrestricted routes, with some invoked through GET requests. Because these custom actions sit outside Symfony Forms, they also bypass the built-in CSRF protection.
Calendar colors can also be written through DAV without Symfony validation and are rendered directly into inline CSS. SQLite does not enforce the declared
VARCHARlength, so the database schema does not bound that value.This PR establishes the standard boundary for the admin interface: reads use GET, form handlers use GET/POST, state-changing actions require POST with a valid CSRF token, and stored calendar colors are allowlisted before entering a CSS context.
The rendering check closes the CSS sink for existing data and every current write path. Validating colors when they are written remains a desirable follow-up so malformed values are rejected instead of being stored inertly.
What changed
#RRGGBBor#RRGGBBAADAV and API endpoints are unchanged; they retain their existing protocol-specific authentication, storage behavior, and HTTP methods.
Verification