Open
Conversation
Add nova_csrf_plugin using the synchronizer token pattern — generates a random token per session, stores it server-side, and validates it on state-changing requests (POST/PUT/PATCH/DELETE). Also fixes a session limitation where nova_session couldn't read the session ID on the very first request because nova_stream_h only set it as a response cookie. Now the session ID is also injected into the Req map so it's immediately available to the plugin pipeline. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- nova_basic_handler_test: 8 tests for maybe_inject_csrf_token/2 (proplist, map, empty, no token in req) - nova_session_test: 6 tests for nova_session_id Req map fallback (get/set via Req key, cookie fallback, priority over cookie, error when no session) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
These required status checks were configured in branch protection but never reported by the workflow, blocking all PR merges. Co-Authored-By: Claude Opus 4.6 <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
nova_csrf_plugin— CSRF protection using the synchronizer token pattern (generate random token per session, validate on POST/PUT/PATCH/DELETE)nova_stream_hnow injects the new session ID into the Req map sonova_sessioncan use it immediately, instead of waiting for the cookie round-tripcsrf_tokeninto template variables innova_basic_handler:handle_view/4so templates can use{{ csrf_token }}Details
Plugin options:
field_name— form field name (default_csrf_token)header_name— header name (defaultx-csrf-token)session_key— session storage key (default_csrf_token)excluded_paths— list of path prefixes to skipToken lookup order:
x-csrf-tokenheader first, then_csrf_tokenin parsed form params. Usescrypto:hash_equals/2for constant-time comparison.Requires
nova_request_pluginto run beforenova_csrf_pluginso form params are parsed.Test plan
🤖 Generated with Claude Code