Repository navigation
Conversation
CKAN 2.11 enforces CSRF protection on POST forms (PR #329 added the token to most extension forms), but organization/member_new.html was missed, causing '400 Bad Request: The CSRF token is missing' whenever an org admin submits Add Member. group/member_new.html doesn't need the same fix — it doesn't exist as a theme override, so it already falls back to CKAN core's template, which has the token.
Contributor
Author
|
Closing in favor of #336, which targets |
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
CKAN 2.11 enforces CSRF protection on POST forms. PR #329 (
chore (6/8): add CSRF tokens for CKAN 2.11 forms) added{{ h.csrf_input() }}to most extension forms but missedorganization/member_new.html, which still causes:whenever an organization admin submits the Add Member / Edit Member form.
Root cause
Confirmed via live reproduction on
dev-adr.unaids.org: fetched the raw server-rendered HTML fororganization/member_new.htmland confirmed nocsrf_tokenhidden input is present in the<form>, while the same page's other forms (logout, language switcher) correctly include it. Checked all 8 merged CKAN-2.11-migration PRs (#324-#331) — none of them add the token to this file. PR #328 (Bootstrap 5 migration) touched this file only for apull-left→float-startclass rename, unrelated to CSRF.Fix
One line, matching the exact pattern used by PR #329 elsewhere: add
{{ h.csrf_input() }}immediately after the opening<form>tag.Scope note
group/member_new.htmldoes not need the same fix — it doesn't exist as a theme override onmaster(only exists on an unrelated unmerged branch), so group Add Member already falls back to CKAN core's template, which already has the CSRF field.