fix: SQL injection, XSS, and CSRF security hardening#314
Merged
Conversation
…er (wd-7rl) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…arse (wd-9fq) - Always encodeForHTML() comment content and blog titles server-side - Remove unreliable markdown detection heuristic - Add DOMPurify sanitization before marked.parse innerHTML injection - Encode admin comment view outputs Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add global htmx:configRequest listener to auto-inject CSRF token on non-GET requests - Add authenticityToken to bookmark.js and reading-tracker.js fetch POST calls - Add CSRF tokens to blog show.cfm hx-post elements Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…Controller, DOMPurify lib, CSRF meta tags, fullName XSS - Parameterize all remaining where= string interpolation in AuthController (12 locations), BlogController (5 locations), and Controller (8 locations) - Add purify.min.js (DOMPurify 3.2.4) to public/javascripts/lib/ - Add <meta name="csrf-token"> to both layout.cfm and admin layout.cfm - Encode fullName in show.cfm comment rendering (lines 139, 192) - Add authenticityToken to bookmark.js and reading-tracker.js fetch body params Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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
where=string interpolation across AuthController (12), BlogController (5), Controller (8), NewsletterController (4), RolesController (4), BookmarkController, ReadingHistoryController, LoginAttempt, PasswordReset, and RememberToken modelsencodeForHTML()to all user content output (comments, blog titles, author names), removed unreliable markdown detection heuristic, added DOMPurify sanitization beforemarked.parse()innerHTML injectionhtmx:configRequestlistener for auto-injecting CSRF tokens on non-GET HTMX requests, added<meta name="csrf-token">to both layouts, addedauthenticityTokento fetch POST calls in bookmark.js and reading-tracker.jsFiles changed (17)
Controllers — parameterized SQL:
app/controllers/Controller.cfcapp/controllers/web/AuthController.cfcapp/controllers/web/BlogController.cfcapp/controllers/admin/NewsletterController.cfcapp/controllers/admin/RolesController.cfcapp/controllers/web/BookmarkController.cfcapp/controllers/web/ReadingHistoryController.cfcModels — parameterized SQL:
app/models/LoginAttempt.cfcapp/models/PasswordReset.cfcapp/models/RememberToken.cfcViews — XSS + CSRF:
app/views/layout.cfm— DOMPurify script + CSRF meta tagapp/views/admin/AdminController/layout.cfm— DOMPurify script + CSRF meta tagapp/views/admin/AdminController/partials/_commentView.cfm— encodeForHTMLapp/views/web/BlogController/partials/_comment.cfm— encodeForHTMLapp/views/web/BlogController/show.cfm— encodeForHTML + CSRF tokensJavaScript — CSRF + DOMPurify:
public/javascripts/adminglobal.js— CSRF auto-injector + DOMPurifypublic/javascripts/bookmark.js— CSRF token in fetch bodypublic/javascripts/global.js— CSRF auto-injector + DOMPurifypublic/javascripts/reading-tracker.js— CSRF token in fetch bodypublic/javascripts/showBlog.js— DOMPurifypublic/javascripts/lib/purify.min.js— new (DOMPurify 3.2.4)Test plan
🤖 Generated with Claude Code