No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
CrowderSoup/vTodo!117
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "claude/csp"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Merge after #114, #115 and #116. This branch is built on all three, because they add
onclickhandlers this policy would block, and it depends on #115's self-hosted scripts. Until they're merged, this PR's diff includes their commits too. After that, it's just the last commit.Before
settings.pyhad a policy underCONTENT_SECURITY_POLICY["DIRECTIVES"], which is the setting name and shape the third-party django-csp package used. Django 6's built-in middleware readsSECURE_CSP, and it wasn't inMIDDLEWAREanyway. Production sent no CSP header.Now
'unsafe-inline', so injected markup can't run code.style=""stays allowed: a few templates set colours that way, and EasyMDE sets styles as it draws.form-action. Sign-in (Google, OpenID Connect) and the MCP OAuth consent page redirect off-site, and Chrome appliesform-actionto those redirects.What changed to make it fit
static/theme.js. It still loads before the page draws, so there's no flash of the wrong theme.onclick=,onchange=andhx-on::after-requestbecomes adata-*attribute handled once inapp.js:data-close-panel,data-opens-panel,data-closes-panel,data-new-task,data-theme-choicedata-confirm(the Google Calendar disconnect),data-submit-on-change(member role),data-load-saved-view,data-reset-after(the agent form)htmx-configsetsallowEval: false, since nothing usesjs:values orhx-onnow, and turns off htmx's injected indicator<style>, which nothing uses.Tests
tests/test_csp.pychecks the header. It also fails if any template brings back an inline<script>, anon*=handler orhx-on, so a new one can't silently stop working.tests/browser/test_csp_browser.pywalks My work, List, Board, Calendar and Settings, then opens, closes and completes a task in the panel and switches the theme. It fails on any CSP violation in the console."() => …"). A bare string expression iseval'd in the page, which the policy now blocks.Checked by hand in the browser too: every page loads with no violations, and New task (board and My work), the panel close button, Mark complete and the theme switch all work.
After deploy, worth checking once: sign in with Google and with Pocket ID, and connect Claude over MCP OAuth. Those flows go through pages the tests don't fully drive.
🤖 Generated with Claude Code
My work is where vTodo opens, but it had no way to add a task. It now has the same New task button as List, Board and Calendar. The task goes in the active workspace, which the panel names ("New task in Personal"), and the answer is My work's list, so the page stays put. The button clears the workspace the panel was last pointed at, so opening a Chores task from My work and then clicking New task doesn't file the new one in Chores. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>