Repository navigation
Restrict the Media Editor's form routes to users who can open it - #2252
Conversation
🔍 WordPress Plugin Check Report
📊 Report
|
| 📍 Line | 🔖 Check | 💬 Message |
|---|---|---|
0 |
mismatched_plugin_name | Plugin name "GoDAM - Organize WordPress Media Library & File Manager with Unlimited Folders for Images, Videos & more" is different from the name declared in plugin header "GoDAM". |
0 |
trademarked_term | The plugin name includes a restricted term. Your chosen plugin name - "GoDAM - Organize WordPress Media Library & File Manager with Unlimited Folders for Images, Videos & more" - contains the restricted term "wordpress" which cannot be used at all in your plugin name. |
📁 assets/build/css/main.css (1 warning)
| 📍 Line | 🔖 Check | 💬 Message |
|---|---|---|
0 |
EnqueuedStylesScope | This style is being loaded in all contexts. |
📁 assets/src/libs/analytics.min.js (5 warnings)
| 📍 Line | 🔖 Check | 💬 Message |
|---|---|---|
0 |
EnqueuedScriptsScope | This script is being loaded in all frontend contexts. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880 (with handle analytics-library) is loaded in the footer. Consider a defer or async script loading strategy instead. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880/2026/10/26/hello-world/ (with handle analytics-library) is loaded in the footer. Consider a defer or async script loading strategy instead. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880/sample-page/ (with handle analytics-library) is loaded in the footer. Consider a defer or async script loading strategy instead. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880/demo-attachment-post/ (with handle analytics-library) is loaded in the footer. Consider a defer or async script loading strategy instead. |
📁 assets/build/js/main.min.js (5 warnings)
| 📍 Line | 🔖 Check | 💬 Message |
|---|---|---|
0 |
EnqueuedScriptsScope | This script is being loaded in all frontend contexts. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880 (with handle rtgodam-script) is loaded in the footer. Consider a defer or async script loading strategy instead. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880/2026/10/26/hello-world/ (with handle rtgodam-script) is loaded in the footer. Consider a defer or async script loading strategy instead. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880/sample-page/ (with handle rtgodam-script) is loaded in the footer. Consider a defer or async script loading strategy instead. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880/demo-attachment-post/ (with handle rtgodam-script) is loaded in the footer. Consider a defer or async script loading strategy instead. |
🤖 Generated by WordPress Plugin Check Action • Learn more about Plugin Check
The form listing and single-form routes are only called by the Media Editor, so they now need upload_files, the capability the Media Editor page requires and the Gravity Forms routes already use. The shared check moves into the REST base class. The listings return what the form pickers use: a form's id and title (Forminator: name). The player shows a Jetpack form, and accepts entries for it, only when the post that holds the form is published, viewable and has no password. The Media Editor's Jetpack preview skips a post its user can neither see nor edit. The Jetpack form submission route stays public, since the player posts to it. The MetForm routes and the Jetpack forms listing stay public: they return only what WordPress already shows visitors (public form posts and the titles of published posts).
53f6e50 to
a23fd84
Compare
|
Tested together with the other five 2.5.1 PRs on a hosted test site connected to production GoDAM Central. Full table and all recordings: https://github.com/rtCamp/godam-plugin-wp/issues/68 (recordings are in the rtCamp Test media library; sign in to watch). Tested commit
|
elifvish
left a comment
There was a problem hiding this comment.
Low: the Jetpack picker (get_jetpack_forms(), outside this diff) still lists forms from published posts that have a password, but is_host_post_public() now hides those forms on the front end and refuses their submissions, so an author can pick a form that never shows. Adding AND p.post_password = '' to that query would line the picker up with the front end.
Verification
- Head tested:
a23fd84e5a. PHPUnit on this PR's head: 659/659 OK. - All seven 2.5.1 PRs merged onto
main(no conflicts): PHPUnit 915/915, Jest 690/690,build:prodOK. - Playwright API checks against that build on a local WordPress 7.1.3 site: 13/13 for this PR.
- Not covered: Jetpack (not installed on test-this): render/submit gating covered by unit tests only; Subscriber role: holds upload_files on test-this, so not checked there; SureForms, Forminator, Everest, CF7 (not installed).
Screenshots and a recording of the local run are available on request.
Review — Approvable ✅Reviewed at high effort as an authorization hotfix. This is a clean, deep fix. Authorization (the core change)
Jetpack host-post visibility
Also good: Note (no change needed): The pre-existing CF7 6.2.3 and Jetpack 16.3.1 observations in the description are not introduced by this PR and are out of scope for the hotfix. LGTM. 🚀 |
What changes
Form routes used only by the Media Editor now need
upload_files, the capability the Media Editor page requires and the Gravity Forms routes already use (#2049). The shared check isBase::forms_permissions_check()ininc/classes/rest-api/class-base.php;class-gf.phpnow inherits it, with no change in behaviour.upload_filesjetpack-form)upload_filesJetpack forms inside videos (
inc/classes/rest-api/class-jetpack.php, newis_host_post_public()): the player shows a Jetpack form, and the submit route accepts an entry for it, only when the post holding the form is published, viewable and has no password. Otherwise the submit route answers 404form_not_found, as for a missing post. The submit route itself stays public, because the player posts to it. The Media Editor's Jetpack preview shows a non-public post's form only to a user who can edit that post.No change: the MetForm routes and the Jetpack forms listing stay public. They return only what WordPress already shows visitors: MetForm forms are public posts, and the Jetpack listing has the titles of published posts.
Testing
Throwaway WordPress (Playground) with the 2.5.0 release plus these files; Jetpack (contact forms on), WPForms Lite, SureForms, Fluent Forms, Ninja Forms, Everest Forms, Forminator, MetForm and Contact Form 7 installed.
FormRoutePermissionTest,FormListingFieldsTest,JetpackFormHostPostTest); full suite OK (659 tests).phpcsclean;bin/hook-checkchecks pass. No JS changed.Worth knowing
client_idor status.jetpack_form_fill_durationfield thatjetpack-form.jsdoesn't skip. It works with Jetpack 15.4.1.contactform7_not_activeon current Contact Form 7 (6.2.3), because it checks for a class CF7 no longer has.QA:
/wp-json/godam/v1/wpforms: refused.Issue: rtCamp/godam-plugin-wp#73